auctex-devel
[Top][All Lists]
Advanced

[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 12:27:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> It looks reasonable.

Thanks for your response.  I installed that change (a7a7209a08).

> In addition, I'd propose to add similar optional arguments to
> `TeX-arg-string' to pass to `TeX-read-string' as well. It would allow
> us to eliminate awkward usage of `TeX-arg-eval' for \frametitle
> support in beamer.el.

What do you think about this:

--8<---------------cut here---------------start------------->8---
diff --git a/tex.el b/tex.el
index 5cb86af1..246b25cd 100644
--- a/tex.el
+++ b/tex.el
@@ -3451,18 +3451,28 @@ 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))
+     optional)))

 (defvar TeX-last-optional-rejected nil
   "Dynamically bound by `TeX-parse-arguments'.")
--8<---------------cut here---------------end--------------->8---

> (Actually, beamer.el is my next target ;-) )

That sounds like fun ;-)  I'd like to see how the current changes will
help you updating that style, I'm thinking about the arguments in <..>.

Best, Arash



reply via email to

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