diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-07-21 14:58:22 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-07-21 16:06:20 -0700 |
commit | ea323b9be0e5490684f7681eed64340cda1ee2f9 (patch) | |
tree | 093f9fc4600dbb59c63ff2efcc21225f23773fe0 /archive | |
parent | b330ab646aed48ebc0913d23aeb40742907065e0 (diff) | |
download | dotfiles-ea323b9be0e5490684f7681eed64340cda1ee2f9.tar.gz |
archive ~/.emacs.d bytecompilation
I am now often running a development build of Emacs, in which case
bytecompile-emacs-d's method of determining whether a rebuild is required is
too simple to ensure we rebuild often enough.
Diffstat (limited to 'archive')
-rw-r--r-- | archive/.emacs.d/Makefile | 27 | ||||
-rwxr-xr-x | archive/bin/bytecompile-emacs-d | 22 |
2 files changed, 49 insertions, 0 deletions
diff --git a/archive/.emacs.d/Makefile b/archive/.emacs.d/Makefile new file mode 100644 index 00000000..f8401614 --- /dev/null +++ b/archive/.emacs.d/Makefile @@ -0,0 +1,27 @@ +ELC := $(filter-out init.elc,$(patsubst %.el,%.elc,$(wildcard *.el */*.el))) + +EMACSOPT := --eval '(add-to-list (quote load-path) (concat user-emacs-directory "site-lisp"))' +EMACSOPT += --eval '(add-to-list (quote load-path) (concat user-emacs-directory "initlibs") t)' +EMACSOPT += -l package -f package-initialize + +.PHONY: all +all: $(ELC) + +# permit the use and setting of undeclared variables and functions: this is +# appropriate for user init files, I think, though not for arbitrary .el libs +# under ~/.emacs.d +init-%.elc: init-%.el + emacs -batch $(EMACSOPT) \ + --eval '(setq byte-compile-warnings (quote (not free-vars unresolved)))' \ + -f batch-byte-compile $< +notmuch-groups.elc: notmuch-groups.el + emacs -batch $(EMACSOPT) \ + --eval '(setq byte-compile-warnings (quote (not free-vars)))' \ + -f batch-byte-compile $< + +%.elc: %.el + emacs -batch $(EMACSOPT) -f batch-byte-compile $< + +.PHONY: clean +clean: + rm -f $(ELC) diff --git a/archive/bin/bytecompile-emacs-d b/archive/bin/bytecompile-emacs-d new file mode 100755 index 00000000..43d84722 --- /dev/null +++ b/archive/bin/bytecompile-emacs-d @@ -0,0 +1,22 @@ +#!/bin/sh + +which emacs >/dev/null || exit + +cd "$HOME/.emacs.d" + +if [ -f bytecompiled-against ]; then + last=$(cat bytecompiled-against) +fi +now=$(emacs --version) +echo "$now" >bytecompiled-against + +# Ensure that everything gets recompiled if version of Emacs has +# changed, as definitions of macros may have changed. If +# ~/.emacs.d/*.el start using macros from third party packages, should +# extend this logic to recompile when installations of those change, +# as Debian's emacsen-common infrastructure does +if [ "$last" = "$now" ]; then + make +else + make -B +fi |