auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Beginnings of TikZ support


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] Beginnings of TikZ support
Date: Sat, 26 Mar 2016 23:19:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux)

Matthew Leach <address@hidden> writes:

Hi Matthew,

>> I've began tackling the (rather daunting) task of writing an AUCTeX
>> style for TikZ.  I'm not sure if has been attempted before, but I'm
>> hoping that what I have will prove to be a solid starting point.

I just want to second Mosè.  Your work on TikZ support is highly
appreciated!

>> Please see the attached patch and feedback is much appreciated :-).
>
> I've just looked through the patch again and noticed a few errors.
> Please see updated patch that's attached.

I don't see anything obviously wrong. :-) Feel free to commit and push
it so that it hopefully gets some testing as soon as possible.

Just some nitpicks below:

> +;;; Code:
> +
> +(defun TeX-TikZ-get-opt-arg-string (arg &optional open close)
> +  "Return a string for optional arguments.
> +If ARG is nil or \"\", return \"\".  Otherwise return \"OPEN ARG
> +CLOSE\". If OPEN or CLOSE are nil, set them to `LaTeX-optop' and
> +`LaTeX-optcl' respectively."
> +  (unless (or open close)
> +    (progn
> +      (setq open LaTeX-optop)
> +      (setq close LaTeX-optcl)))
> +  (if (and arg (> (length arg) 0))
> +      (concat open arg close)
> +    ""))

`unless` has an implicit `progn` so you can drop the explicit one.

> +(defun TeX-TikZ-arg-rect-point (unused)
> +  "Prompt the user for a point on the Cartesian plane.
> +Ask the user for an X and Y coordinate, and return the string
> +\"(X,Y)\"."
> +  (let ((x (TeX-read-string (TeX-argument-prompt nil nil "X-coordinate")))
> +        (y (TeX-read-string (TeX-argument-prompt nil nil "Y-coordinate"))))
> +   (concat " (" x ", " y") ")))
> +
> +(defun TeX-TikZ-arg-polar-point (unused)
> +  "Prompt the user for a point on the polar plane.
> +Ask the user for r and theta values, and return the string
> +\"(THETA:R)\"."
> +  (let ((r (TeX-read-string (TeX-argument-prompt nil nil "R")))
> +        (theta (TeX-read-string (TeX-argument-prompt nil nil "Theta"))))
> +   (concat " (" theta ":" r ") ")))
> +
> +(defun TeX-TikZ-arg-node (unused)
> +  "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 " ")))

In general, most elisp functions name unused variables `ignored`.  And
it's even better to name them `_ignored` because the underscore is a
message to the emacs byte-compiler that this variable is intentionally
unused.

Bye,
Tassilo




reply via email to

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