[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: \documentclass does not activate latex-mode
From: |
Ikumi Keita |
Subject: |
Re: \documentclass does not activate latex-mode |
Date: |
Fri, 19 Aug 2022 18:12:33 +0900 |
>>>>> jfbu <jfbu@free.fr> writes:
>> For the time being, you can work around by
>> (let (entry)
>> (while (setq entry (rassq 'tex-mode auto-mode-alist))
>> (setcdr entry #'TeX-tex-mode)))
>> in your personal init file.
> wow it does work! Now that's quite magic to me. I have delayed for two
> decades learning e-Lisp...
It replaces all occurences of `tex-mode' in `auto-mode-alist' with
`TeX-tex-mode'. ;-)
> Thanks for your help!
You're welcome.
>>>>> Arash Esbati <arash@gnu.org> writes:
> Ikumi Keita <ikumikeita@jcom.home.ne.jp> writes:
>> [To developpers]
>> Why on earth does tex-mode.el use advice for its own function? The whole
>> above piece of code can just be composed up as
>> ----------------------------------------------------------------------
>> (defvar tex-mode--recursing nil)
>> (define-derived-mode tex-mode text-mode "generic-TeX"
>> "...doc string..."
>>
>> ;; The file may have "mode: tex" in the local variable
>> ;; block, in which case we'll be called recursively
>> ;; infinitely. Inhibit that.
>> (let ((tex-mode--recursing tex-mode--recursing))
>> (if (or delay-mode-hooks tex-mode--recursing)
>> ;; We're called from one of the children already.
>> (tex-common-initialization)
>> (setq tex-mode--recursing t)
>> (tex--guess-mode))))
>> ----------------------------------------------------------------------
>> without any advice, if I understand correctly.
>>
>> I think we should file bug report for tex-mode.el. What do others
>> think?
> I didn't look closely, but I trust your assessment. Would you file a
> bug report for tex-mode.el with your suggestion above?
I realized the necessity of around advice. My proposal calls the base
major mode function, `text-mode', unconditionally even when it delegates
the role to submode detected by `tex--guess-mode'. :-(
I'll reconsider this issue another day, probably November, since I don't
have much spare time now.
Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine