auctex-devel
[Top][All Lists]
Advanced

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

[AUCTeX-devel] Add more TikZ path connector types.


From: Matthew Leach
Subject: [AUCTeX-devel] Add more TikZ path connector types.
Date: Tue, 29 Mar 2016 18:32:19 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Hi all,

Attached is a patch that adds more path connector types to the TikZ
style.  From the TikZ manual I see that there are a set of "base"
connectors, e.g. "--", "-|".  For each of these I derive another two
path connector types, namely they have " +" and " ++" appended to them.
I've tried to do this pragmatically and attached is a patch that does
work but depends upon `-mapcat' from dash.

I'm not sure whether XEmacs has dash, so it may break the build for it
or if there is a better way to achieve what I'm trying to do.  Comments?

Thanks,
-- 
Matt
>From 0a9fc4913866d61a9fc81331c2e2468925a9ecb4 Mon Sep 17 00:00:00 2001
From: Matthew Leach <address@hidden>
Date: Tue, 29 Mar 2016 18:13:45 +0100
Subject: [PATCH] TikZ: Add more path connector types.

* style/tikz.el (TeX-TikZ-path-connector-function-map): New.
  (TeX-TikZ-draw-arg-function-map): Use
  `TeX-TikZ-path-connector-function-map.
---
 style/tikz.el | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/style/tikz.el b/style/tikz.el
index 8447b7b..a30ef9b 100644
--- a/style/tikz.el
+++ b/style/tikz.el
@@ -178,11 +178,22 @@ them as a list of strings, dropping the '()'."
     ("Named Point" TeX-TikZ-arg-named-point))
   "An alist of point specification types and their functions." )
 
+(defconst TeX-TikZ-path-connector-function-map
+  (let ((connectors '("--" "|-" "-|")))
+    (-mapcat
+     (lambda (connector)
+       `((,connector identity)
+         (,(concat connector " +") identity)
+         (,(concat connector " ++") identity)))
+     connectors))
+  "An alist of path connectors.
+A set of base connectors along with variants that have \" +\" and
+\" ++\" appended to them, mapping to the identity function.")
+
 (defconst TeX-TikZ-draw-arg-function-map
   `(,@TeX-TikZ-point-function-map
-    ("Node" TeX-TikZ-arg-node)
-    ("--" identity)
-    ("-+" identity))
+    ,@TeX-TikZ-path-connector-function-map
+    ("Node" TeX-TikZ-arg-node))
   "An alist of argument names and functoins for TikZ's \draw.")
 
 (defun TeX-TikZ-draw-arg (_ignored)
-- 
2.7.4


reply via email to

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