From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: How to exclude a major mode from a hook Date: Thu, 12 Feb 2015 02:39:50 +0000 Message-ID: <8761b7kg3t.fsf@robertthorpeconsulting.com> References: <878ug4hhzu.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423708827 963 80.91.229.3 (12 Feb 2015 02:40:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Feb 2015 02:40:27 +0000 (UTC) Cc: Cecil@decebal.nl, help-gnu-emacs@gnu.org To: Nicolas Richard Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 12 03:40:16 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 1YLjhO-0003cX-Ql for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Feb 2015 03:40:14 +0100 Original-Received: from localhost ([::1]:47895 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLjhO-0005q2-6o for geh-help-gnu-emacs@m.gmane.org; Wed, 11 Feb 2015 21:40:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLjh8-0005eL-Cf for help-gnu-emacs@gnu.org; Wed, 11 Feb 2015 21:40:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLjh3-0002QJ-9K for help-gnu-emacs@gnu.org; Wed, 11 Feb 2015 21:39:58 -0500 Original-Received: from outbound-smtp05.blacknight.com ([81.17.249.38]:53236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLjh3-0002QC-3J for help-gnu-emacs@gnu.org; Wed, 11 Feb 2015 21:39:53 -0500 Original-Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp05.blacknight.com (Postfix) with ESMTPS id 2A6E1984A2 for ; Thu, 12 Feb 2015 02:39:52 +0000 (UTC) Original-Received: (qmail 13000 invoked from network); 12 Feb 2015 02:39:52 -0000 Original-Received: from unknown (HELO RTLaptop) (rt@robertthorpeconsulting.com@[109.76.224.229]) by 81.17.254.9 with ESMTPSA (DHE-RSA-AES128-SHA encrypted, authenticated); 12 Feb 2015 02:39:51 -0000 In-Reply-To: <878ug4hhzu.fsf@yahoo.fr> (message from Nicolas Richard on Wed, 11 Feb 2015 11:15:01 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 81.17.249.38 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:102659 Archived-At: Nicolas Richard writes: > Hi, > > Cecil Westerhof 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,