auctex-diffs
[Top][All Lists]
Advanced

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

master d1d1bd81: Control the opening and closing braces during insertion


From: Arash Esbati
Subject: master d1d1bd81: Control the opening and closing braces during insertion
Date: Tue, 21 Jun 2022 07:29:54 -0400 (EDT)

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

    Control the opening and closing braces during insertion
    
    * latex.el (TeX-arg-completing-read)
    (TeX-arg-completing-read-multiple): Add parameters to set the
    values of `TeX-arg-opening-brace' and `TeX-arg-closing-brace'
    during the argument insertion.
    (TeX-read-completing-read, TeX-read-completing-read-multiple):
    Escape the single quotes in docstrings correctly.
---
 latex.el | 46 +++++++++++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 19 deletions(-)

diff --git a/latex.el b/latex.el
index 92ae9680..c32c8ed5 100644
--- a/latex.el
+++ b/latex.el
@@ -3264,7 +3264,7 @@ COLLECTION provides elements for completion and is passed 
to
   - A symbol returning a list
   - A function call
 
-PROMPT replaces the standard one where ' (cr): ' is appended to
+PROMPT replaces the standard one where \\=' (cr): \\=' is appended to
 it.  If you want the full control over the prompt, set COMPLETE
 to non-nil and then provide a full PROMPT.
 
@@ -3291,22 +3291,26 @@ INHERIT-INPUT-METHOD are passed to `completing-read', 
which see."
    predicate require-match initial-input hist def inherit-input-method))
 
 (defun TeX-arg-completing-read (optional collection &optional prompt complete
-                                         prefix predicate require-match
+                                         prefix leftbrace rightbrace
+                                         predicate require-match
                                          initial-input hist def
                                          inherit-input-method)
   "Read a string in the minibuffer, with completion and insert it.
 If OPTIONAL is non-nil, indicate it in the minibuffer and insert
-the result in brackets if not empty.
+the result in brackets if not empty.  The brackets used are
+controlled by the string values of LEFTBRACE and RIGHTBRACE.
 
 For PROMPT and COMPLETE, refer to `TeX-read-completing-read'.
 For PREFIX, see `TeX-argument-insert'.
 PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF and
 INHERIT-INPUT-METHOD are passed to `completing-read', which see."
-  (TeX-argument-insert
-   (TeX-read-completing-read optional collection prompt complete
-                             predicate require-match initial-input
-                             hist def inherit-input-method)
-   optional prefix))
+  (let ((TeX-arg-opening-brace (or leftbrace TeX-arg-opening-brace))
+        (TeX-arg-closing-brace (or rightbrace TeX-arg-closing-brace)))
+    (TeX-argument-insert
+     (TeX-read-completing-read optional collection prompt complete
+                               predicate require-match initial-input
+                               hist def inherit-input-method)
+     optional prefix)))
 
 (defun TeX-read-completing-read-multiple (optional table &optional prompt 
complete
                                                    predicate require-match
@@ -3321,7 +3325,7 @@ COLLECTION provides elements for completion and is passed 
to
   - A symbol returning a list
   - A function call
 
-PROMPT replaces the standard one where ' (crm): ' is appended to
+PROMPT replaces the standard one where \\=' (crm): \\=' is appended to
 it.  If you want the full control over the prompt, set COMPLETE
 to non-nil and then provide a full PROMPT.
 
@@ -3349,26 +3353,30 @@ INHERIT-INPUT-METHOD are passed to
    predicate require-match initial-input hist def inherit-input-method))
 
 (defun TeX-arg-completing-read-multiple (optional table &optional prompt 
complete
-                                                  prefix predicate 
require-match
+                                                  prefix leftbrace rightbrace
+                                                  predicate require-match
                                                   initial-input hist def
                                                   inherit-input-method)
   "Read multiple strings in the minibuffer, with completion and insert them.
 If OPTIONAL is non-nil, indicate it in the minibuffer and insert
-the result in brackets if not empty.
+the result in brackets if not empty.  The brackets used are
+controlled by the string values of LEFTBRACE and RIGHTBRACE.
 
 For PROMPT and COMPLETE, refer to `TeX-read-completing-read-multiple'.
 For PREFIX, see `TeX-argument-insert'.
 PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF and
 INHERIT-INPUT-METHOD are passed to
 `TeX-completing-read-multiple', which see."
-  (TeX-argument-insert
-   (mapconcat #'identity
-              (TeX-read-completing-read-multiple optional table prompt
-                                                 complete predicate
-                                                 require-match initial-input
-                                                 hist def inherit-input-method)
-              ",")
-   optional prefix))
+  (let ((TeX-arg-opening-brace (or leftbrace TeX-arg-opening-brace))
+        (TeX-arg-closing-brace (or rightbrace TeX-arg-closing-brace)))
+    (TeX-argument-insert
+     (mapconcat #'identity
+                (TeX-read-completing-read-multiple optional table prompt
+                                                   complete predicate
+                                                   require-match initial-input
+                                                   hist def 
inherit-input-method)
+                ",")
+     optional prefix)))
 
 (defun TeX-read-hook ()
   "Read a LaTeX hook and return it as a string."



reply via email to

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