Jeff Mincy writes:
I'm somewhat confused by why the following piece of code
does not work the way that I expect. I have
find-unbalanced-parentheses, which errors when there is
unbalanced parens. I tried adding a save hook, that is local
to only emacs-lisp mode files that calls find-unbalanced-parentheses.
However, after this code runs, the after-save-hook is run in all
buffers, and not just emacs-lisp-mode buffers.
(defun check-for-unbalanced-parens-on-save ()
(interactive)
(make-local-hook 'after-save-hook)
(add-hook 'after-save-hook 'find-unbalanced-parentheses))
(add-hook 'emacs-lisp-mode-hook 'check-for-unbalanced-parens-on-save)
Nevermind. add-hook expects a local argument.
(defun check-for-unbalanced-parens-on-save ()
(interactive)
(make-local-hook 'after-save-hook)
(add-hook 'after-save-hook 'find-unbalanced-parentheses nil
>>t<<))
Geez, I can stare at the problem for an hour, and I figure it out
five minutes after I send a mail message.
-jeff