Hi Mandar,

>>>>> Mandar Mitra <mandar.mi...@gmail.com> writes:
> 2. Sorry, I must be missing something obvious, but I couldn't find a
> defun for LaTeX-add-environments, or much documentation regarding the
> format of the entry for each environment.

That's defined by defun generated by elisp macro `TeX-auto-add-type'.
See
...
(TeX-auto-add-type "environment" "LaTeX")
...
in latex.el and the definition of `TeX-auto-add-type' in tex.el. ;-)

With respect to the format of the entry, see info node `(auctex) Adding
Environments'.

> I suspect (but don't know for sure) that there was something wrong
> with this part of my beamer.el:

>     (LaTeX-add-environments
>      '("frame"  (lambda (env &rest ignore) ...

> I copy-pasted the "frame" entry from elpa/auctex-13.2.1/style, and
> wrote my own LaTeX-beamer-env-frame in my beamer.el to override the
> package version. Things now work almost like I wanted.

The reason why your customization was ignored is that "the longest entry
wins" rule described in the above info node. Previously, the entry for
the frame env was of the form
("frame" (lambda (...) ...))
, which was 2 elements long. In that case, your local customization was
used. However, now the entry in beamer.el is of the form
("frame" LaTeX-env-args [TeX-arg-beamer-overlay-spec] ...)
, which is 6 elements long.
After you copied the entry and tweaked it, your local entry becomes 6
elements long, too, so it becomes effective again.

> Three follow-up questions:

> 1. The "frame" entry in elpa/auctex-13.2.1/style/beamer.el looks like

>     '("frame" LaTeX-env-args [TeX-arg-beamer-overlay-spec]
>       [TeX-arg-beamer-default-overlay-spec]
>       [TeX-arg-key-val (("allowdisplaybreaks" ("0" "1" "2" "3" "4"))
>                         ("allowframebreaks") ("b") ("c") ("t") ("s")
>                         ("noframenumbering")
>                         ("fragile" ("singleslide"))
>                         ("environment") ("label") ("plain") ("shrink")
>                         ("squeeze"))]
>       LaTeX-beamer-env-frame)

> If I hit just ENTER in response to the prompt from
> TeX-arg-beamer-overlay-spec, I don't get any prompts from
> TeX-arg-beamer-default-overlay-spec and TeX-arg-key-val. In order to
> get those prompts, I *have* to provide some input to
> TeX-arg-beamer-overlay-spec. Am I missing some setting?

That's default behavior of `TeX-insert-macro' (C-c C-m), when the
customize option `TeX-insert-macro-default-style' is
`show-optional-args'. You can customize the behavior by setting that
option to `show-all-optional-args'[1]. Note that
`show-all-optional-args' affects every C-c C-m as well.

[1] https://lists.gnu.org/r/auctex-devel/2022-12/msg00020.html

> 3. Low priority: would it be worth adding a customisable variable to
> let people choose between the \frametitle{} and \begin{frame}{title}
> styles?

Hmm, that would require customized elisp function for frame environment.
Patches welcome. :-)

> On a related note, in case this is useful to anyone, I also have (in
> the beamer.el within the TeX-style-private directory)

> ---------------------------------------------------------------------------
>    (setq-local imenu-create-index-function
>                'imenu-default-create-index-function)
>    (setq-local imenu-generic-expression
>                '((nil ; put in top-level menu
>                   "^\\\\begin{frame}\\(\\[[a-z,]+\\]\\)?{\\(.+\\)}"
>                   2   ; which bracketed expression goes in title
>                   )))
> ---------------------------------------------------------------------------

> so that I can use imenu to jump to a slide by title.

Thanks, I'll see what I can do when I have enough spare time.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

Reply via email to