diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-05-17 08:23:34 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-05-17 08:23:34 -0700 |
commit | d940ff3b7b5362b90b20914556e6ca2aa53cbd2a (patch) | |
tree | dbf85fd27878702263272ab38a16c5d0287351a4 | |
parent | 6c55707282f63db8989ae57e0b72d1b851dea704 (diff) | |
download | dotfiles-d940ff3b7b5362b90b20914556e6ca2aa53cbd2a.tar.gz |
start bytecompiling .emacs.d again, more robustly
-rw-r--r-- | .emacs.d/Makefile | 15 | ||||
-rw-r--r-- | .emacs.d/init.el | 24 | ||||
-rw-r--r-- | .mrconfig.in | 1 | ||||
-rwxr-xr-x | archive/bin/bytecompile-emacsd | 32 | ||||
-rwxr-xr-x | bin/bytecompile-emacs-d | 22 |
5 files changed, 62 insertions, 32 deletions
diff --git a/.emacs.d/Makefile b/.emacs.d/Makefile new file mode 100644 index 00000000..dfa269d5 --- /dev/null +++ b/.emacs.d/Makefile @@ -0,0 +1,15 @@ +ELC=$(filter-out init.elc,$(patsubst %.el,%.elc,$(wildcard *.el */*.el))) + +.PHONY: all +all: $(ELC) + +# don't pass -q/-Q so that Debian-packaged Emacs Lisp is available to +# the bytecompiler, and let ~/.emacs.d/init-spw.el set the load path +# so that Debian-packaged versions take precedence over +# ~/.emacs.d/initlibs where possible +%.elc: %.el + emacs -batch -f batch-byte-compile $< + +.PHONY: clean +clean: + rm -f $(ELC) diff --git a/.emacs.d/init.el b/.emacs.d/init.el new file mode 100644 index 00000000..a76ce129 --- /dev/null +++ b/.emacs.d/init.el @@ -0,0 +1,24 @@ +;;; init.el --- bootstrap Sean's Emacs configuration -*- no-byte-compile: t -*- + +;;; Commentary: + +;; This file is not bytecompiled primarily because when it is loaded +;; `load-prefer-newer' has not yet been set. Most personal config +;; should go into one of the bytecompiled files inside ~/.emacs.d +;; rather than here. + +;;; Code: + +;; don't accept invalid SSL certs or small primes +(with-eval-after-load 'gnutls + (setq gnutls-verify-error t + gnutls-min-prime-bits 1024)) + +(with-eval-after-load 'nsm + (setq network-security-level 'paranoid)) + +(setq load-prefer-newer t) + +(load-file "init-spw.el") + +;;; init.el ends here diff --git a/.mrconfig.in b/.mrconfig.in index bc3fb800..10a2d39f 100644 --- a/.mrconfig.in +++ b/.mrconfig.in @@ -234,6 +234,7 @@ fixups = install-git-hooks dotfiles git config commit.gpgsign true git config user.signingkey 8DC2487E51ABDD90B5C4753F0F56D0553B6D411B + bytecompile-emacs-d 2>&1 >/dev/null ||: # clean-ups so that initial stow will be successful pre_stow = diff --git a/archive/bin/bytecompile-emacsd b/archive/bin/bytecompile-emacsd deleted file mode 100755 index 7e0e5b03..00000000 --- a/archive/bin/bytecompile-emacsd +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# Byte-compile lisp files in ~/.emacs.d - -# `batch-byte-compile' doesn't recurse, but the layout of my -# ~/.emacs.d means it doesn't need to -- see comments near top of -# ~/.emacs.d/init.el - -# Don't use -q or -Q so that my load-path gets set correctly by -# ~/.emacs.d/init.el, with Debian packages taking precedence - -# The big problem with this script is that there is no arrangement for -# recompilation when, e.g., the version of Emacs installed on the -# system changes - -set -e - -if which emacs >/dev/null 2>&1; then - if which chronic >/dev/null 2>&1; then - chronic emacs -L $HOME/.emacs.d/initlibs \ - --batch --eval "(batch-byte-compile t)" \ - $HOME/.emacs.d/*.el $HOME/.emacs.d/*/*.el - - # a byte-compiled init file is inconvenient because it gets - # loaded before `load-prefer-newer' is set - rm $HOME/.emacs.d/init.elc - else - echo >&2 "W: not byte-compiling ~/.emacs.d: chronic unavailable" - fi -else - echo >&2 "W: not byte-compiling ~/.emacs.d: Emacs unavailable" -fi diff --git a/bin/bytecompile-emacs-d b/bin/bytecompile-emacs-d new file mode 100755 index 00000000..43d84722 --- /dev/null +++ b/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 |