[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-devel] [PATCH 4/5] TikZ: Add prompting for \coordinate macro.
From: |
Matthew Leach |
Subject: |
[AUCTeX-devel] [PATCH 4/5] TikZ: Add prompting for \coordinate macro. |
Date: |
Sun, 27 Mar 2016 19:04:30 +0100 |
* style/tikz.el (TeX-TikZ-point-function-map): New.
(TeX-TikZ-draw-arg-function-map): Use `TeX-TikZ-point-function-map'.
(TeX-TikZ-coordinate-arg): New.
---
style/tikz.el | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/style/tikz.el b/style/tikz.el
index af27c63..a877cb8 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -142,9 +142,14 @@ is finished."
;; Finish the macro.
(insert ";")))
-(defconst TeX-TikZ-draw-arg-function-map
+(defconst TeX-TikZ-point-function-map
'(("Rect Point" TeX-TikZ-arg-rect-point)
- ("Polar Point" TeX-TikZ-arg-polar-point)
+ ("Polar Point" TeX-TikZ-arg-polar-point))
+ "An alist of point specification types to their respective
+functions.")
+
+(defconst TeX-TikZ-draw-arg-function-map
+ `(,@TeX-TikZ-point-function-map
("Node" TeX-TikZ-arg-node)
("--" identity)
("-+" identity))
@@ -154,10 +159,19 @@ is finished."
(defun TeX-TikZ-draw-arg (optional)
(TeX-TikZ-macro-arg TeX-TikZ-draw-arg-function-map))
+(defun TeX-TikZ-coordinate-arg (optional)
+ "Prompt the user for the arguments to a TikZ coordinate macro."
+ (let ((options (TeX-TikZ-arg-options t))
+ (name (TeX-TikZ-arg-name nil))
+ (point (TeX-TikZ-single-macro-arg TeX-TikZ-point-function-map
+ "Coordinate point type: ")))
+ (insert options " " name " at" point ";")))
+
(TeX-add-style-hook
"tikz"
(lambda ()
(TeX-add-symbols
- '("draw" (TeX-TikZ-draw-arg)))
+ '("draw" (TeX-TikZ-draw-arg))
+ '("coordinate" (TeX-TikZ-coordinate-arg)))
(LaTeX-add-environments
'("tikzpicture"))))
--
2.7.4