auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] Further TikZ patches


From: Matthew Leach
Subject: [AUCTeX-devel] Further TikZ patches
Date: Wed, 13 Apr 2016 13:45:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Hi all,

Please see the attached TikZ patches.  I saw that the last set I pushed
broke compatibility with XEmacs, sorry about that.  I'm posting these
here to ensure I don't break it again!

Thanks,
-- 
Matt
>From b1dea28834634d0f26e0a225e3e38aaeaf0523e1 Mon Sep 17 00:00:00 2001
From: Matthew Leach <address@hidden>
Date: Fri, 8 Apr 2016 13:47:47 +0100
Subject: [PATCH 1/2] TikZ: Add the grid command.

* style/tikz.el (TeX-TikZ-arg-grid): New.
  (TeX-TikZ-draw-arg-function-map): Map the 'Grid' command to
  `TeX-TikZ-arg-grid'.
---
 style/tikz.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/style/tikz.el b/style/tikz.el
index e468dc3..52f1d2e 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -208,6 +208,11 @@ If OPTIONAL is non-nil and the user doesn't provide a 
point,
         (bend (TeX-TikZ-arg-bend t)))
        (concat "parabola" options bend)))
 
+(defun TeX-TikZ-arg-grid (_ignored)
+  "Prompt the user for the arguments to the grid command."
+  (let ((options (TeX-TikZ-arg-options t)))
+    (concat "grid" options)))
+
 (defconst TeX-TikZ-point-function-map
   (let ((point-alist '(("Rect Point" TeX-TikZ-arg-rect-point)
                        ("Polar Point" TeX-TikZ-arg-polar-point)
@@ -238,7 +243,8 @@ A set of base point types along with variants that have 
\"+\" and
     ("Node" TeX-TikZ-arg-node)
     ("Circle" TeX-TikZ-arg-circle)
     ("Arc" TeX-TikZ-arg-arc)
-    ("Parabola" TeX-TikZ-arg-parabola))
+    ("Parabola" TeX-TikZ-arg-parabola)
+    ("Grid" TeX-TikZ-arg-grid))
   "An alist of argument names and functoins for TikZ's \draw.")
 
 (defun TeX-TikZ-draw-arg (_ignored)
-- 
2.8.0

>From 2ad5b73f4d3c9460469423670d15497ddc8e6d01 Mon Sep 17 00:00:00 2001
From: Matthew Leach <address@hidden>
Date: Fri, 8 Apr 2016 13:59:30 +0100
Subject: [PATCH 2/2] TikZ: Don't allow relative points with \coordinate.

* style/tikz.el (TeX-TikZ-point-function-map): Revert back to simple
  point alist.
  (TeX-TikZ-relative-point-function-map): New.
  (TeX-TikZ-draw-arg-function-map): Use
  `TeX-TikZ-relative-point-function-map'.
---
 style/tikz.el | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/style/tikz.el b/style/tikz.el
index 52f1d2e..4a2fc03 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -214,20 +214,21 @@ If OPTIONAL is non-nil and the user doesn't provide a 
point,
     (concat "grid" options)))
 
 (defconst TeX-TikZ-point-function-map
-  (let ((point-alist '(("Rect Point" TeX-TikZ-arg-rect-point)
-                       ("Polar Point" TeX-TikZ-arg-polar-point)
-                       ("Named Point" TeX-TikZ-arg-named-point))))
-    (apply 'append (mapcar
-                    (lambda (point-map)
-                      (let ((key (car point-map))
-                            (value (cadr point-map)))
-                        `((,key ,value)
-                          (,(concat "+" key) ,value "+")
-                          (,(concat "++" key) ,value "++"))))
-                    point-alist)))
-  "An alist of point specification types and their functions.
-A set of base point types along with variants that have \"+\" and
-\"++\" as a prefix."  )
+  '(("Rect Point" TeX-TikZ-arg-rect-point)
+    ("Polar Point" TeX-TikZ-arg-polar-point)
+    ("Named Point" TeX-TikZ-arg-named-point))
+  "An alist of point specification types and their functions.")
+
+(defconst TeX-TikZ-relative-point-function-map
+  (apply 'append (mapcar
+                  (lambda (point-map)
+                    (let ((key (car point-map))
+                          (value (cadr point-map)))
+                      `((,(concat "+" key) ,value "+")
+                        (,(concat "++" key) ,value "++"))))
+                  TeX-TikZ-point-function-map))
+  "`TeX-TikZ-point-function-map' with \"+\" and \"++\" as a
+prefix.")
 
 (defconst TeX-TikZ-path-connector-function-map
   '(("--" identity)
@@ -239,6 +240,7 @@ A set of base point types along with variants that have 
\"+\" and
 
 (defconst TeX-TikZ-draw-arg-function-map
   `(,@TeX-TikZ-point-function-map
+    ,@TeX-TikZ-relative-point-function-map
     ,@TeX-TikZ-path-connector-function-map
     ("Node" TeX-TikZ-arg-node)
     ("Circle" TeX-TikZ-arg-circle)
-- 
2.8.0


reply via email to

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