GNU bug report logs - #32062
12.1.1; LaTeX-outline-name can't handle long lines or braces in titles

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: auctex; Reported by: Omar <omar.antolin@HIDDEN>; dated Thu, 5 Jul 2018 17:01:02 UTC; Maintainer for auctex is bug-auctex@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Jul 2018 17:00:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 05 13:00:16 2018
Received: from localhost ([127.0.0.1]:47959 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fb7c7-0000dX-R4
	for submit <at> debbugs.gnu.org; Thu, 05 Jul 2018 13:00:16 -0400
Received: from eggs.gnu.org ([208.118.235.92]:52479)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <omar.antolin@HIDDEN>) id 1fb7c6-0000dK-2C
 for submit <at> debbugs.gnu.org; Thu, 05 Jul 2018 13:00:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <omar.antolin@HIDDEN>) id 1fb7bw-0000GW-Le
 for submit <at> debbugs.gnu.org; Thu, 05 Jul 2018 13:00:08 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:42875)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <omar.antolin@HIDDEN>)
 id 1fb7bw-0000GJ-IN
 for submit <at> debbugs.gnu.org; Thu, 05 Jul 2018 13:00:04 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:43416)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <omar.antolin@HIDDEN>) id 1fb7bu-00087o-U9
 for bug-auctex@HIDDEN; Thu, 05 Jul 2018 13:00:04 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <omar.antolin@HIDDEN>) id 1fb7bq-0000BP-12
 for bug-auctex@HIDDEN; Thu, 05 Jul 2018 13:00:03 -0400
Received: from mail-oi0-x22b.google.com ([2607:f8b0:4003:c06::22b]:46488)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <omar.antolin@HIDDEN>)
 id 1fb7bp-0000B5-Qa
 for bug-auctex@HIDDEN; Thu, 05 Jul 2018 12:59:57 -0400
Received: by mail-oi0-x22b.google.com with SMTP id y207-v6so18189948oie.13
 for <bug-auctex@HIDDEN>; Thu, 05 Jul 2018 09:59:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=vt/87SqiS1FRbOEgIPD1N8Sw/pFiDdjZ8uPvrKXotiw=;
 b=myU+dzCN9JfTljJzDva5o2ArUMfVLIDnB8bFQIJJvy3RtQaD7j/BNJ5/8StUWRdQpa
 4PUjnoNmpyS3kgPiG4/wMmfXtp9fT5ROCj8hCgKV0p6hn6Gh1Pcq63fTtgCGvxg4b5xA
 e5KaY3hDBYBVA+JV9xqGje0zMf1eWJ5cQOHQxaPIn/MaNV3Y+7EvASGXBGXrTe8qu5Sr
 GYroHQkZytZMmPPiC3mghIRch3vuKTE/gQTL85EBQGJUcO9a9PkA8jGq7K2osI+Nv5n9
 7dFqjGFeg6nibYs9Wt9lseCO7iccK/itiSDbPGlv4b9vlc6qDAVaTVQLPc4QQQ14Sz1Q
 TGiQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=vt/87SqiS1FRbOEgIPD1N8Sw/pFiDdjZ8uPvrKXotiw=;
 b=opdmEbd7EX5CxAdR7ZJkUXe5pxHcZ4+rQD7OiURZDsAn9HX7ti65tatDOYO5dEutQN
 UhdINVR4lJjnLE7i0RP6cSGCQQyfY9S+kBYE+DbqqUZZnx2cu6xDWmy2BBwOF6yhLHbv
 uweOUtrWbmoL75ZrHoBRAxWf1vOcJF0gWgIeUc3U4h5SMg0KC01Ru2jLcbULRTzeBu5z
 PXLHlVJMN32hZU9yRmebrk3YMN5H64DBa/3egF3rkkGSAjNnMdfn13MpClnS6mw0Y6zH
 z/yftqvZYYUVd8QbL3DH9KPs8qWtEiy5U1owWwrXWjt3UF7Aqk4N1PWSc94dT7JTvKts
 eKKg==
X-Gm-Message-State: APt69E2CXtRv1SSvgb1MwpGF/crFrhN5tQRW+VDnGAm3gOvOMbm/hSvK
 Ut2MUxRvYvpMQSlz9i+lFiqSFw==
X-Google-Smtp-Source: AAOMgpfo4yTDj2na9kgBncjkaMZawZPDPhjZTUksVngut6Pcp85ArGUp/oe4jSpcRsyfxmalwLBbsA==
X-Received: by 2002:aca:5583:: with SMTP id
 j125-v6mr8016308oib.2.1530809996600; 
 Thu, 05 Jul 2018 09:59:56 -0700 (PDT)
Received: from yayayano ([189.146.250.38])
 by smtp.gmail.com with ESMTPSA id 203-v6sm8832841oic.28.2018.07.05.09.59.54
 for <bug-auctex@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 05 Jul 2018 09:59:55 -0700 (PDT)
From: Omar <omar.antolin@HIDDEN>
To: bug-auctex@HIDDEN
Subject: 12.1.1; LaTeX-outline-name can't handle long lines or braces in titles
Date: Thu, 05 Jul 2018 11:59:53 -0500
Message-ID: <87y3epehyu.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)


Hello,

I noticed recently that imenu lists the names of section titles incorrectly under AucTeX, while it gives the titles I'd expect under Emacs' builtin tex-mode.el.

I narrowed down the problem to LaTeX-outline-name which gives the wrong answer in two situations:

1. If the section (or subsection, etc.) title is very long, namely, if it ends in a column greater than fill-column plus 10, then LaTeX-outline-name reports the title as the first 20 characters in the line. This is particularly ugly since it means the title will start with "\section{" or somehting like that.

2. If the title contains a right brace, LaTeX-outline-name reports the title as ending at that brace.

This small document illustrates both problems:

\documentclass{article}
\begin{document}
\section{A title so utterly long that it exceeds the fill column by more than ten characters}
\section{Braces \emph{screw} this one up}
\end{document}

If fill-column is set to a reasonable value, the first section is too long and gets listed in imenu as "\section{A title so ". The second one gets truncated at the right brace: "\section{Braces \emph{screw".

The builtin tex-mode uses forward-sexp to allow balanced braces inside the section titles. In my personal configuration I've replace LaTeX-outline-name with:

(defun LaTeX-outline-name ()
  "Guess a name for the current header line."
  (save-excursion
    (search-forward "{" nil t)
    (let ((beg (point)))
      (forward-char -1)
      (condition-case nil
          (progn
            (forward-sexp 1)
            (forward-char -1))
          (error (forward-sentence 1)))
      (buffer-substring beg (point)))))

This attempts to skip over the title using forward-sexp and in case of error uses forward-sentence instead. It seems to work on the files I noticed had a problem before, but I haven't done extensive testing.

Emacs  : GNU Emacs 25.3.2 (i686-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2017-09-12
Package: 12.1.1

current state:
==============
(setq
 AUCTeX-date "2018-03-20"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex"
                  "/home/omar/.emacs.d/elpa/auctex-12.1.1/style" "/home/omar/.emacs.d/auctex/auto" "/home/omar/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save nil
 TeX-parse-self nil
 TeX-master t
 TeX-command-list '(("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")
                    ("Glossaries" "makeglossaries %s"
                     TeX-run-command nil t :help
                     "Run makeglossaries to create glossary file")
                    ("Index" "makeindex %s"
                     TeX-run-index nil t :help
                     "Run makeindex to create index file")
                    ("upMendex" "upmendex %s"
                     TeX-run-index t t :help
                     "Run upmendex 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")
                    )
 )




Acknowledgement sent to Omar <omar.antolin@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-auctex@HIDDEN. Full text available.
Report forwarded to bug-auctex@HIDDEN:
bug#32062; Package auctex. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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