--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 75BFC431FBD\r
+ for <notmuch@notmuchmail.org>; Sun, 19 May 2013 07:33:35 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 erplEgQdO326 for <notmuch@notmuchmail.org>;\r
+ Sun, 19 May 2013 07:33:30 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9247B431FBC\r
+ for <notmuch@notmuchmail.org>; Sun, 19 May 2013 07:33:30 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 14BF31002C3;\r
+ Sun, 19 May 2013 17:33:25 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: Compute build dependencies to fix byte compile\r
+ issues\r
+In-Reply-To: <1368821611-24110-1-git-send-email-amdragon@mit.edu>\r
+References: <1368821611-24110-1-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.15.2+99~g7e455bc (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 19 May 2013 17:33:24 +0300\r
+Message-ID: <m2a9nrghu3.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Sun, 19 May 2013 14:33:35 -0000\r
+\r
+On Fri, May 17 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
+\r
+> Previously, we simply byte compiled each Elisp source file\r
+> independently. This is actually the wrong thing to do and can lead to\r
+> issues with macros and performance issues with substitutions because\r
+> 1) when the byte compiler encounters a (require 'x) form, it will load\r
+> x.elc in preference to x.el, even if x.el is newer, and as a result\r
+> may load old macro and substitution definitions and 2) if we update a\r
+> macro or substitution definition in one file, we currently won't\r
+> re-compile other files that depend on the file containing the\r
+> definition.\r
+>\r
+> This patch addresses these problems by computing make dependency rules\r
+> from the (require 'x) forms in the Elisp source files, which we inject\r
+> into make's dependency database.\r
+> ---\r
+> emacs/Makefile.local | 12 +++++++++\r
+> emacs/make-deps.el | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
+> 2 files changed, 78 insertions(+)\r
+> create mode 100644 emacs/make-deps.el\r
+>\r
+> diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
+> index fb82247..456700a 100644\r
+> --- a/emacs/Makefile.local\r
+> +++ b/emacs/Makefile.local\r
+> @@ -22,6 +22,18 @@ emacs_images := \\r
+> \r
+> emacs_bytecode = $(emacs_sources:.el=.elc)\r
+> \r
+> +# Because of defmacro's and defsubst's, we have to account for load\r
+> +# dependencies between Elisp files when byte compiling. Otherwise,\r
+> +# the byte compiler may load an old .elc file when processing a\r
+> +# "require" or we may fail to rebuild a .elc that depended on a macro\r
+> +# from an updated file.\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
+\r
+The last line above could be in format\r
+\r
+ { cmp -s $@.tmp $@ || mv $@.tmp $@; }\r
+\r
+so that the expression is evaluated in current shell instead of a subshell.\r
+\r
+You may consider changing this if you add year to copyright line.\r
+\r
+Tomi\r
+\r
+\r
+> +-include $(dir)/.eldeps\r
+> +CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp\r
+> +\r
+> %.elc: %.el $(global_deps)\r
+> $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<\r
+> \r