GNU bug report logs - #78006
Improving `TeX-electric-math' behavior

Previous Next

Package: auctex;

Reported by: Arash Esbati <arash <at> gnu.org>

Date: Wed, 23 Apr 2025 07:27:01 UTC

Severity: normal

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Keita Ikumi <ikumikeita <at> jcom.home.ne.jp>
To: Arash Esbati <arash <at> gnu.org>, Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 78006 <at> debbugs.gnu.org
Subject: bug#78006: Improving `TeX-electric-math' behavior
Date: Sat, 3 May 2025 22:13:00 +0900 (JST)
[Message part 1 (text/plain, inline)]
>
>
> ------ Original Message ------
>  土曜日, 2025/5/3  17:37, Arash Esbati<arash <at> gnu.org> によって書かれました:
>
> Hi Keita,
>
> Ikumi Keita <ikumi <at> ikumi.que.jp> writes:
>
>>  I think we should use `derived-mode-p' here instead of comparing
>>  `major-mode' directly.
>
> Thanks for your response.  Something like this?
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/tex.el b/tex.el
> index 3d28b2c6..0d47988c 100644
> --- a/tex.el
> +++ b/tex.el
> @@ -6188,10 +6188,13 @@ See `TeX-electric-math'."
> 
>               (re-search-forward "\\=\\$\\$\\([^z-a]*\\)\\$\\$" (mark) t)))
>      (replace-match "\\1" t)
>      (set-mark (match-beginning 0)))
> -   ;; $...$ to $$...$$
> +   ;; $...$ to $$...$$ or \[...\] dep. on mode:
>     ((and (eq last-command #'TeX-insert-dollar)
>           (re-search-forward "\\=\\$\\([^z-a]*\\)\\$" (mark) t))
> -    (replace-match "$$\\1$$" t)
> +    (replace-match (if (derived-mode-p '(LaTeX-mode docTeX-mode))
Well, since docTeX-mode is already derived from 
LaTeX-mode, we can just do
(derived-mode-p 'LaTeX-mode)
:-)
> +                       "\\\\[\\1\\\\]"
> +                     "$$\\1$$")
> +                   t)
>      (set-mark (match-beginning 0)))
>     ;; \(...\) to \[...\]
>     ((and (eq last-command #'TeX-insert-dollar)
> --8<---------------cut here---------------end--------------->8---
>
> Best, Arash
>
[Message part 2 (text/html, inline)]

This bug report was last modified 19 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.