From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Visher Newsgroups: gmane.emacs.help Subject: Re: disable save hook temporarily Date: Fri, 23 Aug 2013 15:03:42 -0400 Message-ID: References: <20130820174528.GA3337@a.lan> <20130822213216.GA7138@a.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1377284673 1279 80.91.229.3 (23 Aug 2013 19:04:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Aug 2013 19:04:33 +0000 (UTC) Cc: emacs To: wempwer@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 23 21:04:37 2013 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 1VCwey-0000SL-MJ for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Aug 2013 21:04:36 +0200 Original-Received: from localhost ([::1]:38319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCwey-0008U0-72 for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Aug 2013 15:04:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCwem-0008Th-UJ for help-gnu-emacs@gnu.org; Fri, 23 Aug 2013 15:04:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCwel-0001kE-IX for help-gnu-emacs@gnu.org; Fri, 23 Aug 2013 15:04:24 -0400 Original-Received: from mail-ve0-x229.google.com ([2607:f8b0:400c:c01::229]:57166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCwel-0001k8-E8 for help-gnu-emacs@gnu.org; Fri, 23 Aug 2013 15:04:23 -0400 Original-Received: by mail-ve0-f169.google.com with SMTP id db10so755953veb.0 for ; Fri, 23 Aug 2013 12:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=SoYkEFcGeeWlHRpGTZUa3+SbNKNOPvDcOn9KkKh8QnM=; b=hHDM5WobexmmjQzNzGNDQSpbPlWihlNB2qmwxpy3kBJf18QK5ihfhHjUTL2eg12992 aodA4oXItNd8Tv92Ixlc8zd3kokSlm42tOA39B5to5PfGnd50+ZQoq8V4/NTjCP8pAC4 k3UFve1+ekBBpISNF/5NS9lOVUYkHaC3KU/2KPA31AZytMNwBlypmbf8ljNPhUOqUCSg qrjMeMBI+RUgByuV/UlD/nWN0w0Ixki956MfPgCuvPj0U2Qex+PZ+06ZWEr+WPgUmE+w p2mj1aTh1//Qd9PVUnT1Vp1NJlmx6ApqT41Ji1f8w8scrhQxO5ZEcwODFaQTMiWYmYhu 0Zwg== X-Received: by 10.220.76.10 with SMTP id a10mr739354vck.31.1377284662985; Fri, 23 Aug 2013 12:04:22 -0700 (PDT) Original-Received: by 10.221.54.129 with HTTP; Fri, 23 Aug 2013 12:03:42 -0700 (PDT) In-Reply-To: <20130822213216.GA7138@a.lan> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400c:c01::229 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:93066 Archived-At: On Thu, Aug 22, 2013 at 5:32 PM, wrote: > On Wed, Aug 21, 2013 at 10:22:23AM -0400, Tim Visher wrote: >> On Tue, Aug 20, 2013 at 1:45 PM, wrote: >> > I have plenty of stuff put in my C-mode save hook such as untabify, >> > remove trailing whitespaces, add a new line at the end etc. It's good >> > but sometimes I receive code from someone, need to do some changes in >> > it and send it back or just contribute to a larger project that >> > already has their own set of rules I don't want to break. The other >> > thing is that sometimes, especially in very big files it can take a >> > substantial amount of time to parse the whole buffer and execute save >> > hook. So my question is, what is the fastest and the most convenient >> > way to disable c save hook temporarily or how do you handle these >> > things? One idea that came to mind is to store all my code in a >> > specified directory such as ~/c and execute my save hook only for >> > files in this directory and don't call the hook for files in other >> > directories. >> >> This is untested, but maybe putting >> >> ((c-mode . ((before-save-hook . nil)))) >> >> in the `.dir-locals.el` file of the project would do the trick? > > This concept is quite similar to my idea but instead of putting all .c > files I want to be processed by save hook into one directory and > running a hook that checks if a particular file actually is in a given > directory you suggest to put `.dir-locals.el' file in every single > directory with .c files. Seems quite error-prone and tiring. It's not in every single directory with .c files. It's in the top level of projects you're contributing to that you know you're defaults don't line up with. You could probably save off a `nullify-c-mode-save-hooks.el` file somewhere on your system and have it be part of your cloning process to drop it into the directory when you first clone it. I certainly agree that it's slightly annoying but I wouldn't call it onerous. But if you find out a more elegant way to do it, let us know! -- In Christ, Timmy V. http://blog.twonegatives.com/ http://five.sentenc.es/ -- Spend less time on mail