auctex-devel
[Top][All Lists]
Advanced

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

Re: Extending env definitions or introducing new ones?


From: Ikumi Keita
Subject: Re: Extending env definitions or introducing new ones?
Date: Sun, 06 Nov 2022 19:52:06 +0900

Hi Arash,

>>>>> Arash Esbati <arash@gnu.org> writes:
> Hi all,
> we have the situation that many AUCTeX styles bake their own definitions
> for inserting environments; mostly for key-val options and other sort of
> arguments.  The issue is that latex.el offers only `LaTeX-env-args'.
> Suppose you want to insert an environment with `LaTeX-env-label' and
> also have some other arguments after \begin{evn-name}, then you copy the
> definition of `LaTeX-env-label' and fiddle the rest into it.

Thank you for raising this issue. I like the idea of increasing
flexibility of environment insertion facility.

> I see two solutions for 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"])
    ...)

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine



reply via email to

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