[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extending env definitions or introducing new ones?
From: |
Arash Esbati |
Subject: |
Re: Extending env definitions or introducing new ones? |
Date: |
Mon, 07 Nov 2022 11:13:14 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 |
Hi Keita,
Ikumi Keita <ikumi@ikumi.que.jp> writes:
> Thank you for raising this issue. I like the idea of increasing
> flexibility of environment insertion facility.
Thanks for your response. Glad you share this.
> Both solutions looks feasible. ...Hm, how about this third one?
>
> (defun LaTeX--env-foo (environment env-func &rest args)
> (funcall env-func environment)
> ;; Instead of the above line, maybe...
> ;; (if (symbolp env-func)
> ;; (funcall env-func environment)
> ;; ;; Allow (functionname arg1 arg2 ...) for env-func value:
> ;; (apply (pop env-func) environment env-func))
>
> (when args
> (save-excursion
> (LaTeX-find-matching-begin)
> (end-of-line)
> (let ((TeX-exit-mark (or TeX-exit-mark
> (make-marker))))
> (TeX-parse-arguments args)))))
>
> I expect this usage:
> (LaTeX-add-environments
> '("bar" LaTeX--env-foo LaTeX-env-label "XXX" ["YYY"])
> ...)
Hmm, I'm not sure about your suggestion with `LaTeX--env-foo'. The main
reason is that I'm looking for a simple solution which I can add to
`LaTeX-completion-parse-args' here[1]. The code currently does:
(when (and (eq mac-or-env 'env)
(eq (car arg-list) #'LaTeX-env-args))
(pop arg-list))
I'd prefer a solution with a single function name where I can do:
(when (and (eq mac-or-env 'env)
(memq (car arg-list) '(LaTeX-env-args
LaTeX-env-label-args
...)))
(pop arg-list))
where I gobble one element from the list and then proceed. Does this
make sense?
Best, Arash
Footnotes:
[1] http://git.savannah.gnu.org/cgit/auctex.git/tree/latex.el#n7464