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: Fri, 27 Oct 2023 15:22:40 +0900

>>>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
> So, IIUC, you're counting on Someoneβ„’ to do the work on the Emacs side πŸ™‚

Yes. πŸ˜‰

Actually, I only looked at very limited portion of the related codes in
emacs core and don't have reasonable ideas how to do that in emacs side.

> I hope we can arrange the code in Emacs-30 so that no changes are needed
> in `.dir-locals.el`, in which case the advice should be activated by
> default and we likely shouldn't plead with our users to rewrite their
> `.dir-locals.el`.

I see.

> Hmm... this does look awful πŸ™

Exactly. πŸ’€

> Some questions/comments about the above comment:

> - Indeed, I see that (derived-mode-p 'aaa-mode) returns nil in that
>   case, which is a bug.  Do we have a bug-number for that?

No, I took it as a designed feature. (Under usual circumstances, there
isn't a case that major-mode is aaa-mode when aaa-mode is an alias of
bbb-mode.)

>   Amusingly, it returns `aaa-mode` if `aaa-mode` is undefined :-)

😡

> - Is the problem new in Emacs-28 (if so, I guess it came about
>   in the rewrite which introduced `provided-mode-derived-p`).

I think so. The following code returns non-nil on emacs 27.1:
----------------------------------------------------------------------
(defun bbb-mode ()
  1)
(defalias 'aaa-mode #'bbb-mode)
(let ((major-mode 'aaa-mode))
  (derived-mode-p 'aaa-mode))
----------------------------------------------------------------------
(I didn't test it on emacs 27.x where x>1.)

> - How exactly is it related to the issue of activating `latex-mode`
>   dir-local settings in `LaTeX-mode`?

Not related to `latex-mode' v.s. `LaTeX-mode'. This ugly hack is
necessary for modes handled by aliases such as `context-mode' v.s.
`ConTeXt-mode'. Note that redirections for some modes in this feature
branch are handled by defalias rather than
major-mode-remap-alist/advice. For example we have
(defalias 'context-mode #'ConTeXt-mode)
in context.el.
Suppose that a ConTeXt document has file local variables section
%%% Local Variables:
%%% mode: context
%%% End:
and there is a .dir-locals.el with a entry
 (context-mode
  (foo . 1))
in it. Then emacs 28 and later won't pick up this entry for variable
`foo' without the "ugly hack", i.e.
      (setq orig-former (symbol-function former))
      (fset former former)
.
Similar modes handled by defalias are:
context-mode v.s. ConTeXt-mode
ams-tex-mode v.s. AmSTeX-mode
japanese-plain-tex-mode v.s. japanese-plain-TeX-mode
japanese-latex-mode v.s. japanese-LaTeX-mode

> I really should look at how best to solve the problem in Emacs-30, it
> might give me some ideas about how to write a better workaround for
> Emacs<30.

I hope there is such better workaround.

> Do you think it would be OK for AUCTeX to declare that `latex-mode` is
> *another* parent of `LaTeX-mode`?  The idea is not to allow multiple
> inheritance in `define-derived-mode`, but to allow it in `derived-mode-p`.

Yes, I'll welcome that idea.

Best regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine



reply via email to

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