[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa de0d445 07/51: TikZ: Add optional parameter to `TeX-TikZ-sin
From: |
Tassilo Horn |
Subject: |
[elpa] elpa de0d445 07/51: TikZ: Add optional parameter to `TeX-TikZ-single-macro-arg'. |
Date: |
Sun, 22 May 2016 07:22:47 +0000 (UTC) |
branch: elpa
commit de0d445ea13a772d9cd842863c4d49217be7553b
Author: Matthew Leach <address@hidden>
Commit: Matthew Leach <address@hidden>
TikZ: Add optional parameter to `TeX-TikZ-single-macro-arg'.
* style/tikz.el (TeX-TikZ-single-macro-arg): New argument OPTIONAL.
(TeX-TikZ-macro-arg): Use OPTIONAL argument when calling
`TeX-TikZ-single-macro-arg'.
---
style/tikz.el | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/style/tikz.el b/style/tikz.el
index d335cbc..222be06 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -101,14 +101,18 @@ PROMPT as the prompt for input."
(let ((completion-ignore-case t))
(completing-read prompt types nil t)))
-(defun TeX-TikZ-single-macro-arg (function-alist prompt)
+(defun TeX-TikZ-single-macro-arg (function-alist prompt &optional optional)
"Prompt the user for a single argument to compose a TikZ macro.
FUNCTION-ALIST is a mapping of argument-types to functions. The
user is prompted for the argument type, the chosen function is
then called and the value returned. PROMPT is used as the prompt
-for the argument type."
+for the argument type. When OPTIONAL is non-nil, add \"\" to
+FUNCTION-ALIST with a mapping to `identity', permitting an
+optional input."
(let* ((argument-types (mapcar 'car function-alist))
(argument-type (TeX-TikZ-get-arg-type argument-types prompt)))
+ (when optional
+ (setq function-alist `(,@function-alist ("" identity))))
(funcall
(cadr (assoc argument-type function-alist))
argument-type)))
@@ -122,11 +126,8 @@ choose form the cars in FUNCTION-ALIST and the appropriate
function is then called. If the user enters \"\", then the macro
is finished."
(let* ((options (TeX-TikZ-arg-options t))
- ;; For the iterative version, we need to add "" to the
- ;; function-alist, allowing the user to end the macro.
- (function-alist-iterative `(,@function-alist ("" identity)))
(prompt "Next argument type (RET to finish): ")
- (string-to-insert (TeX-TikZ-single-macro-arg function-alist-iterative
prompt)))
+ (string-to-insert (TeX-TikZ-single-macro-arg function-alist prompt
t)))
;; Insert the macro options.
(insert options " ")
@@ -136,7 +137,7 @@ is finished."
(while (not (string= string-to-insert ""))
(insert string-to-insert)
(setq string-to-insert
- (TeX-TikZ-single-macro-arg function-alist-iterative prompt)))
+ (TeX-TikZ-single-macro-arg function-alist prompt t)))
;; Finish the macro.
(insert ";")))
- [elpa] elpa updated (7573813 -> ebf4b8a), Tassilo Horn, 2016/05/22
- [elpa] elpa da88a3e 01/51: Dinamically put delete-selection prop to TeX-insert-dollar, Tassilo Horn, 2016/05/22
- [elpa] elpa c58162a 04/51: TikZ: Add circle command., Tassilo Horn, 2016/05/22
- [elpa] elpa 310008b 05/51: TikZ: Add the arc command., Tassilo Horn, 2016/05/22
- [elpa] elpa b66c10a 08/51: TikZ: Add parabola command., Tassilo Horn, 2016/05/22
- [elpa] elpa 84dfb76 13/51: Do not use add-to-list for let-bound variable, Tassilo Horn, 2016/05/22
- [elpa] elpa de0d445 07/51: TikZ: Add optional parameter to `TeX-TikZ-single-macro-arg'.,
Tassilo Horn <=
- [elpa] elpa 44e654b 22/51: Use `match-string-no-properties', Tassilo Horn, 2016/05/22
- [elpa] elpa 36b6051 12/51: Compatibility for XEmacs, Tassilo Horn, 2016/05/22
- [elpa] elpa af27d33 17/51: TikZ: Add the grid command., Tassilo Horn, 2016/05/22
- [elpa] elpa bc8d07f 27/51: Temporarily bind `TeX-insert-macro-default-style' to 'show-optional-args', Tassilo Horn, 2016/05/22
- [elpa] elpa 88fbf80 20/51: Fix in TeX sentinels, Tassilo Horn, 2016/05/22
- [elpa] elpa 693eee6 11/51: TikZ: Remove unneeded function., Tassilo Horn, 2016/05/22
- [elpa] elpa b20cd68 16/51: Fix a documentation type., Tassilo Horn, 2016/05/22
- [elpa] elpa 71349ec 23/51: Use `deactivate-input-method' if defined, Tassilo Horn, 2016/05/22
- [elpa] elpa d4d2ab5 31/51: Enable directory local variables in japanese-{latex, plain-tex}-mode, Tassilo Horn, 2016/05/22
- [elpa] elpa 63a83c3 30/51: Make unloading of tex-site work on Emacs 24, Tassilo Horn, 2016/05/22