all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to exclude a major mode from a hook
@ 2015-02-11  9:22 Cecil Westerhof
  2015-02-11  9:50 ` Fabrice Niessen
  2015-02-11 10:15 ` Nicolas Richard
  0 siblings, 2 replies; 5+ messages in thread
From: Cecil Westerhof @ 2015-02-11  9:22 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-12  2:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11  9:22 How to exclude a major mode from a hook Cecil Westerhof
2015-02-11  9:50 ` Fabrice Niessen
2015-02-11 12:31   ` Cecil Westerhof
2015-02-11 10:15 ` Nicolas Richard
2015-02-12  2:39   ` Robert Thorpe

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.