auctex-devel
[Top][All Lists]

## Re: scope environment in TikZ

 From: Arash Esbati Subject: Re: scope environment in TikZ Date: Thu, 10 Nov 2022 14:14:53 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

> The next thing I'd like to discuss is scope environment in TikZ.

You're drawing some TikZ pictures lately? ;-)

> The scope environment is practically always accompanied by an optional
> argument by its nature:
> \begin{tikzpicture}
>   \begin{scope}[TikZ options...]
>   ...
>   \end{scope}
> \end{tikzpicture}
> In other words, its "optional" argument is virtually a kind of mandatory
> argument.

I'm not familiar with TikZ, but I had a brief look at the manual and
indeed, using the scope environment without options is pretty pointless.

> So I'm thinking to apply the attached patch. It modifies the AUCTeX
> behavior with respect to the scope environment to insert a bracket pair
> "[]" even when the user gave empty answer for query of optional
> argument. In addition, it moves the point inside in that empty "[]",
> assuming that the user actually expects to fill in that bracket
> immediately, possibly with the help of in-buffer completion facility.

Keep in mind that if you want to use in-buffer completion when you're
inside the brackets, you need (TeX-arg-key-val key=vals)' in the hook,
so I think the best would be if you could see if you achieve what you're
looking after with LaTeX-env-args' -- but I think that wouldn't work
because of the (save-excursion ...) it uses?

> I admit that it might be a bit too aggresive. What do you think about
> this idea?

See above.  Patching ConTeXt-insert-environment' seems reasonable to
me.

Best, Arash

`