auctex-devel
[Top][All Lists]
Advanced

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

Re: AUCTeX and "builtin latex mode" integration


From: Ikumi Keita
Subject: Re: AUCTeX and "builtin latex mode" integration
Date: Wed, 21 Sep 2022 05:01:23 +0900

Hi Stefan,

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> You may have seen an on-going discussion about the annoyance of the
>>> mixups between latex-mode and LaTeX-mode and such.
>> Could you tell us where that discussion takes place?

> I think it's on gnu.emacs.help, aka help-gnu-emacs.

Thank you, I'll take a look.

> Oh, I wasn't aware of regression.  We can workaround the problem
> using the `depth` property on `advice-add`, to make sure AUCTeX's advice
> takes precedence over that of `tex-mode.el` even if it's
> installed before.

> E.g. if you add the patch below to Emacs, can you confirm that it fixes
> the problem on your end?

Confirmed, it works as expected.

>     diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
>     index f624b604aac..77c0d234206 100644
>     --- a/lisp/textmodes/tex-mode.el
>     +++ b/lisp/textmodes/tex-mode.el
>     @@ -1014,7 +1014,10 @@ tex-mode
>      says which mode to use."
>        (tex-common-initialization))
     
>     -(advice-add 'tex-mode :around #'tex--redirect-to-submode)
>     +(advice-add 'tex-mode :around #'tex--redirect-to-submode
>     +            ;; Give it lower precedence than normal advice, so
>     +            ;; AUCTeX's advice takes precedence over it.
>     +            '((depth . 50)))
>      (defvar tex-mode--recursing nil)
>      (defun tex--redirect-to-submode (orig-fun)
>        "Redirect to one of the submodes when called directly."

> I pushed this to `emacs-28` so it will be fixed in the next Emacs
> release (but that may be Emacs-29.1).  In the mean time, you can use
> a `((depth . -10))` in AUCTeX to make it work with Emacs-28.1.

I'll do.

>> 3. Currently, there is defect in handling doc strings of AUCTeX LaTeX
>> mode, plain TeX mode and docTeX mode; C-h m and C-h f show doc string
>> of built-in modes, not AUCTeX modes.

> Maybe the help facility should be more careful in how it builds the
> docstring when a function has an `:override` advice, indeed.
> Could you `M-x report-emacs-bug` for that?

I'll do this, too, probably.

>> `AUCTeX-mode' should put suitable `function-documentation' property
>> for the respective major mode symbol.

> I think that would be exactly the kind of messing around I'd like to
> move away from.

Hmm. Then C-h m and C-h f will continue to show the doc string of the
built-in modes if `AUCTeX-mode' minor mode is implemented in the
suggested manner, even if the help facility is modified to take care of
:override advice. Is there any good alternative approach to display doc
strings of AUCTeX? (But it may be too early to discuss the
implementation detail of this level.)

>> From the users' point of view, I don't think it matters much. They just
>> specify
>> %%% mode: latex
>> as the file local variable and think that they are using `latex-mode'.
>> I think that it would be only Elisp programmers that care about the
>> "lies".

> There's regularly discussion (among (AUC)TeX Emacs users) about which
> major mode runs which hook.  I think it's an important issue not just
> for ELisp programmers.

I see. The hook name inconsistency must be indeed cause of trouble for
emacs users new to AUCTeX.

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine



reply via email to

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