diff options
author | 2023-08-24 19:31:07 +0200 | |
---|---|---|
committer | 2023-08-24 19:31:07 +0200 | |
commit | 5f4838cc7a8c431012cb5794c1a2fa1742e41fc9 (patch) | |
tree | ca61b3f4a70776674e4663a60b7800592d87797b | |
parent | Port to new advice functions (diff) | |
download | ebuild-mode-5f4838cc7a8c431012cb5794c1a2fa1742e41fc9.tar.gz ebuild-mode-5f4838cc7a8c431012cb5794c1a2fa1742e41fc9.tar.bz2 ebuild-mode-5f4838cc7a8c431012cb5794c1a2fa1742e41fc9.zip |
Update sh-must-be-shell-mode fix
* ebuild-mode.el (ebuild-mode): Refer to sh-mode directly,
instead of shell-script-mode which is its alias.
(sh-must-be-shell-mode): Test for its existence, rather than
testing emacs-major-version. Simply redefine the function,
in order to avoid obsolete defadvice and non-portable advice-add.
This fixes a byte-compile warning in Emacs 30 while keeping
compatibility with XEmacs.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ebuild-mode.el | 14 |
2 files changed, 15 insertions, 7 deletions
@@ -1,5 +1,13 @@ 2023-08-24 Ulrich Müller <ulm@gentoo.org> + * ebuild-mode.el (ebuild-mode): Refer to sh-mode directly, + instead of shell-script-mode which is its alias. + (sh-must-be-shell-mode): Test for its existence, rather than + testing emacs-major-version. Simply redefine the function, + in order to avoid obsolete defadvice and non-portable advice-add. + This fixes a byte-compile warning in Emacs 30 while keeping + compatibility with XEmacs. + * glep-mode.el (rst-classify-adornment, glep-ignore-preamble): Port from defadvice to advice-add. diff --git a/ebuild-mode.el b/ebuild-mode.el index 3d20ed8..3724ebc 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -401,7 +401,7 @@ Compatibility function for XEmacs." (delete-region (match-beginning 0) (1+ (point))))))) ;;;###autoload -(define-derived-mode ebuild-mode shell-script-mode "Ebuild" +(define-derived-mode ebuild-mode sh-mode "Ebuild" "Major mode for Gentoo .ebuild and .eclass files." ;; Always enable ebuild-repo-mode, even if the ebuild is edited ;; outside an ebuild repository @@ -892,12 +892,12 @@ in a Gentoo profile." ["Insert package.mask tag line" ebuild-mode-insert-tag-line] ["Customize ebuild-mode" (customize-group 'ebuild)])) -(and (< emacs-major-version 22) - ;; make TAB key work - (defadvice sh-must-be-shell-mode - (around ebuild-mode-sh-must-be-shell-mode activate) - (or (eq major-mode 'ebuild-mode) - ad-do-it))) +(if (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")))) ;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(ebuild\\|eclass\\)\\'" . ebuild-mode)) |