GNU bug report logs -
#71363
14.0.5; AUCTeX 14.05 and LaTeX Mode
Previous Next
Reported by: Robert Morelli <morelli <at> flux.utah.edu>
Date: Tue, 4 Jun 2024 14:27:02 UTC
Severity: normal
Found in version 14.0.5
Done: Ikumi Keita <ikumi <at> ikumi.que.jp>
Bug is archived. No further changes may be made.
Full log
Message #53 received at 71363 <at> debbugs.gnu.org (full text, mbox):
Hi Keita,
Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
> 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.
Thanks, catering for `major-mode-remap-defaults' is probably a good
idea. I have some minor comments below.
> From 78a32e5605a75f2cdbe0e0e3355aad158801b527 Mon Sep 17 00:00:00 2001
> From: Ikumi Keita <ikumi <at> 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
, in that order
> . 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
Do you need this extra `progn' inside `with-eval-after-load'?
> + (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)
Best, Arash
This bug report was last modified 316 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.