Pergunta

I am trying to automatically enable flyspell in emacs. In particular, I am interested in spellchecking the comments of my code. I followed the documentation in EmacsWiki and added the following code to my .emacs:

  (add-hook 'c++-mode-hook
          (lambda ()
            (flyspell-prog-mode)
            ; ...
          ))

However, I get the following error which I don't understand, I am frankly overwhelmed by the garbage emacs provides as an error (obtained emacs -debuginit):

Debugger entered--Lisp error: (wrong-number-of-arguments #[(hook function &optional append local) "\305$
^@^H\306L\210\307^H!\204^U^@\310^H\306\"\210    \203)^@\311^H!\2048^@\312^H!\313CL\210\2028^@^HJ:\2036^$
@\315=\203T^@
C^R^K
\235\204s^@^K;\203c^@\316^K!^S^L\203o^@\304
^KC\"\202r^@^K
B^R     \203\224^@^K9\203\216^@^K\317N\203\216^@^H\320N\204\216^@\321^H\320\317#\210^H
L\202\230^@\310^H
\")\207" [hook local hook-value function append boundp nil default-boundp set-default local-variable-if$
  add-hook(google-make-newline-indent)
  eval-buffer(#<buffer  *load*> nil "/Users/fons/.emacs" nil t)  ; Reading at buffer position 2136

I have also tried other ways to add the hooks such as this blog post, but they all lead to the same problem.

Note: I am running emacs 24, installed with macports in OSX 10.8

$ emacs --version | head -n 1
GNU Emacs 24.2.1
Foi útil?

Solução

It seems like your problem is an unrelated form in your .emacs file. From that backtrace, it probably looks like this:

(add-hook 'google-make-newline-indent)

The problem is that add-hook takes two arguments, the hook and the function to add to the hook, so one argument is missing. Fix this add-hook call or comment it out, and it should work better.

(The garbage you see in the backtrace is byte-compiled Emacs Lisp code. When an error occurs in interpreted code, the actual code of the function in question appears there, but for the byte-compiled case seeing the code is usually less than useful. It would be nice if Emacs could suppress that...)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top