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, 25 Oct 2023 17:19:31 +0900

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> [Incompatibility]
>> 1. directory local variables
>> Currently, directory local variables are prepared in a entry like
>> (latex-mode (reftex-label-alist . (("equation" ?e "eq:%f-" "\\eqref{%s}")
>> ("align" ?e "eq:%f-" "\\eqref{%s}")
>> ("gather" ?e "eq:%f-" "\\eqref{%s}")))))
>> in .dir-locals.el. In this feature branch, mode name is `LaTeX-mode',
>> thus this entry is ignored.
>> 
>> The facility of major-mode-remap-list still does not handle this
>> situation.
>> 
>> We can announce this fact and ask users to rewrite their
>> .dir-locals.el, but that can't be done if the user doesn't have write
>> access for that particular .dir-locals.el. (Maybe we can ignore such
>> corner cases?)

> We should fix this for Emacs-30.
> [ And then add some backward compatibility hack (presumably using
>   an advice for when AUCTeX is used on Emacs<30).  ]

I attach my tentative proposal for Emacs<30, using an advice.

Attachment: 0001-Add-ugly-hack-to-accept-dir-local-vars-with-former-m.patch
Description: hack for dir local var compatibility

>> (a-2) Now `TeX-add-local-master' adds entry of new mode names such as
>> %%% Local Variables:
>> %%% mode: LaTeX      <-- not `latex'
>> %%% End:

> I don't like this very much: IMO the `mode:` cookie should really not specify
> the "mode" to use but rather describe the file-type (Emacs could/should
> aim to support "mime types" kind of names), and then which mode to use
> for each file-type is decided based on the user's configuration.

I understand your preferance, but I think such discrimination can't be
much rigorous in practical situations. For example, ConTeXt mode doesn't
have overlapped mode, so it's most natural to have
%%% mode: ConTeXt
; In my opinion, having both
%%% mode: context
and additional entry in major-mode-remap-alist is spurious
implementation.
Then "%%% mode: ConTeXt" v.s. "%%% mode: latex" doesn't look nice to me.
I prefer "%%% mode: ConTeXt" and "%%% mode: LaTeX", which look coherent.

> Maybe in addition to that, we need to be able to say in `dir-locals.el`
> that a setting applies only for exactly this major mode, and not
> its derivatives, maybe with a syntax like:

>  ((= latex-mode) (reftex-label-alist
>                   . (("equation" ?e "eq:%f-" "\\eqref{%s}")
>                      ("align" ?e "eq:%f-" "\\eqref{%s}")
>                      ("gather" ?e "eq:%f-" "\\eqref{%s}"))))

Looks reasonable.

Best regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine

reply via email to

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