Subject: bug#62278: 28.2; Outline in DocTeX mode

From: Arash Esbati <[email-masked]>
Date: Tue, 28 Mar 2023 09:42:33 +0200

Jan Braun <[email-masked]> writes:

> What do you mean with „using AUCTeX instead of the built-in 
> mode“?

I mean that there are at least 2 major modes for editing LaTeX/docTeX
files.  One of them is the one built in Emacs provided by this file:

  http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/textmodes/tex-mode.el

Another one is AUCTeX which you have to install yourself (since you're
on a mac, I assume you've installed yourself and pre-installed by a
distro).

> What kind of check should I perform?

I think the easiest way is to check the mode you're using with 'C-h m'.
If I open a .dtx file and hit 'C-h m', I see this because I'm using
AUCTeX:

  The major mode is docTeX/P mode defined in tex-mode.el:

  This function has :override advice: ‘TeX-doctex-mode’.

  This is an :override advice, which means that ‘doctex-mode’ isn’t
  run at all, and the documentation below may be irrelevant.
  [...]

When I start Emacs with the '-Q' switch, the same file reports:

  The major mode is DocTeX mode defined in tex-mode.el:

  Major mode to edit DocTeX files.

Because AUCTeX is not initialized and hence the built-in mode kicks in.

> This are the essential lines of ~/.emacs:
>
> ;;; 
> ;;; AUCTeX (sometimes also called AUC-TeX) was developed at the
> ;;; Aalborg university in denmark.  It is a mighty mode to work with
> ;;; nearly any kind of TeX and LaTeX files.
> (load "auctex.el" nil t t)
> (require 'auctex-latexmk)
> (auctex-latexmk-setup)
>
> Therefore I guess, I am using AUCTeX?

Yes, you are.  And if you have installed AUCTeX from ELPA (i.e. with M-x
list-packages), then you better drop the (load "auctex.el" nil t t)
line.

AUCTeX is a complete different beast w.r.t to outline-mode, so the code
I suggested cannot work when you use AUCTeX to edit a .dtx file.  I
suggest you close this report and open an AUCTeX feature request by
sending a message to [email-masked].

Best, Arash