GNU bug report logs - #24412
11.89; Wrong DocTeX-mode

Previous Next

Package: auctex;

Reported by: Piet van Oostrum <piet <at> vanoostrum.org>

Date: Sun, 11 Sep 2016 16:28:01 UTC

Severity: normal

Found in version 11.89

Done: Arash Esbati <arash <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24412 in the body.
You can then email your comments to 24412 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#24412; Package auctex. (Sun, 11 Sep 2016 16:28:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Piet van Oostrum <piet <at> vanoostrum.org>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Sun, 11 Sep 2016 16:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Piet van Oostrum <piet <at> vanoostrum.org>
To: bug-auctex <at> gnu.org
Subject: 11.89; Wrong DocTeX-mode
Date: Sun, 11 Sep 2016 17:15:07 +0200
In AucTeX, latex.el (line 5871) contains:

(add-to-list 'auto-mode-alist '("\\.dtx\\'" . doctex-mode))

However, AUCTeX's doctex mode is called docTeX-mode. So the line above causes the standard Emacs doctex-mode to be invoked, rather than AUCTeX's docTeX-mode. This is undesirable.

The line should be:

(add-to-list 'auto-mode-alist '("\\.dtx\\'" . docTeX-mode))

There is another thing. The documentation of docTeX-mode says:

"Major mode in AUCTeX for editing .dtx files derived from `LaTeX-mode'.
Runs `LaTeX-mode', sets a few variables and
runs the hooks in `docTeX-mode-hook'."

However, docTeX-mode-hook is never run.
------------------------------------------------------------------------



Emacs  : Aquamacs 3.3dev  GNU Emacs 25.1.1 (x86_64-apple-darwin14.1.0, NS appkit-1344.72 Version 10.10.2 (Build 14C109))
 of 2016-08-27 on d897b997d8d0ed9db56ce9d1afc679b9a3f1e2fd
Package: 11.89

current state:
==============
(setq
 AUCTeX-date "2015-11-13"
 window-system 'ns
 LaTeX-version "2e"
 TeX-style-path '("/Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/var/auctex" "/Applications/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/auctex/style" "/Users/piet/Library/Preferences/Aquamacs Emacs/Packages/auctex/auto" "/Users/piet/Library/Preferences/Aquamacs Emacs/Packages/auctex/style" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("LatexMk" "latexmk %(-PDF)%S%(mode) %(file-line-error) %(extraopts) %t"
					 TeX-run-latexmk nil (plain-tex-mode latex-mode doctex-mode) :help
					 "Run LatexMk")
					("TeX"
					 "%(PDF)%(tex) %(file-line-error) %(extraopts) %`%S%(PDFout)%(mode)%' %t"
					 TeX-run-TeX nil (plain-tex-mode ams-tex-mode texinfo-mode) :help
					 "Run plain TeX")
					("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help
					 "Run LaTeX")
					("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil (texinfo-mode)
					 :help "Run Makeinfo with Info output")
					("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil
					 (texinfo-mode) :help "Run Makeinfo with HTML output")
					("AmSTeX" "amstex %(PDFout) %(extraopts) %`%S%(mode)%' %t" TeX-run-TeX nil
					 (ams-tex-mode) :help "Run AMSTeX")
					("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t"
					 TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
					("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil
					 (context-mode) :help "Run ConTeXt until completion")
					("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX")
					("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
					("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer")
					("Print" "%p" TeX-run-command t t :help "Print the file")
					("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible
					 TeX-queue-command)
					("File" "%(o?)dvips %d -o %f " TeX-run-dvips t t :help
					 "Generate PostScript file")
					("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t :help
					 "Convert DVI file to PostScript")
					("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t :help
					 "Convert DVI file to PDF with dvipdfmx")
					("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help
					 "Convert PostScript file to PDF")
					("Index" "makeindex %s" TeX-run-index nil t :help
					 "Run makeindex to create index file")
					("Xindy" "texindy %s" TeX-run-command nil t :help
					 "Run xindy to create index file")
					("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help
					 "Check LaTeX file for correctness")
					("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode) :help
					 "Check LaTeX file for common mistakes")
					("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help
					 "Spell-check the document")
					("Clean" "TeX-clean" TeX-run-function nil t :help
					 "Delete generated intermediate files")
					("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
					 "Delete generated intermediate and output files")
					("Other" "" TeX-run-command t t :help "Run an arbitrary command")
					("Jump to PDF" "%V" TeX-run-discard-or-function nil t :help "Run Viewer"))
 )
-- 
Piet van Oostrum <piet <at> vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]





Information forwarded to bug-auctex <at> gnu.org:
bug#24412; Package auctex. (Sun, 11 Sep 2016 20:34:01 GMT) Full text and rfc822 format available.

Message #8 received at 24412 <at> debbugs.gnu.org (full text, mbox):

From: David Kastrup <dak <at> gnu.org>
To: Piet van Oostrum <piet <at> vanoostrum.org>
Cc: 24412 <at> debbugs.gnu.org
Subject: Re: bug#24412: 11.89; Wrong DocTeX-mode
Date: Sun, 11 Sep 2016 22:26:16 +0200
Piet van Oostrum <piet <at> vanoostrum.org> writes:

> In AucTeX, latex.el (line 5871) contains:
>
> (add-to-list 'auto-mode-alist '("\\.dtx\\'" . doctex-mode))
>
> However, AUCTeX's doctex mode is called docTeX-mode. So the line above causes the standard Emacs doctex-mode to be invoked, rather than AUCTeX's docTeX-mode. This is undesirable.
>
> The line should be:
>
> (add-to-list 'auto-mode-alist '("\\.dtx\\'" . docTeX-mode))

Why?  It doesn't change the other modes either.  The point is that they
are mapped to the AUCTeX modes on-demand, see


TeX-modes is a variable defined in ‘tex-site.el’.
Its value is
(tex-mode plain-tex-mode texinfo-mode latex-mode doctex-mode)

Documentation:
List of modes provided by AUCTeX.

This variable can’t be set normally; use customize for that, or
set it with ‘TeX-modes-set’.

You can customize this variable.

> There is another thing. The documentation of docTeX-mode says:
>
> "Major mode in AUCTeX for editing .dtx files derived from `LaTeX-mode'.
> Runs `LaTeX-mode', sets a few variables and
> runs the hooks in `docTeX-mode-hook'."
>
> However, docTeX-mode-hook is never run.

That's a possible bug.  Let me see.

docTeX-mode is defined with

(define-derived-mode docTeX-mode TeX-latex-mode "docTeX"
...

in latex.el.  The documentation of define-derived-mode states:

    The new mode runs the hook constructed by the function
    ‘derived-mode-hook-name’.

which is defined as

    (defsubst derived-mode-hook-name (mode)
      "Construct a mode-hook name based on a MODE name."
      (intern (concat (symbol-name mode) "-hook")))

Which very much looks like it should do the job.  Do you have actual
evidence that it doesn't?

-- 
David Kastrup




Information forwarded to bug-auctex <at> gnu.org:
bug#24412; Package auctex. (Mon, 12 Sep 2016 06:10:02 GMT) Full text and rfc822 format available.

Message #11 received at 24412 <at> debbugs.gnu.org (full text, mbox):

From: Piet van Oostrum <piet <at> vanoostrum.org>
To: David Kastrup <dak <at> gnu.org>
Cc: 24412 <at> debbugs.gnu.org
Subject: Re: bug#24412: 11.89; Wrong DocTeX-mode
Date: Mon, 12 Sep 2016 08:09:30 +0200
David Kastrup wrote:

 > Piet van Oostrum <piet <at> vanoostrum.org> writes:
 > 
 > > In AucTeX, latex.el (line 5871) contains:
 > >
 > > (add-to-list 'auto-mode-alist '("\\.dtx\\'" . doctex-mode))
 > >
 > > However, AUCTeX's doctex mode is called docTeX-mode. So the line above causes the standard Emacs doctex-mode to be invoked, rather than AUCTeX's docTeX-mode. This is undesirable.
 > >
 > > The line should be:
 > >
 > > (add-to-list 'auto-mode-alist '("\\.dtx\\'" . docTeX-mode))
 > 
 > Why?  It doesn't change the other modes either.  The point is that they
 > are mapped to the AUCTeX modes on-demand, see
 > 
 > 
 > TeX-modes is a variable defined in ‘tex-site.el’.
 > Its value is
 > (tex-mode plain-tex-mode texinfo-mode latex-mode doctex-mode)
 > 
 > Documentation:
 > List of modes provided by AUCTeX.
 > 
 > This variable can’t be set normally; use customize for that, or
 > set it with ‘TeX-modes-set’.
 > 
 > You can customize this variable.

Oops! That's tricky.
 > 
 > > There is another thing. The documentation of docTeX-mode says:
 > >
 > > "Major mode in AUCTeX for editing .dtx files derived from `LaTeX-mode'.
 > > Runs `LaTeX-mode', sets a few variables and
 > > runs the hooks in `docTeX-mode-hook'."
 > >
 > > However, docTeX-mode-hook is never run.
 > 
 > That's a possible bug.  Let me see.
 > 
 > docTeX-mode is defined with
 > 
 > (define-derived-mode docTeX-mode TeX-latex-mode "docTeX"
 > ...
 > 
 > in latex.el.  The documentation of define-derived-mode states:
 > 
 >     The new mode runs the hook constructed by the function
 >     ‘derived-mode-hook-name’.
 > 
 > which is defined as
 > 
 >     (defsubst derived-mode-hook-name (mode)
 >       "Construct a mode-hook name based on a MODE name."
 >       (intern (concat (symbol-name mode) "-hook")))
 > 
 > Which very much looks like it should do the job.  Do you have actual
 > evidence that it doesn't?

I had put something in docTeX-mode-hook, and I didn't see much evidence of it happening. There was an error in it, but I did not get an error message. However, now you told me this, I looked in *Messages* and I saw the message there. So it seems to work.

Thanks for updating me. You are never too old to learn something new.
 > 
 > -- 
 > David Kastrup

-- 
Piet van Oostrum <piet <at> vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]





Information forwarded to bug-auctex <at> gnu.org:
bug#24412; Package auctex. (Mon, 12 Sep 2016 08:13:02 GMT) Full text and rfc822 format available.

Message #14 received at 24412 <at> debbugs.gnu.org (full text, mbox):

From: David Kastrup <dak <at> gnu.org>
To: Piet van Oostrum <piet <at> vanoostrum.org>
Cc: 24412 <at> debbugs.gnu.org
Subject: Re: bug#24412: 11.89; Wrong DocTeX-mode
Date: Mon, 12 Sep 2016 10:10:11 +0200
Piet van Oostrum <piet <at> vanoostrum.org> writes:

> David Kastrup wrote:
>
>  > TeX-modes is a variable defined in ‘tex-site.el’.
>  > Its value is
>  > (tex-mode plain-tex-mode texinfo-mode latex-mode doctex-mode)
>  > 
>  > Documentation:
>  > List of modes provided by AUCTeX.
>  > 
>  > This variable can’t be set normally; use customize for that, or
>  > set it with ‘TeX-modes-set’.
>  > 
>  > You can customize this variable.
>
> Oops! That's tricky.

Also necessary because if you write

mode: LaTeX

(or any other capitalization) in a file variable block, Emacs will
invariably call latex-mode .

> I had put something in docTeX-mode-hook, and I didn't see much
> evidence of it happening. There was an error in it, but I did not get
> an error message. However, now you told me this, I looked in
> *Messages* and I saw the message there. So it seems to work.
>
> Thanks for updating me. You are never too old to learn something new.

Well, I would not want to rule out any blunder of that kind sitting
around for 10 years or so.  But chances are that somebody might have
caught it at some time.  Don't even remember who did the original
docTeX-mode (or made it useful), probably Ralf.  It's quirky but pretty
useful.

-- 
David Kastrup




Information forwarded to bug-auctex <at> gnu.org:
bug#24412; Package auctex. (Mon, 12 Sep 2016 09:56:02 GMT) Full text and rfc822 format available.

Message #17 received at 24412 <at> debbugs.gnu.org (full text, mbox):

From: Piet van Oostrum <piet <at> vanoostrum.org>
To: David Kastrup <dak <at> gnu.org>
Cc: 24412 <at> debbugs.gnu.org
Subject: Re: bug#24412: 11.89; Wrong DocTeX-mode
Date: Mon, 12 Sep 2016 11:55:19 +0200
David Kastrup wrote:

[...]

 > Also necessary because if you write
 > 
 > mode: LaTeX
 > 
 > (or any other capitalization) in a file variable block, Emacs will
 > invariably call latex-mode .
 > 
I didn't realize that. Not nice.

 > > I had put something in docTeX-mode-hook, and I didn't see much
 > > evidence of it happening. There was an error in it, but I did not get
 > > an error message. However, now you told me this, I looked in
 > > *Messages* and I saw the message there. So it seems to work.
 > >
 > > Thanks for updating me. You are never too old to learn something new.
 > 
 > Well, I would not want to rule out any blunder of that kind sitting
 > around for 10 years or so.  But chances are that somebody might have
 > caught it at some time.  Don't even remember who did the original
 > docTeX-mode (or made it useful), probably Ralf.  It's quirky but pretty
 > useful.

I was tricked into thinking this, because I did C-h m in a dtx buffer, and then clicked on doctex-mode.el there (docTeX/FPS mode defined in ‘tex-mode.el’) and came in the standard TeX mode to my surprise. I just overlooked the :override advice: ‘TeX-doctex-mode’.

But maybe you can answer another question.
I want newline in a dtx buffer to automatically insert the % at the beginning of the line. You have to set TeX-newline-function to an appropriate value. I thought LaTeX-newline would be a good value, but that is not interactive. So I ended up with:
(setq TeX-newline-function #'(lambda () (interactive) (LaTeX-newline)))

Is there a better way? Or would I rather request LaTeX-newline to be made interactive?

With kind regards,
-- 
Piet van Oostrum <piet <at> vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]





Information forwarded to bug-auctex <at> gnu.org:
bug#24412; Package auctex. (Fri, 20 Jan 2017 19:25:02 GMT) Full text and rfc822 format available.

Message #20 received at 24412 <at> debbugs.gnu.org (full text, mbox):

From: Mosè Giordano <mose <at> gnu.org>
To: Piet van Oostrum <piet <at> vanoostrum.org>
Cc: 24412 <at> debbugs.gnu.org, David Kastrup <dak <at> gnu.org>
Subject: Re: bug#24412: 11.89; Wrong DocTeX-mode
Date: Fri, 20 Jan 2017 20:23:43 +0100
Hi Piet,

2016-09-12 11:55 GMT+02:00 Piet van Oostrum <piet <at> vanoostrum.org>:
> I want newline in a dtx buffer to automatically insert the % at the beginning of the line. You have to set TeX-newline-function to an appropriate value. I thought LaTeX-newline would be a good value, but that is not interactive. So I ended up with:
> (setq TeX-newline-function #'(lambda () (interactive) (LaTeX-newline)))
>
> Is there a better way? Or would I rather request LaTeX-newline to be made interactive?

I made `LaTeX-newline' interactive.  Can this ticket be closed now?

Bye,
Mosè




Reply sent to Arash Esbati <arash <at> gnu.org>:
You have taken responsibility. (Mon, 30 May 2022 10:13:02 GMT) Full text and rfc822 format available.

Notification sent to Piet van Oostrum <piet <at> vanoostrum.org>:
bug acknowledged by developer. (Mon, 30 May 2022 10:13:02 GMT) Full text and rfc822 format available.

Message #25 received at 24412-done <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: Mosè Giordano <mose <at> gnu.org>
Cc: 24412-done <at> debbugs.gnu.org, Piet van Oostrum <piet <at> vanoostrum.org>
Subject: Re: bug#24412: 11.89; Wrong DocTeX-mode
Date: Mon, 30 May 2022 12:12:37 +0200
Hi all,

Mosè Giordano <mose <at> gnu.org> writes:

> I made `LaTeX-newline' interactive.  Can this ticket be closed now?

I'm closing this report.  If something is still open, please respond to
this message and we can re-open.

Best, Arash




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 27 Jun 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.