auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] GNU AUCTeX branch, master, updated. 6433dc38e49ab79a4341a


From: Arash Esbati
Subject: [AUCTeX-diffs] GNU AUCTeX branch, master, updated. 6433dc38e49ab79a4341ad515d1bf8986be3b9c2
Date: Fri, 29 Oct 2021 13:43:50 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU AUCTeX".

The branch, master has been updated
       via  6433dc38e49ab79a4341ad515d1bf8986be3b9c2 (commit)
      from  9a42bf4787e4e951ae559442b8729d3cdba0c651 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6433dc38e49ab79a4341ad515d1bf8986be3b9c2
Author: Arash Esbati <arash@gnu.org>
Date:   Fri Oct 29 19:42:39 2021 +0200

    Extend `TeX-read-key-val' to accept a function call
    
    * doc/changes.texi: Document the change.
    
    * latex.el (TeX-read-key-val): Accept a function call returning an
    alist as second argument.

diff --git a/doc/changes.texi b/doc/changes.texi
index ba5fab2..30166b9 100644
--- a/doc/changes.texi
+++ b/doc/changes.texi
@@ -40,6 +40,18 @@ uses these functions, use @code{split-string} and 
@code{assoc-string}
 instead.
 
 @item
+The function @code{TeX-read-key-val} now accepts a function call as second
+argument.  This change should help @AUCTeX{} style writers who use
+@code{TeX-arg-key-val} and have to deal with dynamic key-values.  Example
+of usage:
+@lisp
+(TeX-add-style-hook "foo"
+ (lambda ()
+   (TeX-add-symbols
+    '("bar" (TeX-arg-key-val (function-returning-key-val))))))
+@end lisp
+
+@item
 Since @AUCTeX{} 12.2, @kbd{C-x C-w} accidentally disabled the parse on
 save in that buffer, even when you enabled @code{TeX-auto-save} option.
 This bug was fixed.
diff --git a/latex.el b/latex.el
index 9630556..afd4190 100644
--- a/latex.el
+++ b/latex.el
@@ -3097,12 +3097,21 @@ If OPTIONAL is non-nil, indicate in the prompt that we 
are
 reading 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.  Use PROMPT as the prompt string."
+for the key.  KEY-VAL-ALIST can be a symbol or a function call
+returning an alist.  Use PROMPT as the prompt string."
   (multi-prompt-key-value
    (TeX-argument-prompt optional prompt "Options (k=v)")
-   (if (symbolp key-val-alist)
-       (eval key-val-alist t)
-     key-val-alist)))
+   (cond ((and (symbolp key-val-alist)
+              (boundp key-val-alist))
+         (symbol-value key-val-alist))
+        ((and (listp key-val-alist)
+              (symbolp (car key-val-alist))
+              (fboundp (car key-val-alist)))
+         (let ((head (car key-val-alist))
+               (tail (cdr key-val-alist)))
+           (apply head tail)))
+        (t
+         key-val-alist))))
 
 (defun TeX-arg-key-val (optional key-val-alist &optional prompt)
   "Prompt for keys and values in KEY-VAL-ALIST.

-----------------------------------------------------------------------

Summary of changes:
 doc/changes.texi | 12 ++++++++++++
 latex.el         | 17 +++++++++++++----
 2 files changed, 25 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU AUCTeX



reply via email to

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