Hi Arash, >>>>> Arash Esbati <ar...@gnu.org> writes: >> I'd say that people who have such strange preference should be >> prepared for their difficulty and be able to deal with it by >> themselves.
> I don't use this feature, so I don't want to be against it too much, so > if you think it is a good addition, please go ahead and install it. I > know where to forward the complaints once they arrive ;-) 😜 I'd like to take this opportunity to take `major-mode-remap-defaults', which will be introduced in Emacs 30, into account as well so that AUCTeX wouldn't alter the user customize option `major-mode-remap-alist'. Thus I propose the attached patch. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW
>From 78a32e5605a75f2cdbe0e0e3355aad158801b527 Mon Sep 17 00:00:00 2001 From: Ikumi Keita <ik...@ikumi.que.jp> Date: Tue, 12 Mar 2024 14:55:11 +0900 Subject: [PATCH] Keep compatibility with Org mode src editing (bug#71363) * tex-site.el.in (TeX-modes-set): Add entries for AUCTeX LaTeX mode to `org-src-lang-modes'. Use `major-mode-remap-defaults' for Emacs 30 and later, instead of `major-mode-remap-alist', in order to avoid altering user customize option. --- tex-site.el.in | 58 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 17 deletions(-) diff --git a/tex-site.el.in b/tex-site.el.in index 911a2080..62e6583b 100644 --- a/tex-site.el.in +++ b/tex-site.el.in @@ -113,29 +113,53 @@ Arrange the redirection of the built-in TeX modes according to VALUE. - The built-in modes in VALUE are redirected to the corresponding AUCTeX major modes. - The built-in modes not in VALUE discard redirection, if any. -If `major-mode-remap-alist' is available, use it for redirection. -Otherwise, use advice facility." +If either `major-mode-remap-defaults' or `major-mode-remap-alist' +is available, use it for redirection. Otherwise, use advice +facility." (custom-set-default var value) (let (elt dst) (dolist (entry TeX-mode-alist) (setq elt (car entry) dst (cdr entry)) (if (memq elt value) - (if (boundp 'major-mode-remap-alist) - (or (eq (cdr-safe (assq elt major-mode-remap-alist)) dst) - (push (cons elt dst) major-mode-remap-alist)) - ;; COMPATIBILITY for Emacs<29 - (advice-add elt :override dst - ;; COMPATIBILITY for Emacs 28.[12] - ;; Give it higher precedence than the :around - ;; advice given to `tex-mode' in tex-mode.el. - ;; <URL:https://lists.gnu.org/r/auctex-devel/2022-09/msg00050.html> - '((depth . -10)))) - (if (boundp 'major-mode-remap-alist) - (setq major-mode-remap-alist - (delete entry major-mode-remap-alist)) - ;; COMPATIBILITY for Emacs<29 - (advice-remove elt dst)))))) + (progn + (cond ((boundp 'major-mode-remap-defaults) + ;; For Emacs 30 and later + (add-to-list 'major-mode-remap-defaults (cons elt dst))) + ((boundp 'major-mode-remap-alist) + ;; COMPATIBILITY for Emacs 29 + (add-to-list 'major-mode-remap-alist (cons elt dst))) + (t + ;; COMPATIBILITY for Emacs<29 + (advice-add elt :override dst + ;; COMPATIBILITY for Emacs 28 + ;; Give it higher precedence than the :around + ;; advice given to `tex-mode' in tex-mode.el. + ;; <URL:https://lists.gnu.org/r/auctex-devel/2022-09/msg00050.html> + '((depth . -10))))) + ;; Keep compatibility. (bug#71363) + (if (eq elt 'latex-mode) + (with-eval-after-load 'org-src + (progn + (defvar org-src-lang-modes) ; Silence byte compiler. + ;; Check the actual presence in the entry in case + ;; that the user once choosed AUCTeX LaTeX mode and + ;; abandoned it afterwards in the same emacs + ;; session. + (when (memq 'latex-mode TeX-modes) + (push '("latex" . LaTeX) org-src-lang-modes) + (push '("beamer" . LaTeX) org-src-lang-modes)))))) + (cond ((boundp 'major-mode-remap-defaults) + ;; For Emacs 30 and later + (setq major-mode-remap-defaults + (delete entry major-mode-remap-defaults))) + ((boundp 'major-mode-remap-alist) + ;; COMPATIBILITY for Emacs 29 + (setq major-mode-remap-alist + (delete entry major-mode-remap-alist))) + (t + ;; COMPATIBILITY for Emacs<29 + (advice-remove elt dst))))))) (defcustom TeX-modes (mapcar #'car TeX-mode-alist) -- 2.44.0
_______________________________________________ bug-auctex mailing list bug-auctex@gnu.org https://lists.gnu.org/mailman/listinfo/bug-auctex