summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2023-08-24 19:31:07 +0200
committerUlrich Müller <ulm@gentoo.org>2023-08-24 19:31:07 +0200
commit5f4838cc7a8c431012cb5794c1a2fa1742e41fc9 (patch)
treeca61b3f4a70776674e4663a60b7800592d87797b
parentPort to new advice functions (diff)
downloadebuild-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--ChangeLog8
-rw-r--r--ebuild-mode.el14
2 files changed, 15 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 4b4ba8e..c154834 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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))