--- /dev/null
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 81615431FAE\r
+ for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 20:24:55 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 8mns0Qxp2MTm for <notmuch@notmuchmail.org>;\r
+ Wed, 19 Feb 2014 20:24:49 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
+ [18.9.25.12])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 246F5431FBD\r
+ for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 20:24:49 -0800 (PST)\r
+X-AuditID: 1209190c-f794a6d000000c27-47-53058390644b\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 2D.44.03111.09385035; Wed, 19 Feb 2014 23:24:48 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id s1K4OjnU023899; \r
+ Wed, 19 Feb 2014 23:24:45 -0500\r
+Received: from drake.dyndns.org\r
+ (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+ [216.15.114.40]) (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s1K4OfDO008704\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Wed, 19 Feb 2014 23:24:44 -0500\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1WGLBb-0002uj-MW; Wed, 19 Feb 2014 23:24:35 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Avoid rebuilding .eldeps even when there's nothing to\r
+ do\r
+Date: Wed, 19 Feb 2014 23:24:24 -0500\r
+Message-Id: <1392870264-11156-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+In-Reply-To: <m2iosade2y.fsf@guru.guru-group.fi>\r
+References: <m2iosade2y.fsf@guru.guru-group.fi>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixCmqrDuhmTXY4MMSTovrN2cyW7xZOY/V\r
+ gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4MqYvryPqWCVcMW1uVwNjC/4uxg5OSQETCQO\r
+ bnrEDmGLSVy4t54NxBYSmM0kseGTbRcjF5C9kVGicfMmRgjnDpPEzVNL2SGcuYwSE84fBmtn\r
+ E9CQ2LZ/OSOILSIgLbHz7mxWEJtZwEri8NVNYLawQIDE4YZVYDUsAqoSP7c2sIDYvAIOEpvv\r
+ 3WaGOENJYuGpbWD1nAIGEltefWWFOElf4sKtVywTGPkXMDKsYpRNya3SzU3MzClOTdYtTk7M\r
+ y0st0jXUy80s0UtNKd3ECA4kSZ4djG8OKh1iFOBgVOLhZbjKEizEmlhWXJl7iFGSg0lJlPdR\r
+ HmuwEF9SfkplRmJxRnxRaU5q8SFGCQ5mJRFenkygHG9KYmVValE+TEqag0VJnLfW4leQkEB6\r
+ YklqdmpqQWoRTFaGg0NJgreoCahRsCg1PbUiLTOnBCHNxMEJMpwHaHgwSA1vcUFibnFmOkT+\r
+ FKOilDjvBpCEAEgiozQPrhcW6a8YxYFeEeYNB6niASYJuO5XQIOZgAZ77WUEGVySiJCSamC0\r
+ NF507uCV4gkyTQF512XP9N4xnzLLW9XuCGd41J0Nr7dELbl+y+SZhW/+z4KCFcJGsSfCcmqc\r
+ 0zavdC5MnHewbxLvnGaZDca7P/xpi+52XWwiKPffO/fE3t6adFsHPp09XP47VfYYh+gE6rEd\r
+ flKx7UKhgYLDJTZr0clzDj341VTtZT7fcrsSS3FGoqEWc1FxIgBbS+XkzwIAAA==\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 20 Feb 2014 04:24:55 -0000\r
+\r
+Previously, we updated .eldeps only if the file contents actually\r
+needed to change. This was done to avoid unnecessary make restarts\r
+(if the .eldeps rule changes the mtime of .eldeps, make has to restart\r
+to collect the new dependencies). However, this meant that, after a\r
+modification to any .el file that did not change dependencies, .eldeps\r
+would always be out of date, so every make invocation would run the\r
+.eldeps rule, which is both expensive because it starts up Emacs and\r
+noisy. This was true even when there was nothing to do. E.g.,\r
+\r
+$ make clean && make\r
+...\r
+$ touch emacs/notmuch-lib.el && make\r
+...\r
+$ make\r
+Use "make V=1" to see the verbose compile lines.\r
+EMACS emacs/.eldeps\r
+make: Nothing to be done for `all'.\r
+$ make\r
+Use "make V=1" to see the verbose compile lines.\r
+EMACS emacs/.eldeps\r
+make: Nothing to be done for `all'.\r
+\r
+Fix this by replacing .eldeps with two files with identical content.\r
+One tracks the mtime of the dependency information and triggers the\r
+Emacs call to rebuild dependencies only when it may be necessary. The\r
+other tracks the content only; this rule over-triggers in the same way\r
+the old rule did, but this rule is cheap and quiet.\r
+---\r
+ emacs/Makefile.local | 15 ++++++++++++---\r
+ 1 file changed, 12 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
+index 42bfbd9..6a39b32 100644\r
+--- a/emacs/Makefile.local\r
++++ b/emacs/Makefile.local\r
+@@ -33,10 +33,19 @@ ifeq ($(HAVE_EMACS),1)\r
+ $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)\r
+ $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \\r
+ -f batch-make-deps $(emacs_sources) > $@.tmp && \\r
+- (cmp -s $@.tmp $@ || mv $@.tmp $@)\r
+--include $(dir)/.eldeps\r
++ mv $@.tmp $@\r
++# We could include .eldeps directly, but that would cause a make\r
++# restart whenever any .el file was modified, even if dependencies\r
++# didn't change, because the mtime of .eldeps will change. Instead,\r
++# we include a second file, .eldeps.x, which we ensure always has the\r
++# same content as .eldeps, but its mtime only changes when dependency\r
++# information changes, in which case a make restart is necessary\r
++# anyway.\r
++$(dir)/.eldeps.x: $(dir)/.eldeps\r
++ @cmp -s $^ $@ || cp $^ $@\r
++-include $(dir)/.eldeps.x\r
+ endif\r
+-CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp\r
++CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x\r
+ \r
+ ifeq ($(HAVE_EMACS),1)\r
+ %.elc: %.el $(global_deps)\r
+-- \r
+1.8.4.rc3\r
+\r