Hi Stefan, >>>>> Stefan Monnier <monn...@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 do think it would be good to try and "integrate" the two modes, for > some definition of "integrate". The question being indeed what > "integration" is the best way forward. I also want some improvements with regard to the "integration" because I recently realized that emacs built-in `tex-mode' (accidentally?) shadows AUCTeX `TeX-tex-mode' since emacs 28.1, to fail to enter LaTeX mode for some cases[1][2]. (I'm not sure that the above discussion involves this issue.) [1] thread beginning with https://lists.gnu.org/r/auctex/2022-08/msg00001.html [2] https://tex.stackexchange.com/questions/648955/auctex-inconsistent-behavior-tex-vs-latex > I'm wondering if it would be possible to turn AUCTeX into a minor mode. > E.g. `LaTeX-mode` would then be redefined as > (define-derived-mode TeX-latex-mode latex-mode ... > (AUCTeX-mode 1)) > and `TeX-modes-set` would add/remove `AUCTeX-mode` from the hooks like > `latex-mode-hook`. It basically looks reasonable. I assume that you are thinking that `AUCTeX-mode' actually chooses suitable behavior according to the value of `major-mode' between `latex-mode', `plain-tex-mode', `doctex-mode' and `texinfo-mode'. > There's no doubt that it would introduce some (presumably minor or > easy to fix) breakage in some corner cases for some exotic configs, of > course, but I feel like in the long run it might be worth it. +1 Here are some random thoughts. 1. There will be some overheads because it first runs initialization codes of emacs built-in mode and then runs AUCTeX minor mode; I expect that the associated cost is cheap enough. 2. AUCTeX still must retain some major modes, i.e., ConTeXt mode, AmS-TeX mode, Japanese LaTeX mode and Japanese plain TeX mode because there are no counterparts in emacs built-in modes. 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. `AUCTeX-mode' should put suitable `function-documentation' property for the respective major mode symbol. 4. `TeX-tex-mode' and `tex-mode' would need some special treatment. > To be honest, I haven't looked very much at the code to see how > realistic this is, but I think this could help clarify the situation > for users. E.g. it would eliminate "lies" such as (setq major-mode > 'latex-mode) in `latex.el`. 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". Best regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine