GNU bug report logs - #67008
30.0.50; Multiple major mode parents

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 9 Nov 2023 05:41:01 UTC

Severity: normal

Found in version 30.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 67008 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 67008 <at> debbugs.gnu.org
Subject: Re: bug#67008: 30.0.50; Multiple major mode parents
Date: Sat, 11 Nov 2023 11:57:02 -0500
> I tried the branch with the attached tentative addition to AUCTeX
> feature/fix-mode-names-overlap branch. I tested two modes, namely latex
> mode and japanese latex mode, with the second attachment to see whether
> the directory local variables stored in the .dir-locals.el are reflected
> or not.

Thanks for testing :-)

> For latex mode, it works as expected. Thank you, it is promising.

Great.

> On the contrary, it fails for japanese latex mode with the error:
> File mode specification error: (error Cycle in the major mode hierarchy: japanese-LaTeX-mode)
> I think the reason is that AUCTeX has
> (defalias 'japanese-latex-mode #'japanese-LaTeX-mode)
> for backward compatibility.

Oh, I see so `japanese-LaTeX-mode` declares `japanese-latex-mode` as an
extra parent but the alias makes it a cycle.
Admittedly, in the current `provided-mode-derived-p` code, we actually
don't signal errors in case of cycles, we just silently break them via
de-duplications, so I just changed my code accordingly.

> This new feature of multiple inheritance would work well for category
> [a], which retains backward compatibility by `major-mode-remap-alist'
> and doesn't use defalias. However, it doesn't work for category [b].

I believe with the code I just pushed it should work fine for [b] as well.

> It seems to me very difficult to arrange the proposed feature to cover
> category [b], looking at its way to handle mode alias.

Maybe there's something I'm missing, but the change was simple and I
believe it does address your use case.


        Stefan





This bug report was last modified 1 year and 187 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.