[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 686a8ed 13/80: Elaborate LaTeX math insertion co
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 686a8ed 13/80: Elaborate LaTeX math insertion command |
Date: |
Wed, 16 Oct 2019 11:07:07 -0400 (EDT) |
branch: externals/auctex
commit 686a8ed3b0cf091bb24d3db826a3f8ad1047f6c0
Author: Ikumi Keita <address@hidden>
Commit: Ikumi Keita <address@hidden>
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.
---
latex.el | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
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.
- [elpa] externals/auctex updated (0c8d670 -> c5e47f8), Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 5b97c38 01/80: Add dependencies file auctex-pkg.el, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex c8177fd 05/80: * style/listings.el: Require tex.el., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex c531148 04/80: ; Improve previous change in auctex.el.in, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 3543e45 06/80: New styles for beamerarticle & beamerswitch triggering beamer, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 78c0f09 07/80: Fix fontification of simple macros, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 083964b 02/80: Delete auctex-pkg.el which is not needed for ELPA releases, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex b82ab0c 08/80: Support up to 12 command arguments., Tassilo Horn, 2019/10/16
- [elpa] externals/auctex cd39966 14/80: ; Fix typos, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 686a8ed 13/80: Elaborate LaTeX math insertion command,
Tassilo Horn <=
- [elpa] externals/auctex 8a36595 12/80: Fix handling of function entries in `TeX-complete-list', Tassilo Horn, 2019/10/16
- [elpa] externals/auctex fcaef6b 11/80: Improve fontification of \href macro, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 23b3405 23/80: ; Fix typos, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 3b3c224 26/80: Remove compatibility code for xemacs, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 2a642a4 19/80: Add support for ChangeLog entries for LaTeX files, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex a8bbd1f 31/80: ; Fix document, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex ab57cb0 21/80: Add new function `LaTeX-extract-key-value-label', Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 4776fd0 25/80: ; Remove compatibility code for older emacsen, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex 92c090d 30/80: Fix treatment of class and package options, Tassilo Horn, 2019/10/16
- [elpa] externals/auctex a30db7c 24/80: Allow the user to customize which TeX commands are available in each mode., Tassilo Horn, 2019/10/16