[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] elpa 00740ed 08/23: TikZ: split out the prompts to TeX-TikZ-arg-n
From: |
Tassilo Horn |
Subject: |
[elpa] elpa 00740ed 08/23: TikZ: split out the prompts to TeX-TikZ-arg-node & TeX-TikZ-macro-arg. |
Date: |
Wed, 30 Mar 2016 19:08:02 +0000 |
branch: elpa
commit 00740ed871771a269c765b217e4a447e8cb7579b
Author: Matthew Leach <address@hidden>
Commit: Matthew Leach <address@hidden>
TikZ: split out the prompts to TeX-TikZ-arg-node & TeX-TikZ-macro-arg.
* style/tikz.el (TeX-TikZ-arg-options): New.
(TeX-TikZ-arg-name): New.
(TeX-TikZ-arg-text): New.
(TeX-TikZ-arg-node): Use new TikZ arg functions for prompting the
user.
(TeX-TikZ-macro-arg): Use `TeX-TikZ-arg-options' when prompting for
the options.
---
style/tikz.el | 43 +++++++++++++++++++++++++++++++++----------
1 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/style/tikz.el b/style/tikz.el
index de8a655..f5e11b1 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -58,17 +58,41 @@ Ask the user for r and theta values, and return the string
(theta (TeX-read-string (TeX-argument-prompt nil nil "Theta"))))
(concat " (" theta ":" r ") ")))
+(defun TeX-TikZ-arg-options (optional)
+ "Prompt the user for options to a TikZ macro.
+If OPTIONAL is non-nil, always return `LaTeX-optop' and
+`LaTeX-optcl', even if the user doesn't provide any input."
+ (let ((options (TeX-read-string (TeX-argument-prompt optional nil "Options"
))))
+ (if optional
+ (TeX-TikZ-get-opt-arg-string options)
+ (concat LaTeX-optop options LaTeX-optcl))))
+
+(defun TeX-TikZ-arg-name (optional)
+ "Prompt the user for a TikZ name.
+If OPTIONAL is non-nil, always return \"()\", even if the user
+doesn't provide any input."
+ (let ((name (TeX-read-string (TeX-argument-prompt optional nil "Name" ))))
+ (if optional
+ (TeX-TikZ-get-opt-arg-string name "(" ")")
+ (concat "(" name ")"))))
+
+(defun TeX-TikZ-arg-text (optional)
+ "Prompt the user for TikZ text.
+If OPTIONAL is non-nil always return `TeX-grop' and `TeX-grcl',
+even if the user doesn't provide any input."
+ (let ((text (TeX-read-string (TeX-argument-prompt optional nil "Text" ))))
+ (if optional
+ (TeX-TikZ-get-opt-arg-string text TeX-grop TeX-grcl)
+ (concat TeX-grop text TeX-grcl))))
+
(defun TeX-TikZ-arg-node (_ignored)
"Prompt the user for the deatils of a node.
Ask the user for the name and text for a node and return the
string \"node[OPTIONS](NAME){TEXT}\"."
- (let ((options (TeX-read-string (TeX-argument-prompt t nil "Options" )))
- (name (TeX-read-string (TeX-argument-prompt t nil "Name")))
- (text (TeX-read-string (TeX-argument-prompt nil nil "Text"))))
- (concat "node"
- (TeX-TikZ-get-opt-arg-string options)
- (TeX-TikZ-get-opt-arg-string name "(" ")")
- TeX-grop text TeX-grcl " ")))
+ (let ((options (TeX-TikZ-arg-options t))
+ (name (TeX-TikZ-arg-name t))
+ (text (TeX-TikZ-arg-text nil)))
+ (concat "node" options name text " ")))
(defun TeX-TikZ-get-arg-type (types)
"Prompt the user for the next argument type.
@@ -82,13 +106,12 @@ user is repeatedly prompted for the next argument-type;
they can
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-read-string (TeX-argument-prompt t nil "Options")))
+ (let* ((options (TeX-TikZ-arg-options t))
(argument-types `("" ,@(mapcar 'car function-alist)))
(argument-type (TeX-TikZ-get-arg-type argument-types)))
;; Insert the macro options.
- (insert (TeX-TikZ-get-opt-arg-string options)
- " ")
+ (insert options " ")
;; Iteratively prompt the user for TikZ's arguments until "" is
;; returned.
- [elpa] elpa a8a803c 02/23: Call TeX-after-compilation-finished-functions on warnings, (continued)
- [elpa] elpa a8a803c 02/23: Call TeX-after-compilation-finished-functions on warnings, Tassilo Horn, 2016/03/30
- [elpa] elpa ae34515 03/23: Better control for presence of errors, Tassilo Horn, 2016/03/30
- [elpa] elpa 0f8baf6 16/23: TikZ: Ignore case when prompting for argument types., Tassilo Horn, 2016/03/30
- [elpa] elpa 4a1728b 15/23: TikZ: Apply suggestions from checkdoc., Tassilo Horn, 2016/03/30
- [elpa] elpa cf4ce35 18/23: TikZ: Add more path connector types., Tassilo Horn, 2016/03/30
- [elpa] elpa f23fbd6 14/23: Fill environment content onley when auto-fill-mode is active, Tassilo Horn, 2016/03/30
- [elpa] elpa eddf3ff 20/23: Fix previous commit, Tassilo Horn, 2016/03/30
- [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 <=
- [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, 2016/03/30
- [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