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

From: Ikumi Keita <[email-masked]>
Date: Fri, 08 Sep 2023 16:23:32 +0900

Hi Tassilo,

>>>>> Tassilo Horn <[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)))
...

(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.)

Regards,
Ikumi Keita
#StandWithUkraine #StopWarInUkraine