auctex-devel
[Top][All Lists]
Advanced

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

Re: scope environment in TikZ


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

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

>>>>>> Arash Esbati <arash@gnu.org> writes:
>> Give digestif[1] a roll; installation is really straight forward.  And if
>> you have eglot, starting it should work OOTB.
>
> I've already tried it before; it provided basic support for TikZ
> options. I hope it provides more advanced support as well :-)

I hope so, but as I said, I can't tell since I've never used it.

> If I understand correctly, it would move the point inside "{}" after C-c
> C-e when the user gave empty answer for argument query for environments
> like this:
>    (LaTeX-add-environments
>      ...
>      '("foo" LaTeX-env-args t)
>      ...)
> If the user intentionally keep there empty, that behavior wouldn't be
> what the user wants.

FTR, the current definition is like this:

  (defun LaTeX--env-parse-args (args)
    "Helper function to insert arguments defined by ARGS."
    (save-excursion
      (LaTeX-find-matching-begin)
      (end-of-line)
      (let ((TeX-exit-mark (or TeX-exit-mark
                               (make-marker))))
        (TeX-parse-arguments args))))

My suggestion is actually this (I copied a wrong version in my last
message :-():

  (defun LaTeX--env-parse-args (args)
    "Helper function to insert arguments defined by ARGS."
    (let ((TeX-exit-mark (or TeX-exit-mark
                             (point-marker))))
      (LaTeX-find-matching-begin)
      (end-of-line)
      (TeX-parse-arguments args)
      (goto-char (marker-position TeX-exit-mark))
      (set-marker TeX-exit-mark nil)))

In your example above, the point will be indeed inside "{}" after 'C-c
C-e' with no query at all.  Compare these examples:

  (LaTeX-add-environments
   '("foo" LaTeX-env-args t)
   '("bar" LaTeX-env-args nil)
   '("baz" LaTeX-env-args "Title"))

C-c C-e foo RET gives (with * being point):

  \begin{foo}{*}

  \end{foo}

C-c C-e bar RET gives:

  \begin{bar}{}
    *
  \end{bar}

C-c C-e baz RET gives:

  \begin{baz}{}
    *
  \end{baz}

C-c C-e baz RET baz RET gives:

  \begin{baz}{baz}
    *
  \end{baz}

For me, t behaves as described in the manual "Insert empty braces, leave
point between the braces.".  Does the above make sense?

> (But maybe I'm too skeptical and there is no environment which applies
> this worry.)

Not at all, I'm grateful that you're critical about code changes, please
don't stop this :-)

Best, Arash



reply via email to

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