help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Temporarily suppress a hook?


From: Drew Adams
Subject: RE: Temporarily suppress a hook?
Date: Sun, 8 Jul 2018 17:43:15 -0700 (PDT)

> I have before-save-hook defined in ~/.emacs
> (add-hook 'before-save-hook 'delete-trailing-whitespace)
> 
> This is useful almost all the time. I just discovered a case where
> it's not so helpful (a file full of regular expressions to feed into
> "grep -E -f ..."
> 
> I can think of various ways to tweak the regular expressions to not
> require trailing whitespace, but let's assume for a moment that's not
> possible. Is it possible to suppress the before-save-hook on a
> per-file basis?

Both `add-hook' and `remove-hook' take an optional
LOCAL argument, to affect only the current buffer
(the buffer-local value of the hook).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]