[Top][All Lists]

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

Re: Extending `TeX-arg-key-val' and `TeX-arg-completing-read-multiple'

From: Arash Esbati
Subject: Re: Extending `TeX-arg-key-val' and `TeX-arg-completing-read-multiple'
Date: Wed, 16 Nov 2022 20:23:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Arash Esbati <> writes:

> What do you think about this:

Sorry, the change was not good enough, please consider this one:

--8<---------------cut here---------------start------------->8---
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 
                  (insert TeX-grcl)

-(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") 
-   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
+  (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'.")
--8<---------------cut here---------------end--------------->8---

Best, Arash

reply via email to

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