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: Thu, 27 May 2021 00:10:58 +0900

Hi Arash,

>>>>> Arash Esbati <arash@gnu.org> writes:
> Ok, I would then move the complete sentence into next line:

>     (defvar TeX-global-input-files-with-extension nil
>       "List of the non-local TeX input files with extension.
>     Initialized once at the first time you prompt for an input file
>     inside a file hook command.  
>     May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.")

That's a good idea.

> Argh, thanks for catching this.  I think I can cure this by adding a
> check like this:

>     (search (if (and (eq TeX-arg-input-file-search 'ask)
>                      (member hook
>                              '("file/before"    "file/after"
>                                "include/before" "include/end"
>                                "include/after"
>                                "class/before"   "class/after"
>                                "package/before" "package/after")))
>                 (not (y-or-n-p "Find file yourself? "))
>               TeX-arg-input-file-search))

I still think this query should be done later. Here is the `cond'
clause for class hook:

>         ;; class/(before|after)/<doc-class> where <doc-class> is
>         ;; optional
>         ((member hook '("class/before" "class/after"))
>          (let* ((TeX-file-extensions '("cls")))
>            (unless LaTeX-global-class-files
>              (setq LaTeX-global-class-files
>                    (if search
>                        (prog2
>                            (message "Searching for LaTeX classes...")
>                            (mapcar #'list
>                                    (TeX-search-files-by-type 'texinputs
>                                                              'global
>                                                              t t))
>                          (message "Searching for LaTeX classes...done"))
>                      LaTeX-style-list))))

With this implementation, the result of "Find file yourself? " query
isn't used when `LaTeX-global-class-files' is non-nil. In other words,
it would force the user to answer meaningless inquiry.

How about storing lambda form which does y-or-n query in `search'
variable, like `func', and call it when it is actually necessary?

         (search (lambda ()
                    (if (eq TeX-arg-input-file-search 'ask)
                     (not (y-or-n-p "Find file yourself? "))
                   TeX-arg-input-file-search)))
[...]
          ;; file/(before|after)/<file-name.xxx> where <file-name> is
          ;; optional and must be with extension
          ((member hook '("file/before" "file/after"))
           (if (funcall search)
               ^^^^^^^^^^^^^^^^
[...]
          ;; class/(before|after)/<doc-class> where <doc-class> is
          ;; optional
          ((member hook '("class/before" "class/after"))
           (let* ((TeX-file-extensions '("cls")))
             (unless LaTeX-global-class-files
               (setq LaTeX-global-class-files
                     (if (funcall search)
                         ^^^^^^^^^^^^^^^^
                         (prog2
[...]

Regards,
Ikumi Keita



reply via email to

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