auctex-diffs
[Top][All Lists]
Advanced

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

master 835e01dd 2/4: Extend the argument list of `TeX-arg-string'


From: Arash Esbati
Subject: master 835e01dd 2/4: Extend the argument list of `TeX-arg-string'
Date: Thu, 17 Nov 2022 06:04:24 -0500 (EST)

branch: master
commit 835e01ddb6d25984edc33e44df7ea102c64be8b3
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>

    Extend the argument list of `TeX-arg-string'
    
    * tex.el (TeX-arg-string): Extend the argument list which will be
    passed to `TeX-read-string' and change the brackets for insertion.
---
 tex.el | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/tex.el b/tex.el
index 5cb86af1..7fe8095a 100644
--- a/tex.el
+++ b/tex.el
@@ -3451,18 +3451,29 @@ TeX macro.  What is done depend on the type of the 
element:
                  (insert TeX-grcl)
                  (backward-char))))))))
 
-(defun TeX-arg-string (optional &optional prompt initial-input)
+(defun TeX-arg-string (optional &optional prompt initial-input
+                                history default-value
+                                leftbrace rightbrace)
   "Prompt for a string.
 
 If OPTIONAL is not nil then the PROMPT will start with ``(Optional) ''.
-INITIAL-INPUT is a string to insert before reading input."
-  (TeX-argument-insert
-   (if (and (not optional) (TeX-active-mark))
-       (let ((TeX-argument (buffer-substring (point) (mark))))
-         (delete-region (point) (mark))
-         TeX-argument)
-     (TeX-read-string (TeX-argument-prompt optional prompt "Text") 
initial-input))
-   optional))
+INITIAL-INPUT is a string to insert before reading input.
+
+HISTORY and DEFAULT-VALUE are ultimately passed to `read-string',
+which see.
+
+The brackets used are controlled by the string values of
+LEFTBRACE and RIGHTBRACE."
+  (let ((TeX-arg-opening-brace (or leftbrace TeX-arg-opening-brace))
+        (TeX-arg-closing-brace (or rightbrace TeX-arg-closing-brace)))
+    (TeX-argument-insert
+     (if (and (not optional) (TeX-active-mark))
+         (let ((TeX-argument (buffer-substring (point) (mark))))
+           (delete-region (point) (mark))
+           TeX-argument)
+       (TeX-read-string (TeX-argument-prompt optional prompt "Text")
+                        initial-input history default-value))
+     optional)))
 
 (defvar TeX-last-optional-rejected nil
   "Dynamically bound by `TeX-parse-arguments'.")



reply via email to

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