auctex-devel
[Top][All Lists]
Advanced

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

Re: Support for LaTeX hooks


From: Ikumi Keita
Subject: Re: Support for LaTeX hooks
Date: Sun, 16 May 2021 18:33:35 +0900

Hi Arash,

>>>>> Arash Esbati <arash@gnu.org> writes:
> Hi all,
> next LaTeX release will have more support for hooks.  Try

>     texdoc lthooks-doc
>     texdoc ltfilehook-doc
>     texdoc ltcmdhooks-doc

You are always keen about new features about LaTeX!

> I think a preliminary support for hooks can be added to AUCTeX like
> this: We need a new variable `TeX-global-input-files-with-extension', a
> function which reads and returns the hook (see below) and another
> function which inserts the hook (tbd).  The one below currently inserts
> some text in the buffer for checking.  You can play with the code below
> by eval'ing the forms and in a .tex file, eval

>     (TeX-read-hook nil)

It works as expected.

> (defun TeX-read-hook (_optional)
>   "Read a LaTeX hook."
>   (let* ((hook (completing-read
>               (TeX-argument-prompt nil nil "Hook")
>               '("cmd"
>                 "env"
>                 "begindocument"
>                 "begindocument/before"
>                 "begindocument/end"
>                 "enddocument"
>                 "enddocument/afterlastpage"
>                 "enddocument/afteraux"
>                 "enddocument/info"
>                 "enddocument/end"
>                 "rmfamily"       "sffamily"
>                 "ttfamily"       "normalfont"
>                 "bfseries"       "bfseries/defaults"
>                 "mdseries"       "mdseries/defaults"
>                 "file/before"    "file/after"
>                 "package/before" "package/after"
>                 "class/before"   "class/after"
>                 "include/before" "include/end" "include/after")))

Don't we need shipout hooks as well? I see
,----
| 2.8.4
| Hooks provided \shipout operations
| There are several hooks and mechanisms added to LATEX’s process of generating 
pages.
| These are documented in ltshipout-doc.pdf or with code in ltshipout-code.pdf.
`----
in lthooks-doc.pdf and ltshipout-doc.pdf seems to provide the following
hooks:
shipout/before
shipout/foreground
shipout/background
shipout/firstpage
shipout/lastpage

>         ;; file/(before|after)/<file-name.xxx> where <file-name> is
>         ;; optional and must be with extension
>         ((string-match "\\`file" hook)

Maybe `string-prefix-p' suits slightly better than `string-match', but
of course they have practically no difference.

>       (setq result (mapconcat #'identity
>                               `(,hook ,name ,where)
>                               "/"))

I think
(concat hook "/" name "/" where)
is equivalent to that `mapconcat' call and seems more simple and
natural, IMHO.

Regards,
Ikumi Keita



reply via email to

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