branch: externals/auctex
commit 615e12f6505bb73f096daedc2c97164b35780957
Author: Arash Esbati <ar...@gnu.org>
Commit: Arash Esbati <ar...@gnu.org>

    Simplify implementation of style/tcolorbox.el
    
    * style/tcolorbox.el ("tcolorbox"): Replace `TeX-arg-eval' and use
    a distinct function for the only argument.
---
 style/tcolorbox.el | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/style/tcolorbox.el b/style/tcolorbox.el
index 3f4b415f91..03ce96699a 100644
--- a/style/tcolorbox.el
+++ b/style/tcolorbox.el
@@ -586,17 +586,16 @@ for example \"tcolorboxlib-raster.el\"."
    (TeX-add-symbols
 
     ;; 1.3 Libraries
-    '("tcbuselibrary"
-      (TeX-arg-eval
-       (lambda ()
-         (let ((libs (mapconcat #'identity
-                                (TeX-completing-read-multiple
-                                 (TeX-argument-prompt nil nil "Libraries")
-                                 LaTeX-tcolorbox-library-list)
-                                ",")))
-           (LaTeX-add-tcolorbox-tcbuselibraries libs)
-           (LaTeX-tcolorbox-load-used-libraries)
-           (format "%s" libs)))))
+    `("tcbuselibrary"
+      (TeX-arg-completing-read-multiple LaTeX-tcolorbox-library-list
+                                        "Libraries")
+      ,(lambda (_)
+         (when (= (preceding-char) (string-to-char TeX-grcl))
+           (save-excursion
+             (re-search-backward "\\\\tcbuselibrary{\\([^}]+\\)}"
+                                 (line-beginning-position) t)
+             (LaTeX-add-tcolorbox-tcbuselibraries (match-string-no-properties 
1))
+             (LaTeX-tcolorbox-load-used-libraries)))))
 
     ;; 3 Macros for Box Creation
     '("tcblower" 0)


Reply via email to