[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode
From: |
Arash Esbati |
Subject: |
bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode |
Date: |
Fri, 05 Jul 2024 09:33:54 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi Keita,
Ikumi Keita <ikumi@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@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
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Arash Esbati, 2024/07/01
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Ikumi Keita, 2024/07/01
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Arash Esbati, 2024/07/01
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Ikumi Keita, 2024/07/01
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Arash Esbati, 2024/07/02
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Ikumi Keita, 2024/07/03
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode,
Arash Esbati <=
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Ikumi Keita, 2024/07/05
- bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Ikumi Keita, 2024/07/10
bug#71363: 14.0.5; AUCTeX 14.05 and LaTeX Mode, Paul Nelson, 2024/07/01