From a55986ab1887214c316d2d8ffebe38ae0b30483f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 10 May 2016 13:03:36 -0400 Subject: Makefile: Avoid a bug in Emacs 24 sh-script.el indent It screws up indent in an `if` block (but not the `then` block). --- INSTALL | 7 +++++-- common.once.head.mk | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index ee64eae..56e7103 100644 --- a/INSTALL +++ b/INSTALL @@ -24,8 +24,11 @@ to cause issues. The "unusual" build-time dependencies are: - GNU Make -- other `make`s will not work. - - GNU sed -- must support `-r` for ERE; BSD sed uses `-E` for this purpose. - - Emacs -- `emacs --batch` is used to use Emacs Lisp to process some text. + - GNU sed -- must support `-r` for ERE; BSD sed uses `-E` for this + purpose. + - Emacs 24.4+ -- `emacs --batch` is used to use Emacs Lisp to process + some text. GNU Emacs 24.4 introduced a new `advice-add` system + which we depend on. - ronn -- A markdown-to-manpage converter At this time, the build system does not support not building the diff --git a/common.once.head.mk b/common.once.head.mk index d7faab8..33084fa 100644 --- a/common.once.head.mk +++ b/common.once.head.mk @@ -42,6 +42,8 @@ edit = sed \ indent = emacs --batch $1 \ --eval '(setq make-backup-files nil)' \ --eval '(setq sh-basic-offset 8)' \ + --eval '(defun sh-smie-sh-rules--fix (args) "fix bug in Emacs 24 sh-script.el" (if (equal args (list :after "then")) (list :after "if") args))' \ + --eval "(advice-add 'sh-smie-sh-rules :filter-args \#'sh-smie-sh-rules--fix)" \ --eval '(indent-region (point-min) (point-max) nil)' \ -f save-buffer &>/dev/null -- cgit v1.2.3