--- /dev/null
+Return-Path: <too@guru-group.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 E01BE431FD7\r
+ for <notmuch@notmuchmail.org>; Tue, 27 Aug 2013 10:43:19 -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 6y-gDlsS66Oz for <notmuch@notmuchmail.org>;\r
+ Tue, 27 Aug 2013 10:43:13 -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 93972431FD6\r
+ for <notmuch@notmuchmail.org>; Tue, 27 Aug 2013 10:43:13 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id C67B31000F4; Tue, 27 Aug 2013 20:43:03 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/1] emacs: Makefile.local: HAVE_EMACS usage fixes\r
+Date: Tue, 27 Aug 2013 20:43:01 +0300\r
+Message-Id: <1377625381-23440-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\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: Tue, 27 Aug 2013 17:43:20 -0000\r
+\r
+If we don't have emacs, disable targets that used EMACS while doing\r
+the recipes of that target.\r
+\r
+If we do have emacs, make install-emacs depend on *.elc files,\r
+as making the target will attempt to install those.\r
+---\r
+\r
+I tested this first by running tests normally.\r
+Next with ./configure --without-emacs (after make distclean).\r
+Then I did this:\r
+\r
+diff --git a/configure b/configure\r
+index 6166917..3640b47 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -363,3 +363,3 @@ fi\r
+ printf "Checking if emacs is available... "\r
+-if emacs --quick --batch > /dev/null 2>&1; then\r
++if eemacs --quick --batch > /dev/null 2>&1; then\r
+ printf "Yes.\n"\r
+@@ -658,3 +658,3 @@ CXX = ${CXX}\r
+ # Command to execute emacs from Makefiles\r
+-EMACS = emacs --quick\r
++EMACS = eemacs --quick\r
+\r
+to hide emacs (make distclean; ./configure; make)\r
+\r
+All of these worked as expected.\r
+\r
+\r
+Tested the latest with current master (i.e without this patch):\r
+\r
+$ make\r
+Use "make V=1" to see the verbose compile lines.\r
+EMACS emacs/.eldeps\r
+/bin/sh: eemacs: command not found\r
+make: Nothing to be done for `all'.\r
+\r
+(although it seems to work, it complains...)\r
+\r
+Finally, after applying this patch (and restoring configure),\r
+./configure && make install-emacs DESTDIR=$HOME/DDIR worked fine\r
+\r
+(without this patch the above gives:\r
+ install: cannot stat ‘emacs/notmuch-lib.elc’: No such file or directory\r
+ install: cannot stat ‘emacs/notmuch-parser.elc’: No such file or directory\r
+ ...)\r
+\r
+\r
+ emacs/Makefile.local | 5 +++++\r
+ 1 file changed, 5 insertions(+)\r
+\r
+diff --git a/emacs/Makefile.local b/emacs/Makefile.local\r
+index a910aff..a7e967e 100644\r
+--- a/emacs/Makefile.local\r
++++ b/emacs/Makefile.local\r
+@@ -28,19 +28,24 @@ emacs_bytecode = $(emacs_sources:.el=.elc)\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
++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
++endif\r
+ CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp\r
+ \r
++ifeq ($(HAVE_EMACS),1)\r
+ %.elc: %.el $(global_deps)\r
+ $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<\r
++endif\r
+ \r
+ ifeq ($(WITH_EMACS),1)\r
+ ifeq ($(HAVE_EMACS),1)\r
+ all: $(emacs_bytecode)\r
++install-emacs: $(emacs_bytecode)\r
+ endif\r
+ \r
+ install: install-emacs\r
+-- \r
+1.8.0\r
+\r