[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 3d8d93e4fd 41/48: ; Make code more resilient
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 3d8d93e4fd 41/48: ; Make code more resilient |
Date: |
Fri, 18 Nov 2022 14:27:45 -0500 (EST) |
branch: externals/auctex
commit 3d8d93e4fd1ee55a23859656c553385ca493ace0
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
; Make code more resilient
* style/enumitem.el (LaTeX-arg-enumitem-SetEnumitemValue): Check
if the first argument was really inserted before searching back.
("enumitem"): Remove unnecessary `and'.
---
style/enumitem.el | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/style/enumitem.el b/style/enumitem.el
index e08f7c89ef..f8e8737beb 100644
--- a/style/enumitem.el
+++ b/style/enumitem.el
@@ -274,15 +274,17 @@ Insert key and value in brackets if OPTIONAL is non-nil."
"Ask and insert for a new value added to an existing key.
This is the second mandatory argument of \\SetEnumitemValue
macro. Insert the value in brackets if OPTIONAL is non-nil."
- (let ((key (save-excursion
- (and (re-search-backward "\\\\SetEnumitemValue{\\([^}]+\\)}"
- (line-beginning-position) t)
- (match-string-no-properties 1))))
+ (let ((key (when (= (preceding-char) (string-to-char TeX-grcl))
+ (save-excursion
+ (re-search-backward "\\\\SetEnumitemValue{\\([^}]+\\)}"
+ (line-beginning-position) t)
+ (match-string-no-properties 1))))
(val (TeX-read-string
(TeX-argument-prompt optional nil "String value"))))
- (LaTeX-add-enumitem-SetEnumitemValues
- (list (concat "\\SetEnumitemValue{" key "}{" val "}")
- key val))
+ (when key
+ (LaTeX-add-enumitem-SetEnumitemValues
+ (list (concat "\\SetEnumitemValue{" key "}{" val "}")
+ key val)))
(TeX-argument-insert val optional)))
(TeX-add-style-hook
@@ -447,10 +449,10 @@ macro. Insert the value in brackets if OPTIONAL is
non-nil."
(TeX-arg-completing-read
,(lambda ()
(save-excursion
- (and (re-search-backward "\\\\SetEnumitemValue{\\([^}]+\\)}"
- (line-beginning-position) t)
- (cadr (assoc (match-string-no-properties 1)
- LaTeX-enumitem-key-val-options)))))
+ (re-search-backward "\\\\SetEnumitemValue{\\([^}]+\\)}"
+ (line-beginning-position) t)
+ (cadr (assoc (match-string-no-properties 1)
+ LaTeX-enumitem-key-val-options))))
"Replacement"))
;; v3.6 has a macro for visual debugging.
- [elpa] externals/auctex a617944b4b 08/48: Fix style/xspace.el, (continued)
- [elpa] externals/auctex a617944b4b 08/48: Fix style/xspace.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 5949388ca2 12/48: Simplify argument queries in style/wrapfig.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex e83a4b87b3 25/48: Use the correct function to retrieve the key=vals, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 35ec84ba6f 07/48: Add capf for LaTeX marco/environment arguments, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 835e01ddb6 36/48: Extend the argument list of `TeX-arg-string', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 615e12f650 42/48: Simplify implementation of style/tcolorbox.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 82a23a93ae 43/48: Add some variables containing font declarations, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 6cbeff713b 47/48: Simplify implementation of style/fancyhdr.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 0ee39626e4 01/48: Use `TeX-arg-completing-read', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 49987f08dd 19/48: Provide completion candidates for `TeX-arg-length', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 3d8d93e4fd 41/48: ; Make code more resilient,
Tassilo Horn <=