GNU bug report logs - #64921
13.2.1; Infinite loop in LaTeX-arg-biblatex-cites with RefTeX

Previous Next

Package: auctex;

Reported by: Gustavo Barros <gusbrs.2016 <at> gmail.com>

Date: Fri, 28 Jul 2023 20:13:02 UTC

Severity: normal

Found in version 13.2.1

Done: Ikumi Keita <ikumi <at> ikumi.que.jp>

Bug is archived. No further changes may be made.

Full log


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

From: Gustavo Barros <gusbrs.2016 <at> gmail.com>
To: bug-auctex <at> gnu.org
Subject: 13.2.1; Infinite loop in LaTeX-arg-biblatex-cites with RefTeX
Date: Fri, 28 Jul 2023 17:11:50 -0300
Hi All,

I might be missing something obvious on this one, but I couldn't
figure out a way to do it and as far as I understand the code, I see
no way to break the loop in `LaTeX-arg-biblatex-cites'.  So I report.

When RefTeX is plugged into AUCTeX, trying to insert a `biblatex'
citation list with `TeX-insert-macro' will call
`LaTeX-arg-biblatex-cites' and, as far as I can tell, there is no way
to tell that function no further arguments are required.  For sure,
one can interrupt the cycle from the call to `reftex-citation' with
"C-g" or "q", but then one also loses the citation altogether making
the attempt futile.

To reproduce starting with `emacs -Q'.  Some setup:

#+begin_src emacs-lisp
(add-to-list 'load-path "~/.emacs.d/elpa/auctex-13.2.1")
(load "auctex.el" nil t t)
(load "reftex.el" nil t t)
(setq TeX-parse-self t)
(setq TeX-auto-save t)
(setq reftex-plug-into-AUCTeX t)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-use-external-file-finders t)
#+end_src

Visit a file with contents:

#+begin_src latex
\documentclass{article}

\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}

\end{document}
#+end_src

Now, use `TeX-insert-macro' to insert a biblatex qualified citation
list, say `\cites': "C-c RET cites RET".  You are prompted for a
regexp, as usual, you can enter it, get a list of results, select one
with RET.  And, you are prompted again for a new regexp, you can enter
it and select a new candidate, etc. etc.  The only chance you get to
break the loop is at the regexp prompt, where you can leave it with
"C-g" or "q", but then you lose the whole citation command, which is
deleted.

Indeed, the loop in `LaTeX-arg-biblatex-cites' takes the form:

#+begin_src emacs-lisp
(while items
  ;; ... handling of optional arguments
  (setq items (if (and (fboundp 'reftex-citation)
                       (fboundp 'reftex-plug-flag)
                       (reftex-plug-flag 3))
                  ;; Use RefTeX when enabled.
                  (reftex-citation t)
                ;; Multiple citation keys in each argument are allowed.
                (TeX-completing-read-multiple
                 (TeX-argument-prompt optional prompt "Key(s)")
                 (LaTeX-bibitem-list))))
  ;; ... macro/argument is inserted, but value of `items' is left untouched
  )
#+end_src

So, since `items' is not touched after it is set with
`(reftex-citation t)', leaving the loop would require a way for
`reftex-citation's UI to return nil.  I don't see how.  But, again, I
may be missing something...

Best regards,
Gustavo.



Emacs  : GNU Emacs 29.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0)
 of 2023-07-23
Package: 13.2.1

current state:
==============
(setq
 AUCTeX-date "2023-07-20"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex"
"/home/gustavo/.emacs.d/elpa/auctex-13.2.1/style"
          "/home/gustavo/.emacs.d/auctex/auto"
"/home/gustavo/.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)%' %(output-dir) %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) %(o-dir) %t"
TeX-run-compile nil (texinfo-mode) :help
             "Run Makeinfo with Info output")
            ("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) --html
%t" TeX-run-compile nil (texinfo-mode)
             :help "Run Makeinfo with HTML output")
            ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%'
%(output-dir) %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 %(O?aux)" TeX-run-BibTeX nil
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode context-mode) :help
             "Run BibTeX")
            ("Biber" "biber %(output-dir) %s" TeX-run-Biber nil
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :help "Run Biber")
            ("Texindex" "texindex %s.??" TeX-run-command nil
(texinfo-mode) :help "Run Texindex")
            ("Texi2dvi" "%(PDF)texi2dvi %t" TeX-run-command nil
(texinfo-mode) :help
             "Run Texi2dvi or Texi2pdf")
            ("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
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :help
             "Generate PostScript file")
            ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :help
             "Convert DVI file to PostScript")
            ("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" TeX-run-dvipdfmx nil
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :help
             "Convert DVI file to PDF with dvipdfmx")
            ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :help
             "Convert PostScript file to PDF")
            ("Glossaries" "makeglossaries %(d-dir) %s" TeX-run-command nil
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :help
             "Run makeglossaries to create glossary file")
            ("Index" "makeindex %(O?idx)" TeX-run-index nil
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :help
             "Run makeindex to create index file")
            ("upMendex" "upmendex %(O?idx)" TeX-run-index t
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :help
             "Run upmendex to create index file")
            ("Xindy" "texindy %s" TeX-run-command nil
             (plain-tex-mode latex-mode doctex-mode ams-tex-mode
texinfo-mode) :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"))
 )




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

Previous Next


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