GNU bug report logs - #79037
14.0.9; Fixing infinite loop with `TeX-previous-error'

Previous Next

Package: auctex;

Reported by: bram.adams <at> queensu.ca

Date: Thu, 17 Jul 2025 11:06:01 UTC

Severity: normal

Found in version 14.0.9

Full log


View this message in rfc822 format

From: Arash Esbati <arash <at> gnu.org>
To: bram.adams <at> queensu.ca
Cc: 79037 <at> debbugs.gnu.org
Subject: bug#79037: 14.0.9; Fixing infinite loop with `TeX-previous-error'
Date: Fri, 18 Jul 2025 11:15:43 +0200
Hi Bram,

bram.adams <at> queensu.ca writes:

> When `TeX-debug-warnings' and `TeX-suppress-ignored-warnings' are
> enabled, invoking `TeX-previous-error' can lead to an infinite loop in
> `TeX-parse-TeX'. As the `unless' condition always fails, `arg' is
> never incremented to 0, hence the value of `TeX-error-last-visited'
> decrements forever. There are no issues when invoking
> `TeX-next-error'.
>
> The attached patch seems to fix this bug with `TeX-previous-error'.
> [...]
> diff --git a/tex.el b/tex.el
> index 5a3345a..8f00bbc 100644
> --- a/tex.el
> +++ b/tex.el
> @@ -9491,13 +9491,16 @@ already in an Emacs buffer) and the cursor is placed at the error."
>                        (1- TeX-error-last-visited))
>                      item (nth TeX-error-last-visited TeX-error-list))
>                ;; Increase or decrease `arg' only if the warning isn't to be
> -              ;; skipped.
> -              (unless (TeX-error-list-skip-warning-p (nth 0 item) (nth 10 item))
> -                ;; Note: `signum' is a function from `cl' library, do not be
> -                ;; tempted to use it.
> -                (setq arg (if (> arg 0)
> -                              (1- arg)
> -                            (1+ arg)))))
> +              ;; skipped, or `TeX-error-last-visited' has dropped below 0
> +              ;; with a negative `arg'.
> +              (if (or (and (< arg 0)
> +                           (< TeX-error-last-visited 0))
> +                      (not (TeX-error-list-skip-warning-p (nth 0 item) (nth 10 item))))
> +                  ;; Note: `signum' is a function from `cl' library, do not be
> +                  ;; tempted to use it.
> +                  (setq arg (if (> arg 0)
> +                                (1- arg)
> +                              (1+ arg)))))
>              (if (< TeX-error-last-visited -1)
>                  (setq TeX-error-last-visited -1))
>              (cond ((or (null item)

Thanks for the report and the patch.  Is it possible for you to assemble
a small .tex file and an exact recipe how to trigger the inf-loop with
that .tex file?  I trust your analysis is correct, but like to
understand it better before installing it.  TIA.

Best, Arash




This bug report was last modified 21 days ago.

Previous Next


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