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: Óscar Fuentes
Subject: Re: Temporarily suppress a hook?
Date: Mon, 09 Jul 2018 09:53:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

<tomas@tuxteam.de> writes:

> On Mon, Jul 09, 2018 at 07:21:12AM +0200, Óscar Fuentes wrote:
>> Skip Montanaro <skip.montanaro@gmail.com> writes:
>
> [...]
>
>> AFAIK, no. But you can use your own function instead of
>> delete-trailing-whitespace:
>> 
>> (defun my-delete-trailing-whitespace ()
>>   (interactive)
>>   (unless my-special-buffer
>>     (delete-trailing-whitespace)))
>
>> (add-hook 'before-save-hook 'my-delete-trailing-whitespace)
>> 
>> Or advice delete-trailing-whitespace.
>
> Or perhaps make the hook read a local variable you set in
> the file (see "file local variables") and act accordingly.
>
> This way you could declare whithin those special files that you
> don't want trailing space removed.

I thought that it was unnecessary to explain that my-special-buffer is
whatever predicate the OP feels convenient.




reply via email to

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