21.4 contains `add-local-hook'.
Jeff Mincy wrote:
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
--
ben
I'm sometimes slow in getting around to reading my mail, so if you
want to reach me faster, call 520-661-6661.
See
http://www.666.com/ben/chronic-pain/ for the hell I've been
through.