[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64921: 13.2.1; Infinite loop in LaTeX-arg-biblatex-cites with RefTeX

From: Ikumi Keita
Subject: bug#64921: 13.2.1; Infinite loop in LaTeX-arg-biblatex-cites with RefTeX
Date: Sat, 12 Aug 2023 14:20:52 +0900

Hi Gustavo, sorry for late reply.

>>>>> Gustavo Barros <gusbrs.2016@gmail.com> writes:
> 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.

I can confirm the reported behavior.

> 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...

Your analysis seems right. I don't come up with a good solution yet.
However, most users would type C-c [ to use `reftex-citation' directly,
which works without the reported issue. Thus I expect the importance
of this bug is low enough.

If it doesn't actually harm users, "won'tfix" would be a suitable
treatment to this bug. What do you think?

Ikumi Keita
#StandWithUkraine #StopWarInUkraine

reply via email to

[Prev in Thread] Current Thread [Next in Thread]