質問

if this is a duplicate please delete. I was just editing my .emacs file and after i had my changes done. I restarted emacs. But whet it comes up again it claims that the config file has some errors. And i should start with "--debug-init" thats what i also have done. But it did not helped me to solve nor find the syntax error. So is there a way to find the lines which have syntaxerror. Or even better if there would be something like a (e)lisp lint like you have for e.g xml, json, js and so on. Thanks in advance

Edit

Managed to get the dump:

Debugger entered--Lisp error: (void-variable whitespace-mode)
  redisplay_internal\ \(C\ function\)()
  delete-process(#<process server-client-test>)
 Someunicodefoo" [("server") server-use-tcp server-auth-dir server-socket-dir generate-new-buffer " *temp*" funcall make-byte-code 0 "Someunicodefoo" vconcat vector [buffer-name kill-buffer] 2 "\n\n(fn)" insert-file-contents-literally expand-file-name looking-at "127\\.0\\.0\\.1:[0-9]+ \\([0-9]+\\)" comm process-attributes string-to-number match-string 1 t :other delete-process make-network-process :name "server-client-test" :family local :server nil :noquery :service] 14 "\n\n(fn)"])
  server-running-p("server")
  byte-code("Someunicodefoo" [load-file-name buffer-file-name recentf-menu-before user-emacs-directory recentf-save-file server-name add-to-list load-path file-name-directory "../packages" tool-bar-mode 0 load "ergoemacs-keybindings/ergoemacs-mode" ergoemacs-mode 1 "init_load_packages" "init_version" "init_functions" "init_settings" "init_aliases" "init_abbrevs-lisp-mode" "init_keybinding" "init_mouse" "init_clean_menus" require recentf "Close" ".recentf" recentf-mode server server-running-p t server-start] 4)
  load("/home/dirk/.emacs.d/ergoemacs_1.9.3.1/site-lisp/../ergoemacs/init")
  eval-buffer(#<buffer  *load*-842275> nil "/home/dirk/.emacs.d/ergoemacs_1.9.3.1/site-lisp/site-start.el" nil t)  ; Reading at buffer position 1432
  load-with-code-conversion("/home/dirk/.emacs.d/ergoemacs_1.9.3.1/site-lisp/site-start.el" "/home/dirk/.emacs.d/ergoemacs_1.9.3.1/site-lisp/site-start.el" nil nil)
  load("/home/dirk/.emacs.d/ergoemacs_1.9.3.1/site-lisp/site-start.el" nil nil t)
  load-file("~/.emacs.d/ergoemacs_1.9.3.1/site-lisp/site-start.el")
  eval-buffer(#<buffer  *load*> nil "/home/dirk/.emacs" nil t)  ; Reading at buffer position 2883
  load-with-code-conversion("/home/dirk/.emacs" "/home/dirk/.emacs" t t)
  load("~/.emacs" t t)
  command-line()
  normal-top-level()
役に立ちましたか?

解決

One way to do it is to open the file and mark the first half of it and apply eval-region. If an error is reported, mark half of it and repeat. If an error isn't reported, apply it to the other half.

This way you could narrow down the problem and once you have found it you can hopefully figure out the problem.

Another technique I use to find incorrect parentheses is to add an extra parenthesis to the beginning and end of the file, respectively and run C-M-f and C-M-b from the beginning and end, respectively. If there are incorrect parentheses, they will match the newly added ones, and the point will move to the incorrect ones.

EDIT: You can use M-x check-parens to check for unmatched parentheses.

他のヒント

For "lint"-like checking, there's elint.el, but more importantly, there's the byte-compiler: M-x byte-compile-file RET lets you byte-compile a file and will give you all kinds of warnings about syntax and style.

But your backtrace indicates that the problem is probably not one of syntax. Most like there's a whitespace-mode that appears somewhere in a menu (i.e. in an :enable property of a menu entry), and that signals an error because the whitespace-mode variable happens not to be defined yet. So as Phils suggests, loading whitespace would probably work around the problem.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top