auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 686a8ed3b0cf091bb24d3


From: Ikumi Keita
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 686a8ed3b0cf091bb24d3db826a3f8ad1047f6c0
Date: Sat, 6 Apr 2019 07:39:20 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  686a8ed3b0cf091bb24d3db826a3f8ad1047f6c0 (commit)
      from  8a36595fb116cd3c6e3f429c9be2101b211c49af (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 686a8ed3b0cf091bb24d3db826a3f8ad1047f6c0
Author: Ikumi Keita <address@hidden>
Date:   Fri Apr 5 02:01:09 2019 +0900

    Elaborate LaTeX math insertion command
    
    * latex.el (LaTeX-math-insert): Put the point after the closing dollar
    sign when appropriate.  This fixes bug#35128.
    In addtion, wrap the text in the active region suitably.

diff --git a/latex.el b/latex.el
index d260006..510d4bf 100644
--- a/latex.el
+++ b/latex.el
@@ -5362,11 +5362,31 @@ commands are defined:
   "Insert \\STRING{}.  If DOLLAR is non-nil, put $'s around it.
 If `TeX-electric-math' is non-nil wrap that symbols around the
 string."
-  (when dollar
-    (insert (or (car TeX-electric-math) "$"))
-    (save-excursion
-      (insert (or (cdr TeX-electric-math) "$"))))
-  (funcall LaTeX-math-insert-function string))
+  (let ((active (TeX-active-mark))
+       m closer)
+    (if (and active (> (point) (mark)))
+       (exchange-point-and-mark))
+    (when dollar
+      (insert (or (car TeX-electric-math) "$"))
+      (save-excursion
+       (if active (goto-char (mark)))
+       ;; Store closer string for later reference.
+       (setq closer (or (cdr TeX-electric-math) "$"))
+       (insert closer)
+       ;; Set temporal marker to decide whether to put the point
+       ;; after the math mode closer or not.
+       (setq m (point-marker))))
+    (funcall LaTeX-math-insert-function string)
+    (when dollar
+      ;; If the above `LaTeX-math-insert-function' resulted in
+      ;; inserting, e.g., a pair of "\langle" and "\rangle" by
+      ;; typing "`(", keep the point between them.  Otherwise
+      ;; move the point after the math mode closer.
+      (if (= m (+ (point) (length closer)))
+         (goto-char m))
+      ;; Make temporal marker point nowhere not to slow down the
+      ;; subsequent editing in the buffer.
+      (set-marker m nil))))
 
 (defun LaTeX-math-cal (char dollar)
   "Insert a {\\cal CHAR}.  If DOLLAR is non-nil, put $'s around it.

-----------------------------------------------------------------------

Summary of changes:
 latex.el | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

[Prev in Thread] Current Thread [Next in Thread]