emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] elpa 0bb9765 11/23: TikZ: Add prompting for \coordinate macro.


From: Tassilo Horn
Subject: [elpa] elpa 0bb9765 11/23: TikZ: Add prompting for \coordinate macro.
Date: Wed, 30 Mar 2016 19:08:02 +0000

branch: elpa
commit 0bb97652bbcbdc92bac7fdce1c0402eded1d9cb4
Author: Matthew Leach <address@hidden>
Commit: Matthew Leach <address@hidden>

    TikZ: Add prompting for \coordinate macro.
    
    * 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 files 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"))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]