diff options
author | 2023-09-16 19:53:11 +0200 | |
---|---|---|
committer | 2023-09-16 19:53:11 +0200 | |
commit | afb801adf7e066418c01c3fdecebe045918952ff (patch) | |
tree | 00abf91167e70675bafbeeaebe5b78111dba5337 | |
parent | Simplify advice function in glep-mode (diff) | |
download | ebuild-mode-afb801adf7e066418c01c3fdecebe045918952ff.tar.gz ebuild-mode-afb801adf7e066418c01c3fdecebe045918952ff.tar.bz2 ebuild-mode-afb801adf7e066418c01c3fdecebe045918952ff.zip |
Revert to defadvice for sh-must-be-shell-mode
* ebuild-mode.el (sh-must-be-shell-mode): Test if the function is
defined at compile time. This should only be the case for Emacs
versions where defadvice is unobsolete.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ebuild-mode.el | 9 |
2 files changed, 8 insertions, 5 deletions
@@ -1,5 +1,9 @@ 2023-09-16 Ulrich Müller <ulm@gentoo.org> + * ebuild-mode.el (sh-must-be-shell-mode): Test if the function is + defined at compile time. This should only be the case for Emacs + versions where defadvice is unobsolete. + * glep-mode.el (rst-classify-adornment) (glep-mode-ignore-preamble): Use :before-while instead of :around as advice combinator. diff --git a/ebuild-mode.el b/ebuild-mode.el index d49c931..416758d 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -901,12 +901,11 @@ in a Gentoo profile." ["Insert package.mask tag line" ebuild-mode-insert-tag-line] ["Customize ebuild-mode" (customize-group 'ebuild)])) -(if (fboundp 'sh-must-be-shell-mode) +(if (eval-when-compile (fboundp 'sh-must-be-shell-mode)) ;; make TAB key work - (defun sh-must-be-shell-mode () - "Signal an error if not in Shell-script mode." - (unless (derived-mode-p 'sh-mode) - (error "This buffer is not in Shell-script mode")))) + (defadvice sh-must-be-shell-mode + (around ebuild-mode-sh-must-be-shell-mode activate) + (unless (derived-mode-p 'sh-mode) ad-do-it))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(ebuild\\|eclass\\)\\'" . ebuild-mode)) |