[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa b211827 10/23: TikZ: Extract the prompting of the next arg f
From: |
Tassilo Horn |
Subject: |
[elpa] elpa b211827 10/23: TikZ: Extract the prompting of the next arg from TeX-TikZ-macro-arg. |
Date: |
Wed, 30 Mar 2016 19:08:02 +0000 |
branch: elpa
commit b21182798f7b4e48ffc65fa2143b76edee4a49c0
Author: Matthew Leach <address@hidden>
Commit: Matthew Leach <address@hidden>
TikZ: Extract the prompting of the next arg from TeX-TikZ-macro-arg.
* style/tikz.el (TeX-TikZ-single-macro-arg): New.
(TeX-TikZ-macro-arg): Use `TeX-TikZ-single-macro-arg' for prompting
the user and calling the appropriate function.
---
style/tikz.el | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/style/tikz.el b/style/tikz.el
index d7857b0..af27c63 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -103,6 +103,19 @@ PROMPT is non-nil use that prompt instead."
"Next argument type (RET to finish): ")))
(completing-read prompt types nil t)))
+(defun TeX-TikZ-single-macro-arg (function-alist &optional prompt)
+ "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."
+ (let* ((argument-types (mapcar 'car function-alist))
+ (argument-type (TeX-TikZ-get-arg-type argument-types prompt)))
+ (funcall
+ (cadr (assoc argument-type function-alist))
+ argument-type)))
+
+
(defun TeX-TikZ-macro-arg (function-alist)
"Prompt the user for arguments to compose a TikZ macro.
FUNCTION-ALIST is a mapping of argument-types to functions. The
@@ -111,19 +124,20 @@ 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))
- (argument-types `("" ,@(mapcar 'car function-alist)))
- (argument-type (TeX-TikZ-get-arg-type argument-types)))
+ ;; 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)))
+ (string-to-insert (TeX-TikZ-single-macro-arg
function-alist-iterative)))
;; Insert the macro options.
(insert options " ")
;; Iteratively prompt the user for TikZ's arguments until "" is
;; returned.
- (while (not (string= argument-type ""))
- (insert (funcall
- (cadr (assoc argument-type TeX-TikZ-draw-arg-function-map))
- argument-type))
- (setq argument-type (TeX-TikZ-get-arg-type argument-types)))
+ (while (not (string= string-to-insert ""))
+ (insert string-to-insert)
+ (setq string-to-insert
+ (TeX-TikZ-single-macro-arg function-alist-iterative)))
;; Finish the macro.
(insert ";")))
- [elpa] elpa 608e874 01/23: Add the beginnings of TikZ support., (continued)
- [elpa] elpa 608e874 01/23: Add the beginnings of TikZ support., Tassilo Horn, 2016/03/30
- [elpa] elpa 201ed15 06/23: Fix a misplaced closing parenthesis, Tassilo Horn, 2016/03/30
- [elpa] elpa 1288609 07/23: Add fontification support, Tassilo Horn, 2016/03/30
- [elpa] elpa 00740ed 08/23: TikZ: split out the prompts to TeX-TikZ-arg-node & TeX-TikZ-macro-arg., Tassilo Horn, 2016/03/30
- [elpa] elpa c49b547 17/23: TikZ: Rename 'text' to 'label' to be consistent with TikZ terminology., Tassilo Horn, 2016/03/30
- [elpa] elpa 1cb2678 04/23: Delete redundant code, Tassilo Horn, 2016/03/30
- [elpa] elpa bb67e18 13/23: TikZ: Add 'Named Point' point type with completion., Tassilo Horn, 2016/03/30
- [elpa] elpa 0423aae 19/23: New function TeX-error-report-has-errors-p, Tassilo Horn, 2016/03/30
- [elpa] elpa df60ed5 05/23: Fix the name of argument in function body, Tassilo Horn, 2016/03/30
- [elpa] elpa 00430f2 21/23: Restore compatibility with XEmacs, Tassilo Horn, 2016/03/30
- [elpa] elpa b211827 10/23: TikZ: Extract the prompting of the next arg from TeX-TikZ-macro-arg.,
Tassilo Horn <=
- [elpa] elpa e8b5498 09/23: TikZ: allow arg type prompt to be specified., Tassilo Horn, 2016/03/30
- [elpa] elpa 0bb9765 11/23: TikZ: Add prompting for \coordinate macro., Tassilo Horn, 2016/03/30
- [elpa] elpa 4770a35 12/23: TikZ: Add prompting for TikZ's \node macro., Tassilo Horn, 2016/03/30
- [elpa] elpa 7573813 23/23: Release GNU AUCTeX 11.89.3, Tassilo Horn, 2016/03/30
- [elpa] elpa d120a27 22/23: Merge branch 'master' into elpa, Tassilo Horn, 2016/03/30