From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.emacs.help Subject: How to exclude a major mode from a hook Date: Wed, 11 Feb 2015 10:22:40 +0100 Organization: Decebal Computing Message-ID: <87twysx0nz.fsf@Equus.decebal.nl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423648225 26054 80.91.229.3 (11 Feb 2015 09:50:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Feb 2015 09:50:25 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Feb 11 10:50:24 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YLTw8-0004Lz-9Z for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Feb 2015 10:50:24 +0100 Original-Received: from localhost ([::1]:43841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLTw7-0006DR-Iy for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Feb 2015 04:50:23 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-2.dfn.de!news.dfn.de!newsfeed.pionier.net.pl!feed.xsnews.nl!border01.ams.xsnews.nl!feeder01.ams.xsnews.nl!abp001.ams.xsnews.nl!frontend-F09-06.ams.news.kpn.nl Original-Newsgroups: gnu.emacs.help X-Face: "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR,v+Pti8=Vi/Z"g^?b"E X-Homepage: http://www.decebal.nl/ User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) Cancel-Lock: sha1:pTIsmtR16S0P9YdOj1XmSnAeL7k= Original-Lines: 14 Original-NNTP-Posting-Host: 77.171.42.144 Original-X-Trace: 1423646924 news.kpn.nl 20452 77.171.42.144@kpn/77.171.42.144:38637 Original-Xref: usenet.stanford.edu gnu.emacs.help:210356 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:102633 Archived-At: 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