[PATCH] emacs: target notmuch-one.el[c] -- emacs client in one .el[c] file

Subject: [PATCH] emacs: target notmuch-one.el[c] -- emacs client in one .el[c] file

Date: Mon, 2 Sep 2013 22:37:16 +0300

To: notmuch@notmuchmail.org

Cc: tomi.ollila@iki.fi

From: Tomi Ollila


Added Makefile recipes to create notmuch emacs client in just one
.el[c] file.

This is an experimental feature and not built by default.

This is useful for example when one wants to build the latest
emacs client and then distribute the elisp file to many machines.

This is also useful for (initial) testing:

     make emacs/notmuch-one.elc
     emacs -q -l emacs/notmuch-one.elc -f notmuch

can be used to quickly experiment with new development.
---

I've used one-file notmuch.elc since Fri Nov 4 11:03:33 2011 +0200
when I created perl script to combine all .el files together
and had only minor problems (if any, cannot be sure).

I build notmuch.elc in one machine and then distribute it to 2
others.

Now with the .eldeps target Austin created the same can be done
by utilizing the dependency information it provied.

Now I build notmuch using something like the following sequence:

    ./configure --without-emacs
    make
    make install
    make emacs/notmuch-one.elc
    cp emacs/notmuch-one.elc ~/local/elisp-ext/notmuch.elc

... but most often I do last 2 of the above and then continue with:

    scp ~/local/elisp-ext/notmuch.elc host2:local/elisp-ext
    scp ~/local/elisp-ext/notmuch.elc host3:local/elisp-ext

 emacs/Makefile.local | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index a910aff..9e3d409 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -46,6 +46,20 @@ endif
 install: install-emacs
 endif
 
+# Unsupported hack to provide notmuch emacs client in one *.elc file.
+# It probably works -- or then it fails mysteriously. YMMV.
+# Enter `make emacs/notmuch-one.elc' in top level directory to build it.
+ifeq ($(HAVE_EMACS),1)
+$(dir)/notmuch-one.el: $(emacs_sources)
+	rm -f $(emacs_bytecode) # XXX
+	make -n all WITH_EMACS=1 | sed -n '/printf.*EMACS/ s/.* //p' | \
+		xargs grep -vh '(declare-function.*"notmuch' > '$@' || :
+	{ echo ';; Local Variables:'; \
+	  echo ';; byte-compile-warnings: (not cl-functions)'; \
+	  echo ';; End:'; } >> '$@'
+endif
+CLEAN+=$(dir)/notmuch-one.el $(dir)/notmuch-one.elc
+
 .PHONY: install-emacs
 install-emacs:
 	mkdir -p "$(DESTDIR)$(emacslispdir)"
-- 
1.8.0


Thread: