[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 748449959c 21/48: New option `TeX-refuse-unmatch
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 748449959c 21/48: New option `TeX-refuse-unmatched-dollar' |
Date: |
Fri, 18 Nov 2022 14:27:43 -0500 (EST) |
branch: externals/auctex
commit 748449959c74220b40aff5bd69676bc0722ec8a9
Author: Ikumi Keita <ikumi@ikumi.que.jp>
Commit: Ikumi Keita <ikumi@ikumi.que.jp>
New option `TeX-refuse-unmatched-dollar'
* tex.el (TeX-refuse-unmatched-dollar): New option.
(TeX-insert-dollar): When the new option is enabled, retain the former
behavior.
Arrange the doc string.
* doc/auctex.texi (Quotes):
* doc/changes.texi:
Mention the change in the behavior of `TeX-insert-dollar'.
---
doc/auctex.texi | 14 ++++++++++++++
doc/changes.texi | 9 +++++++++
tex.el | 26 +++++++++++++++++++++++---
3 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 5f8c725714..682e4ed86c 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -468,6 +468,20 @@ following to your init file
(cons "\\(" "\\)"))))
@end lisp
+Math mode which didn't start with dollar(s) shouldn't be closed with dollar.
+@defopt TeX-refuse-unmatched-dollar
+This option determines the behavior when the user types @kbd{$} at a
+position where @AUCTeX{} thinks that it is in math mode which didn't start
+with dollar(s).
+
+When this option is @code{nil}, @AUCTeX{} behaves in the same way as
+non-math mode, assuming that the user knows it isn't in math mode
+actually. This is the default.
+
+When this option is non-@code{nil}, @AUCTeX{} refuses to insert @samp{$}
+to prevent unmatched dollar.
+@end defopt
+
Note that Texinfo mode does nothing special for @kbd{$}. It inserts
dollar sign(s) just in the same way as the other normal keys do.
diff --git a/doc/changes.texi b/doc/changes.texi
index 67e9e458d4..d6973153c1 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -11,6 +11,15 @@
@heading News since last release
@itemize @bullet
+@item
+@AUCTeX{} no longer refuses to insert dollar sign when you type @kbd{$} at
+point where @AUCTeX{} thinks the current math mode didn't start with
+dollar(s). @AUCTeX{} assumes the user knows that it isn't in math mode
+actually.
+
+You can keep the former behavior by enabling the new customize option
+@code{TeX-refuse-unmatched-dollar}.
+
@item
@AUCTeX{} supports completion-at-point of macro and environment arguments
in @LaTeX{} buffers. The responsible function recognizes the argument
diff --git a/tex.el b/tex.el
index 9a57d45895..976fafbaf9 100644
--- a/tex.el
+++ b/tex.el
@@ -5939,9 +5939,24 @@ point. You can choose between \"$...$\" and
\"\\(...\\)\"."
(string :tag "Insert before point")
(string :tag "Insert after point"))))
+(defcustom TeX-refuse-unmatched-dollar nil
+ "When non-nil, don't insert unmatched dollar sign.
+That is, `TeX-insert-dollar' refuses to insert \"$\" when
+`texmathp' tells that the current position is in math mode which
+didn't start with dollar(s).
+
+When nil, `TeX-insert-dollar' assumes the user knows that the
+current position is not in math mode actually and behaves in the
+same way as non-math mode."
+ :group 'TeX-macro
+ :type 'boolean)
+
(defun TeX-insert-dollar (&optional arg)
"Insert dollar sign.
+If current math mode was not entered with a dollar, refuse to
+insert one when `TeX-refuse-unmatched-dollar' is non-nil.
+
Show matching dollar sign if this dollar sign ends the TeX math
mode and `blink-matching-paren' is non-nil.
@@ -5994,10 +6009,15 @@ With optional ARG, insert that many dollar signs."
(message "Matches %s"
(buffer-substring
(point) (progn (end-of-line) (point))))))))
+
+ ;; Math mode was not entered with dollar according to `texmathp'.
+ (TeX-refuse-unmatched-dollar
+ ;; We trust `texmathp' and refuse to finish it with one.
+ (message "Math mode started with `%s' cannot be closed with dollar"
+ (car texmathp-why)))
(t
- ;; Math mode was not entered with dollar - we assume that
- ;; `texmathp' was wrong and behave as if not in math
- ;; mode. (bug#57626)
+ ;; We assume that `texmathp' was wrong and behave as if not in
+ ;; math mode. (bug#57626)
(TeX--insert-dollar-1))))
(t
;; Just somewhere in the text.
- [elpa] externals/auctex updated (c569c7d486 -> 93430d7ab0), Tassilo Horn, 2022/11/18
- [elpa] externals/auctex cb7b44227d 31/48: Improve fontification of indexing macros, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex c525dd42dd 35/48: Simplify implementation of style/tcolorboxlib-raster.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 748449959c 21/48: New option `TeX-refuse-unmatched-dollar',
Tassilo Horn <=
- [elpa] externals/auctex 487c91fddb 04/48: ; Pacify compiler warning: Unused lexical argument `ignored', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex ce15e3fd87 24/48: Extend Japanese TeX support, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 52a7f4050f 27/48: ; * doc/auctex.texi (Adding Environments): Adjust indentation., Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 42150568f1 06/48: Allow user to insert "$" (bug#57626), Tassilo Horn, 2022/11/18
- [elpa] externals/auctex cdf57fba58 11/48: * latex.el (TeX-arg-conditional): Declare 'indent'., Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 4eaed332ba 26/48: Add new hooks for inserting environments with arguments, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex d7e6fa0d41 05/48: Cleanup `TeX-insert-dollar', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 21e624026a 28/48: Improve support for TikZ, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex e53bb19a90 37/48: ; Recognize large arguments with many lines, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 9b365b7419 18/48: Simplify implementation of style/textpos.el, Tassilo Horn, 2022/11/18