monnier pushed a commit to branch externals/auctex
in repository elpa.
commit 8e56a38e1b7c15bfcd6074237ce544023f5c20da
Author: Tassilo Horn <[email protected]>
Date: Thu Mar 7 09:21:40 2013 +0000
* latex.el (TeX-read-key-val): New function.
(TeX-arg-key-val): Use `TeX-read-key-val'.
* style/hyperref.el (LaTeX-hyperref-package-options): Use
`TeX-read-key-val' instead of `TeX-arg-key-val' which caused args
to be inserted twice.
* style/siunitx.el (LaTeX-siunitx-package-options): Ditto.
---
ChangeLog | 11 +++++++++++
latex.el | 19 ++++++++++++++-----
style/hyperref.el | 8 +++-----
style/siunitx.el | 4 +---
4 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e9be8ea..d1186eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-03-07 Tassilo Horn <[email protected]>
+
+ * latex.el (TeX-read-key-val): New function.
+ (TeX-arg-key-val): Use `TeX-read-key-val'.
+
+ * style/hyperref.el (LaTeX-hyperref-package-options): Use
+ `TeX-read-key-val' instead of `TeX-arg-key-val' which caused args
+ to be inserted twice.
+
+ * style/siunitx.el (LaTeX-siunitx-package-options): Ditto.
+
2013-03-06 Mads Jensen <[email protected]>
* style/amsopn.el: Add GPL copyright notice.
diff --git a/latex.el b/latex.el
index ad19ef3..961e921 100644
--- a/latex.el
+++ b/latex.el
@@ -2121,6 +2121,19 @@ string."
TeX-left-right-braces)))
(indent-according-to-mode)))))
+(defun TeX-read-key-val (optional key-val-alist)
+ "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 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."
+ (multi-prompt-key-value
+ (TeX-argument-prompt optional "Options (k=v)" nil)
+ (if (symbolp key-val-alist)
+ (eval key-val-alist)
+ key-val-alist)))
+
(defun TeX-arg-key-val (optional key-val-alist)
"Prompt for keys and values in KEY-VAL-ALIST.
Insert the given value as a TeX macro argument. If OPTIONAL is
@@ -2128,11 +2141,7 @@ 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."
- (let ((options (multi-prompt-key-value
- (TeX-argument-prompt optional "Options (k=v)" nil)
- (if (symbolp key-val-alist)
- (eval key-val-alist)
- key-val-alist))))
+ (let ((options (TeX-read-key-val optional key-val-alist)))
(TeX-argument-insert options optional)))
diff --git a/style/hyperref.el b/style/hyperref.el
index e533dad..f5e708b 100644
--- a/style/hyperref.el
+++ b/style/hyperref.el
@@ -228,10 +228,8 @@
(when (fboundp 'reftex-ref-style-activate)
(reftex-ref-style-activate "Hyperref"))))
-(defun LaTeX-hyperref-package-options nil
- "Prompt for package options for the hyperref package."
- (let ((options
- (TeX-arg-key-val nil LaTeX-hyperref-package-options)))
- options))
+(defun LaTeX-hyperref-package-options ()
+ "Read the hyperref package options from the user."
+ (TeX-read-key-val t LaTeX-hyperref-package-options))
;;; hyperref.el ends here
diff --git a/style/siunitx.el b/style/siunitx.el
index 2e3988c..80acc1b 100644
--- a/style/siunitx.el
+++ b/style/siunitx.el
@@ -597,8 +597,6 @@ string."
(defun LaTeX-siunitx-package-options nil
"Prompt for package options for the siunitx package."
- (let ((options
- (TeX-arg-key-val nil LaTeX-siunitx-package-options)))
- options))
+ (TeX-read-key-val t LaTeX-siunitx-package-options))
;; siunitx.el ends here