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

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

How to exclude a major mode from a hook


From: Cecil Westerhof
Subject: How to exclude a major mode from a hook
Date: Wed, 11 Feb 2015 10:22:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

I had the following in my .emacs:
    (add-hook 'before-save-hook 'delete-trailing-whitespace)

But I also use Gnus and a signature starts with '-- ' and now the
space is deleted and it is not a signature anymore.

So I rewrote it to:
    (add-hook 'before-save-hook (lambda () (when (not (string= major-mode 
"message-mode"))
                                             'delete-trailing-whitespace)))

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


reply via email to

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