From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.help Subject: Re: Temporarily suppress a hook? Date: Mon, 09 Jul 2018 09:53:52 +0200 Message-ID: <87pnzw975b.fsf@telefonica.net> References: <87tvp97znb.fsf@telefonica.net> <20180709060011.GB15665@tuxteam.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1531123076 784 195.159.176.226 (9 Jul 2018 07:57:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 9 Jul 2018 07:57:56 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 09 09:57:52 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fcR3N-0008Sb-L7 for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jul 2018 09:57:49 +0200 Original-Received: from localhost ([::1]:39797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcR5T-0008Hd-83 for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jul 2018 03:59:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49062) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcQzn-0004Yr-P2 for help-gnu-emacs@gnu.org; Mon, 09 Jul 2018 03:54:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcQzh-0006xr-Tk for help-gnu-emacs@gnu.org; Mon, 09 Jul 2018 03:54:07 -0400 Original-Received: from [195.159.176.226] (port=44458 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fcQzh-0006xZ-Mr for help-gnu-emacs@gnu.org; Mon, 09 Jul 2018 03:54:01 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fcQxX-0001Kh-RR for help-gnu-emacs@gnu.org; Mon, 09 Jul 2018 09:51:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:BxrvqTOlJDxZzoGYCiv0fS7at7g= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:117395 Archived-At: writes: > On Mon, Jul 09, 2018 at 07:21:12AM +0200, Óscar Fuentes wrote: >> Skip Montanaro writes: > > [...] > >> AFAIK, no. But you can use your own function instead of >> delete-trailing-whitespace: >> >> (defun my-delete-trailing-whitespace () >> (interactive) >> (unless my-special-buffer >> (delete-trailing-whitespace))) > >> (add-hook 'before-save-hook 'my-delete-trailing-whitespace) >> >> Or advice delete-trailing-whitespace. > > Or perhaps make the hook read a local variable you set in > the file (see "file local variables") and act accordingly. > > This way you could declare whithin those special files that you > don't want trailing space removed. I thought that it was unnecessary to explain that my-special-buffer is whatever predicate the OP feels convenient.