--- /dev/null
+Return-Path: <jeff@ocjtech.us>\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 4342E431FBC\r
+ for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 13:20:27 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 aS9oiwhF2RZh for <notmuch@notmuchmail.org>;\r
+ Thu, 19 Nov 2009 13:20:26 -0800 (PST)\r
+Received: from ey-out-1920.google.com (ey-out-1920.google.com [74.125.78.149])\r
+ by olra.theworths.org (Postfix) with ESMTP id 283B0431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 13:20:26 -0800 (PST)\r
+Received: by ey-out-1920.google.com with SMTP id 26so833174eyw.6\r
+ for <notmuch@notmuchmail.org>; Thu, 19 Nov 2009 13:20:20 -0800 (PST)\r
+Received: by 10.213.23.213 with SMTP id s21mr1996972ebb.76.1258665619940;\r
+ Thu, 19 Nov 2009 13:20:19 -0800 (PST)\r
+Received: from lt26923.campus.dmacc.edu ([161.210.45.123])\r
+ by mx.google.com with ESMTPS id 14sm419165ewy.3.2009.11.19.13.20.18\r
+ (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+ Thu, 19 Nov 2009 13:20:18 -0800 (PST)\r
+Received: from localhost ([127.0.0.1] helo=localhost.localdomain)\r
+ by lt26923.campus.dmacc.edu with esmtps (TLSv1:AES256-SHA:256)\r
+ (Exim 4.69) (envelope-from <jeff@ocjtech.us>)\r
+ id 1NBEQJ-0000C2-88; Thu, 19 Nov 2009 15:20:15 -0600\r
+From: "Jeffrey C. Ollie" <jeff@ocjtech.us>\r
+To: Not Much Mail <notmuch@notmuchmail.org>\r
+Date: Thu, 19 Nov 2009 15:20:01 -0600\r
+Message-Id: <1258665602-700-1-git-send-email-jeff@ocjtech.us>\r
+X-Mailer: git-send-email 1.6.5.2\r
+In-Reply-To: <yunmy2i2u6t.fsf@aiko.keithp.com>\r
+References: <yunmy2i2u6t.fsf@aiko.keithp.com>\r
+Subject: [notmuch] [PATCH 1/2] Improve installation of emacs mode.\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\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, 19 Nov 2009 21:20:27 -0000\r
+\r
+1) Add a separate targets to build and install emacs mode.\r
+\r
+2) Don't hardcode the installation directory, instead use emacs'\r
+ pkg-config module.\r
+\r
+3) Install a byte compiled version of the emacs mode.\r
+\r
+4) Install the emacs mode in emacs' site-lisp directory. Put\r
+ "(require 'notmuch)" in your .emacs to load it automatically.\r
+\r
+5) Ignore byte-compiled emacs files.\r
+\r
+Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>\r
+---\r
+ .gitignore | 2 +-\r
+ Makefile | 6 ++++++\r
+ Makefile.local | 15 ++++++++++++---\r
+ 3 files changed, 19 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/.gitignore b/.gitignore\r
+index 8417d60..7d3c543 100644\r
+--- a/.gitignore\r
++++ b/.gitignore\r
+@@ -5,4 +5,4 @@ notmuch.1.gz\r
+ *.[ao]\r
+ *~\r
+ .*.swp\r
+-\r
++*.elc\r
+diff --git a/Makefile b/Makefile\r
+index 023b2ec..17fa4a2 100644\r
+--- a/Makefile\r
++++ b/Makefile\r
+@@ -7,6 +7,9 @@ CFLAGS=-O2\r
+ extra_cflags := $(shell pkg-config --cflags glib-2.0 gmime-2.4 talloc)\r
+ extra_cxxflags := $(shell xapian-config --cxxflags)\r
+ \r
++emacs_lispdir := $(shell pkg-config emacs --variable sitepkglispdir)\r
++emacs_startdir := $(shell pkg-config emacs --variable sitestartdir)\r
++\r
+ # Now smash together user's values with our extra values\r
+ override CFLAGS += $(WARN_FLAGS) $(extra_cflags)\r
+ override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags)\r
+@@ -28,6 +31,9 @@ include Makefile.config\r
+ %.o: %.c\r
+ $(CC) -c $(CFLAGS) $< -o $@\r
+ \r
++%.elc: %.el\r
++ emacs -batch -f batch-byte-compile $<\r
++\r
+ .deps/%.d: %.c\r
+ @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \\r
+ $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \\r
+diff --git a/Makefile.local b/Makefile.local\r
+index c44d160..ecd4ceb 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -1,5 +1,7 @@\r
+ all: notmuch notmuch.1.gz\r
+ \r
++emacs: notmuch.elc\r
++\r
+ notmuch_client_srcs = \\r
+ notmuch.c \\r
+ notmuch-config.c \\r
+@@ -25,15 +27,22 @@ notmuch.1.gz: notmuch.1\r
+ \r
+ install: all notmuch.1.gz\r
+ for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \\r
+- $(DESTDIR)/$(prefix)/share/emacs/site-lisp/ $(DESTDIR)/etc/bash_completion.d/ ; \\r
++ $(DESTDIR)/etc/bash_completion.d/ ; \\r
+ do \\r
+ install -d $$d ; \\r
+ done ;\r
+ install notmuch $(DESTDIR)$(prefix)/bin/\r
+ install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/\r
+- install -m0644 notmuch.el $(DESTDIR)$(prefix)/share/emacs/site-lisp/\r
+ install notmuch-completion.bash \\r
+ $(DESTDIR)/etc/bash_completion.d/notmuch\r
+ \r
++install-emacs: install emacs\r
++ for d in $(DESTDIR)/$(emacs_lispdir) ; \\r
++ do \\r
++ install -d $$d ; \\r
++ done ;\r
++ install -m0644 notmuch.el $(DESTDIR)$(emacs_lispdir)\r
++ install -m0644 notmuch.elc $(DESTDIR)$(emacs_lispdir)\r
++\r
+ SRCS := $(SRCS) $(notmuch_client_srcs)\r
+-CLEAN := $(CLEAN) notmuch $(notmuch_client_modules)\r
++CLEAN := $(CLEAN) notmuch $(notmuch_client_modules) notmuch.elc\r
+-- \r
+1.6.5.2\r
+\r