From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: Temporarily suppress a hook? Date: Sun, 8 Jul 2018 17:43:15 -0700 (PDT) Message-ID: <3b2c670c-e07e-4a35-a2a4-f933e23329f2@default> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1531096914 13667 195.159.176.226 (9 Jul 2018 00:41:54 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 9 Jul 2018 00:41:54 +0000 (UTC) To: Skip Montanaro , Help GNU Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 09 02:41:50 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 1fcKFS-0003QM-Gy for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Jul 2018 02:41:50 +0200 Original-Received: from localhost ([::1]:38695 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcKHX-0005lC-KM for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Jul 2018 20:43:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcKH0-0005l3-PQ for help-gnu-emacs@gnu.org; Sun, 08 Jul 2018 20:43:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcKGv-0008Mh-Tf for help-gnu-emacs@gnu.org; Sun, 08 Jul 2018 20:43:26 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:46456) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcKGv-0008ME-KO for help-gnu-emacs@gnu.org; Sun, 08 Jul 2018 20:43:21 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w690cqro112693; Mon, 9 Jul 2018 00:43:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=oSlXRv9CCHOa3BrvygYHPW2C+8rcv/izfJIQ93b7nEE=; b=Ynd7inqrDRYrRHy6B9pUEsQN0dwC1NPyKSd0pavr+VQ0Ct9p2ZdLWaepC16zAPHjVNqN nx1sXuEVcYV79tdOYBb9OFGBhYUxg7RHfq3xXw5XXE2BLfgzW4Nxs6MqoU/SU716MbKd 1xulAFp2/SuxvTKtKarWNbN66q15+lI9nirjexoeXVxvTp0qzTiqURmFGSEKztvynV0Y FuyCojTaYIgMeHxGms6btHLHeaDwyjgS4UO9vQrDj5Y62iDcm/JyZut5zRRZUvLa5kbc GI44x3oqT0RU8J3RxFGjk+M7wPx0bszX+jPyC0A+kQG7EFLxLK2mV8izwAWIdbo8a4Gi nQ== Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2k2p7v25a8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 09 Jul 2018 00:43:19 +0000 Original-Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w690hImn004222 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 9 Jul 2018 00:43:19 GMT Original-Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w690hIek004509; Mon, 9 Jul 2018 00:43:18 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4705.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8948 signatures=668705 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=642 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807090006 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 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:117390 Archived-At: > I have before-save-hook defined in ~/.emacs > (add-hook 'before-save-hook 'delete-trailing-whitespace) >=20 > This is useful almost all the time. I just discovered a case where > it's not so helpful (a file full of regular expressions to feed into > "grep -E -f ..." >=20 > I can think of various ways to tweak the regular expressions to not > require trailing whitespace, but let's assume for a moment that's not > possible. Is it possible to suppress the before-save-hook on a > per-file basis? Both `add-hook' and `remove-hook' take an optional LOCAL argument, to affect only the current buffer (the buffer-local value of the hook).