From 5f4838cc7a8c431012cb5794c1a2fa1742e41fc9 Mon Sep 17 00:00:00 2001 From: Ulrich Müller Date: Thu, 24 Aug 2023 19:31:07 +0200 Subject: Update sh-must-be-shell-mode fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- ChangeLog | 8 ++++++++ ebuild-mode.el | 14 +++++++------- 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 + * 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)) -- cgit v1.2.3-65-gdbad