[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex a7a7209a08 33/48: Extend the argument list of so
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex a7a7209a08 33/48: Extend the argument list of some functions |
Date: |
Fri, 18 Nov 2022 14:27:44 -0500 (EST) |
branch: externals/auctex
commit a7a7209a086d8db0ba9a7a3f129533d98b037019
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Extend the argument list of some functions
* latex.el (TeX-read-key-val, TeX-arg-key-val): Extend the
argument list which control the query and insertion of key=val's
in the style hooks.
(TeX-arg-completing-read-multiple): Extend argument list to alter
the value of `crm-separator' and the separator inside `mapconcat'.
---
latex.el | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 75 insertions(+), 14 deletions(-)
diff --git a/latex.el b/latex.el
index 9bb5e005c5..d139192d4d 100644
--- a/latex.el
+++ b/latex.el
@@ -3244,7 +3244,10 @@ prompt string. `LaTeX-default-author' is the initial
input."
"")))
(TeX-argument-insert author optional nil)))
-(defun TeX-read-key-val (optional key-val-alist &optional prompt)
+(defun TeX-read-key-val (optional key-val-alist &optional prompt complete
+ predicate require-match
+ initial-input hist def
+ inherit-input-method)
"Prompt for keys and values in KEY-VAL-ALIST and return them.
If OPTIONAL is non-nil, indicate in the prompt that we are
reading an optional argument. KEY-VAL-ALIST can be
@@ -3255,9 +3258,24 @@ reading an optional argument. KEY-VAL-ALIST can be
The car of each element should be a string representing a key and
the optional cdr should be a list with strings to be used as
-values for the key. Use PROMPT as the prompt string."
+values for the key.
+
+PROMPT replaces the standard one where \\=' (k=v): \\=' is
+appended to it. If you want the full control over the prompt,
+set COMPLETE to non-nil and then provide a full PROMPT.
+
+PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF,
+INHERIT-INPUT-METHOD are passed to `multi-prompt-key-value',
+which see."
(multi-prompt-key-value
- (TeX-argument-prompt optional prompt "Options (k=v)")
+ (TeX-argument-prompt optional
+ (cond ((and prompt (not complete))
+ (concat prompt " (k=v)"))
+ ((and prompt complete)
+ prompt)
+ (t nil))
+ "Options (k=v)"
+ complete)
(cond ((and (listp key-val-alist)
(symbolp (car key-val-alist))
(fboundp (car key-val-alist)))
@@ -3271,18 +3289,51 @@ values for the key. Use PROMPT as the prompt string."
(listp (car key-val-alist)))
key-val-alist)
(t
- (error "Cannot interpret key-val-alist %S" key-val-alist)))))
+ (error "Cannot interpret key-val-alist %S" key-val-alist)))
+ predicate require-match initial-input hist def inherit-input-method))
-(defun TeX-arg-key-val (optional key-val-alist &optional prompt)
+(defun TeX-arg-key-val (optional key-val-alist &optional prompt complete
+ rem-char leftbrace rightbrace
+ predicate require-match
+ initial-input hist def
+ inherit-input-method)
"Prompt for keys and values in KEY-VAL-ALIST.
Insert the given value as a TeX macro argument. If OPTIONAL is
non-nil, insert it as an optional argument. KEY-VAL-ALIST is an
alist. The car of each element should be a string representing a
key and the optional cdr should be a list with strings to be used
as values for the key. Refer to `TeX-read-key-val' for more
-about KEY-VAL-ALIST. Use PROMPT as the prompt string."
- (let ((options (TeX-read-key-val optional key-val-alist prompt)))
- (TeX-argument-insert options optional)))
+about KEY-VAL-ALIST.
+
+PROMPT replaces the standard one where \\=' (k=v): \\=' is
+appended to it. If you want the full control over the prompt,
+set COMPLETE to non-nil and then provide a full PROMPT.
+
+REM-CHAR is a character removed from `crm-local-completion-map'
+and `minibuffer-local-completion-map' when performing completion.
+In most cases it will be ?\\s.
+
+The brackets used are controlled by the string values of
+LEFTBRACE and RIGHTBRACE.
+
+PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF,
+INHERIT-INPUT-METHOD are passed to `multi-prompt-key-value',
+which see."
+ (let ((TeX-arg-opening-brace (or leftbrace TeX-arg-opening-brace))
+ (TeX-arg-closing-brace (or rightbrace TeX-arg-closing-brace))
+ (crm-local-completion-map
+ (if rem-char (remove (assoc rem-char crm-local-completion-map)
+ crm-local-completion-map)
+ crm-local-completion-map))
+ (minibuffer-local-completion-map
+ (if rem-char (remove (assoc rem-char minibuffer-local-completion-map)
+ minibuffer-local-completion-map)
+ minibuffer-local-completion-map)))
+ (TeX-argument-insert
+ (TeX-read-key-val optional key-val-alist prompt complete
+ predicate require-match initial-input
+ hist def inherit-input-method)
+ optional)))
(defun TeX-read-completing-read (optional collection &optional prompt complete
predicate require-match
@@ -3390,29 +3441,39 @@ 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 leftbrace rightbrace
+ prefix crm-sep concat-sep
+ 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 brackets used are
-controlled by the string values of LEFTBRACE and RIGHTBRACE.
+the result in brackets if not empty.
+
+For TABLE, PROMPT and COMPLETE, see `TeX-read-completing-read-multiple'.
-For TABLE, PROMPT and COMPLETE, refer to `TeX-read-completing-read-multiple'.
For PREFIX, see `TeX-argument-insert'.
+CRM-SEP is a regexp which is bound locally to `crm-separator'.
+CONCAT-SEP is a string which will be used to concat the queried
+items, defaults to \",\".
+
+The brackets used to insert the argument are controlled by the
+string values of LEFTBRACE and RIGHTBRACE.
+
PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF and
INHERIT-INPUT-METHOD are passed to
`TeX-completing-read-multiple', which see."
(let ((TeX-arg-opening-brace (or leftbrace TeX-arg-opening-brace))
- (TeX-arg-closing-brace (or rightbrace TeX-arg-closing-brace)))
+ (TeX-arg-closing-brace (or rightbrace TeX-arg-closing-brace))
+ (crm-separator (or crm-sep crm-separator))
+ (concat-sep (or concat-sep ",")))
(TeX-argument-insert
(mapconcat #'identity
(TeX-read-completing-read-multiple optional table prompt
complete predicate
require-match initial-input
hist def
inherit-input-method)
- ",")
+ concat-sep)
optional prefix)))
(defun TeX-read-hook ()
- [elpa] externals/auctex 5949388ca2 12/48: Simplify argument queries in style/wrapfig.el, (continued)
- [elpa] externals/auctex 5949388ca2 12/48: Simplify argument queries in style/wrapfig.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 47f9ead1c6 44/48: Respect `TeX-exit-mark' when inserting enviroments, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex c6c7c3f024 22/48: ; Use #' to quote function, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex c0c9556338 30/48: Don't insert empty node name, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 978ebea1e8 16/48: Simplify implementation of style/thmtools.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex d3970b77da 09/48: ; * latex.el (LaTeX-common-initialization): Remove dupe textcircled., Tassilo Horn, 2022/11/18
- [elpa] externals/auctex a0ba387b2c 23/48: ; Trivial cleanups, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 04a3138c81 45/48: Simplify implementation of style/theorem.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 316550f0bf 29/48: Fix `ConTeXt-add-environments', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 8775c8355f 13/48: Replace `TeX-arg-url-urlstyle' in style/url.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex a7a7209a08 33/48: Extend the argument list of some functions,
Tassilo Horn <=
- [elpa] externals/auctex c8d638ac9d 40/48: Use `functionp' to recognize a function, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 835e01ddb6 36/48: Extend the argument list of `TeX-arg-string', Tassilo Horn, 2022/11/18
- [elpa] externals/auctex e83a4b87b3 25/48: Use the correct function to retrieve the key=vals, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex a617944b4b 08/48: Fix style/xspace.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 50c0fb3d31 46/48: * style/afterpage.el ("afterpage"): Fontify the only macro., Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 82a23a93ae 43/48: Add some variables containing font declarations, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 93430d7ab0 48/48: Merge remote-tracking branch 'origin/master' into externals/auctex, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 7642155b73 03/48: Don't let-bind `inhibit-point-motion-hooks' to t, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 6cbeff713b 47/48: Simplify implementation of style/fancyhdr.el, Tassilo Horn, 2022/11/18
- [elpa] externals/auctex 3d8d93e4fd 41/48: ; Make code more resilient, Tassilo Horn, 2022/11/18