------ Original Message ------
 土曜日, 2025/5/3  17:37, Arash Esbati<ar...@gnu.org> によって書かれました:

Hi Keita,

Ikumi Keita <ik...@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

_______________________________________________
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to