Subject: 11.90.2.2017-07-25; Folding displays errors on valid LaTeX

From: Koen van Greevenbroek <[email-masked]>
Date: Wed, 22 Nov 2017 08:55:36 -0800

Hi!

Some valid LaTeX is parsed incorrectly by AUCTeX folding functions
(i.e. 'TeX-fold-region'), and an annoying error is displayed. Here is
an
example:

===========================
\documentclass{beamer}
\begin{document}
\begin{frame}
  \begin{itemize}
  \item \textbf<1>{One}
  \item \textbf<1>{Two}
  \end{itemize}
\end{frame}
\end{document}
===========================

When folded, this code is displayed as follows:

===========================
\documentclass{beamer}
\begin{document}
\begin{frame}
  \begin{itemize}
  * [Error: No content found]<1>{One}
  * [Error: No content found]<2>{Two}
  \end{itemize}
\end{frame}
\end{document}
===========================

Another example, which doesn't involve beamer, is the following code:

===========================
\usepackage{titlesec}
\titleformat{\section}{\bfseries}{\thesection}{10pt}{}[\normalfont]
===========================

which displays as:

===========================
\usepackage{titlesec}
\titleformat{[Error: No content
found]}{\bfseries}{\thesection}{10pt}{}[\normalfont]
===========================

Maybe it would be an idea to just not fold things like this where no
content it found, instead of displaying an error?

Thanks!

Koen

Emacs  : GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.20)
 of 2017-09-11, modified by Debian
Package: 11.90.2.2017-07-25

current state:
==============
(setq
 AUCTeX-date "2017-07-25"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex" "/home/koen/.emacs.d/elpa/auctex-
11.91.0/style" "/home/koen/.emacs.d/auctex/auto"
                  "/home/koen/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 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" 0 1 (idx 0)) "%`%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" 0 1 (idx 1)) "bibtex %s" TeX-run-BibTeX
nil t :help "Run BibTeX")
                    (#("Biber" 0 1 (idx 2)) "biber %s" TeX-run-Biber
nil t :help "Run Biber")
                    (#("View" 0 1 (idx 3)) "%V" TeX-run-discard-or-
function t t :help "Run Viewer")
                    (#("Print" 0 1 (idx 4)) "%p" TeX-run-command t t
:help "Print the file")
                    (#("Queue" 0 1 (idx 5)) "%q" TeX-run-background nil
t :help "View the printer queue" :visible TeX-queue-command)
                    (#("File" 0 1 (idx 6)) "%(o?)dvips %d -o %f " TeX-
run-dvips t t :help "Generate PostScript file")
                    (#("Dvips" 0 1 (idx 7)) "%(o?)dvips %d -o %f " TeX-
run-dvips nil t :help "Convert DVI file to PostScript")
                    (#("Dvipdfmx" 0 1 (idx 8)) "dvipdfmx %d" TeX-run-
dvipdfmx nil t :help "Convert DVI file to PDF with dvipdfmx")
                    (#("Ps2pdf" 0 1 (idx 9)) "ps2pdf %f" TeX-run-ps2pdf
nil t :help "Convert PostScript file to PDF")
                    (#("Glossaries" 0 1 (idx 10)) "makeglossaries %s"
TeX-run-command nil t :help "Run makeglossaries to create glossary
file")
                    (#("Index" 0 1 (idx 11)) "makeindex %s" TeX-run-
index nil t :help "Run makeindex to create index file")
                    (#("upMendex" 0 1 (idx 12)) "upmendex %s" TeX-run-
index t t :help "Run upmendex to create index file")
                    (#("Xindy" 0 1 (idx 13)) "texindy %s" TeX-run-
command nil t :help "Run xindy to create index file")
                    (#("Check" 0 1 (idx 14)) "lacheck %s" TeX-run-
compile nil (latex-mode) :help "Check LaTeX file for correctness")
                    (#("ChkTeX" 0 1 (idx 15)) "chktex -v6 %s" TeX-run-
compile nil (latex-mode) :help "Check LaTeX file for common mistakes")
                    (#("Spell" 0 1 (idx 16)) "(TeX-ispell-document
\"\")" TeX-run-function nil t :help "Spell-check the document")
                    (#("Clean" 0 1 (idx 17)) "TeX-clean" TeX-run-
function nil t :help "Delete generated intermediate files")
                    (#("Clean All" 0 1 (idx 18)) "(TeX-clean t)" TeX-
run-function nil t :help "Delete generated intermediate and output
files")
                    (#("Other" 0 1 (idx 19)) "" TeX-run-command t t
:help "Run an arbitrary command"))
 )