Subject: Re: bug#65750: 12.2; LaTeX-mark-section and LaTeX-section-list

From: Tassilo Horn <[email-masked]>
Date: Fri, 08 Sep 2023 09:43:03 +0200

Ikumi Keita <[email-masked]> writes:

>> That sounds reasonable in the current case.  OTOH, it could be that
>> users set things like outline-regexp in those mode-hooks which would
>> then be overridden by our set-up code if that ran after the hooks...
>
> Hmm, how about adding locally-bound test like this?
> (defun TeX-latex-mode ()
> ...
>   (LaTeX-common-initialization)
> ...
>   (run-mode-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook)
> ...
>   (or (local-variable-p 'outline-regexp)
>       (setq-local outline-regexp (LaTeX-outline-regexp t))
>   (or (local-variable-p 'outline-heading-alist)
>       (setq outline-heading-alist
>         (mapcar (lambda (x)
>           (cons (concat "\\" (nth 0 x)) (nth 1 x)))
>              LaTeX-section-list)))
> ...

Oh, yes, that looks like a proper approach to tackle that problem.

> (I noticed that this doesn't work as expected for doctex-mode because
> `run-mode-hooks' doesn't run hooks and `hack-local-variables' when
> latex-mode is called as parent of doctex-mode. We need to switch to
> "feature/fix-mode-names-overlap" branch, to define all major modes by
> `define-derived-mode', for clean solution.)

Thanks a lot for working on that!

Bye,
Tassilo