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

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

Re: How to exclude a major mode from a hook


From: Robert Thorpe
Subject: Re: How to exclude a major mode from a hook
Date: Thu, 12 Feb 2015 02:39:50 +0000

Nicolas Richard <theonewiththeevillook@yahoo.fr> writes:

> Hi,
>
> Cecil Westerhof <Cecil@decebal.nl> writes:
>> I had the following in my .emacs:
>>     (add-hook 'before-save-hook 'delete-trailing-whitespace)
>
> IMO this is not the right thing to do, because one day you'll want to
> edit a file in which trailing white spaces are important and you'll
> wonder why it's all screwed up.

I agree.  It's much better to use an inclusive method for things like
this.  Find the programming languages and text modes that you care about
and only hook those.  It's not very hard, and when you think about it
the list is probably less than 20 items.  Doing it this way also means
you can (eventually) put the add-hook in a section of your init file
devoted to that a group of related language modes which makes it easier
to understand.

BR,



reply via email to

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