all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Thorpe <rt@robertthorpeconsulting.com>
To: Nicolas Richard <theonewiththeevillook@yahoo.fr>
Cc: Cecil@decebal.nl, help-gnu-emacs@gnu.org
Subject: Re: How to exclude a major mode from a hook
Date: Thu, 12 Feb 2015 02:39:50 +0000	[thread overview]
Message-ID: <8761b7kg3t.fsf@robertthorpeconsulting.com> (raw)
In-Reply-To: <878ug4hhzu.fsf@yahoo.fr> (message from Nicolas Richard on Wed, 11 Feb 2015 11:15:01 +0100)

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	other threads:[~2015-02-12  2:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761b7kg3t.fsf@robertthorpeconsulting.com \
    --to=rt@robertthorpeconsulting.com \
    --cc=Cecil@decebal.nl \
    --cc=help-gnu-emacs@gnu.org \
    --cc=theonewiththeevillook@yahoo.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.