(I hope it is okay to send this patch while my two other patches are
still in review, since it modifies a different file).

The attached patch bundles a few small, related improvements to the
TeX/LaTeX compilation sentinels and TeX-error-overview-mode (I also
modified ConTeXt's sentinel for consistency).

- TeX-error-overview-open-after-TeX-run' can have the value errors', in
  which case TeX-TeX-sentinel, TeX-LaTeX-sentinel and
  TeX-ConTeXt-sentinel will only call TeX-error-overview if there are
  actual errors, rather than for warnings or bad boxes alone.

- To make sure that the user always gets a summary of warnings and
  bad-boxes (even when TeX-error-overview is not shown), the "success"
  message shown by TeX-LaTeX-sentinel is now one of:

   XXX: successfully formatted {29} pages A -- B

  or

   XXX: faced problems formatting {29} pages A -- B

  where 'A' is something like " (with 4 warnings and 5 bad boxes)" and
  'B' is something like "run Biber" or "unresolved citations" (both
  optional, shown only when relevant). TeX-TeX-sentinel's message is
  just "XXX: formatted N pages A".

  The number of warnings and bad boxes in 'A' is only shown when
  `TeX-debug-warnings'/`TeX-debug-bad-boxes' are non-nil, respectively.

- TeX-error-overview-mode's File and Type columns are now sortable.

I have been using these changes for some time now, and I find it much
more pleasant to deal with TeX-error-overview window, so I hope at least
some of these suggestions can be incorporated in AUCTeX.

Best regards,
-- Al
>From 3127d265379480822767e1a4c13857f9e56c3389 Mon Sep 17 00:00:00 2001
From: Al Haji-Ali <[email protected]>
Date: Fri, 24 Jul 2026 11:35:25 +0100
Subject: [PATCH] Change TeX/LaTeX compilation message and error overview

* tex.el (TeX-error-overview-open-after-TeX-run): Add `errors' value
to only open the overview for errors, not warnings.
(TeX-TeX-sentinel, TeX-LaTeX-sentinel): Honor it, and report
warning/bad-box counts in the compilation message when
`TeX-debug-warnings'/`TeX-debug-bad-boxes' are non-nil, respectively.
Gate the compilation-finished hook on `TeX-error-report-has-errors-p'
instead of `TeX-error-list'.
(TeX-error-overview-mode): Make the File and Type columns sortable;
the existing `tabulated-list-mode' bindings (`S', mouse clicks on the
header, and a -1 prefix argument to restore the original order)
apply as-is.
(TeX-error-overview--info): New function.
(TeX-error-overview-type-lessp): New function; sort predicate for the
Type column.
(TeX-error-overview-file-lessp): New function; sort predicate for the
File column.
* context.el (TeX-ConTeXt-sentinel): Likewise honor the new value and
gate the hook on `TeX-error-report-has-errors-p'.
* doc/auctex.texi (TeX-error-overview-open-after-TeX-run): Document
the new value.
---
 NEWS.org        |   7 +
 context.el      |  20 ++-
 doc/auctex.texi |   5 +-
 tex.el          | 401 ++++++++++++++++++++++++++++--------------------
 4 files changed, 259 insertions(+), 174 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 0e41bf26..45685b2d 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -54,10 +54,17 @@
 - Add new function ~preview-dvisvgm-command~ to generate SVG images in
   preview.
 
+- Add support for conditionally opening error overview when there are
+  errors.  See ~TeX-error-overview-open-after-TeX-run~.
+
+- Add support for sorting the error overview by the File or Type
+  column.  Use =S= (or click a column header) to sort, with a prefix
+  argument of -1 to restore the original order.
 ** Changed
 
 - Change the format of the value stored in ~preview-dumped-alist~.  Add
   a new optional argument to the function ~preview-watch-preamble~.
+- Slight change to LaTeX compilation message.
 
 - Respect the value of ~font-latex-fontify-sectioning~ when fontifying
   macros as =slide-title=.  This affects macros provided by
diff --git a/context.el b/context.el
index a154bbcc..923f603f 100644
--- a/context.el
+++ b/context.el
@@ -634,7 +634,9 @@ variable `TeX-parse-all-errors' is non-nil.
 
 Open the error overview if
 `TeX-error-overview-open-after-TeX-run' is non-nil and there are
-errors or warnings to show."
+errors or warnings to show.  If its value is the symbol
+`errors', only open the overview if there are errors (rather
+than warnings)."
 
   (if (TeX-ConTeXt-sentinel-check process name)
       (progn
@@ -646,15 +648,19 @@ errors or warnings to show."
         ;; variables as seen in (TeX-parse-all-errors)).  But for now, ...
         (if TeX-parse-all-errors
             (TeX-parse-all-errors))
-        (if (and (with-current-buffer TeX-command-buffer
-                   TeX-error-overview-open-after-TeX-run)
-                 (TeX-error-overview-make-entries
-                  (TeX-master-directory) (TeX-active-buffer)))
-            (TeX-error-overview)))
+        (let ((has-error (assq 'error TeX-error-list)))
+          (if (and (with-current-buffer TeX-command-buffer
+                     (and TeX-error-overview-open-after-TeX-run
+                          (or (not (eq TeX-error-overview-open-after-TeX-run
+                                       'errors))
+                              has-error)))
+                   (TeX-error-overview-make-entries
+                    (TeX-master-directory) (TeX-active-buffer)))
+              (TeX-error-overview))))
 
     (message (concat name ": formatted " (TeX-current-pages)))
     (setq TeX-command-next TeX-command-Show))
-  (unless TeX-error-list
+  (unless (TeX-error-report-has-errors-p)
     (run-hook-with-args 'TeX-after-compilation-finished-functions
                         (with-current-buffer TeX-command-buffer
                           (expand-file-name
diff --git a/doc/auctex.texi b/doc/auctex.texi
index f92fa112..4846b703 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -4366,9 +4366,10 @@ overview.
 @end deffn
 
 @defopt TeX-error-overview-open-after-TeX-run
-When this boolean variable is non-@code{nil}, the error overview will be
+When this variable is non-@code{nil}, the error overview will be
 automatically opened after running @TeX{} if there are errors or warnings
-to show.
+to show.  If its value is the symbol @code{errors}, the overview is
+opened only if there are errors, rather than warnings.
 @end defopt
 
 The error overview is opened in a new window of the current frame by
diff --git a/tex.el b/tex.el
index 545d30f9..d4691c11 100644
--- a/tex.el
+++ b/tex.el
@@ -8549,27 +8549,61 @@ variable `TeX-parse-all-errors' is non-nil.
 
 Open the error overview if
 `TeX-error-overview-open-after-TeX-run' is non-nil and there are
-errors or warnings to show."
-  (if (TeX-TeX-sentinel-check process name)
-      (progn
-        (if TeX-parse-all-errors
-            (TeX-parse-all-errors))
-        (if (and (with-current-buffer TeX-command-buffer
-                   TeX-error-overview-open-after-TeX-run)
-                 (TeX-error-overview-make-entries
-                  (TeX-master-directory) (TeX-active-buffer)))
-            (TeX-error-overview)))
-    (message (concat name ": formatted " (TeX-current-pages)))
-    (let (dvi2pdf)
-      (if (with-current-buffer TeX-command-buffer
-            (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
-          (setq TeX-command-next dvi2pdf)
-        (setq TeX-command-next TeX-command-Show))))
-  (unless TeX-error-list
-    (run-hook-with-args 'TeX-after-compilation-finished-functions
-                        (with-current-buffer TeX-command-buffer
-                          (expand-file-name
-                           (TeX-active-master (TeX-output-extension)))))))
+errors or warnings to show.  If its value is the symbol
+`errors', only open the overview if there are errors (rather
+than warnings)."
+  (when TeX-parse-all-errors
+    (TeX-parse-all-errors))
+
+  (let ((counts (make-hash-table)))
+    (mapc (lambda (entry)
+            (let ((type (nth 0 entry)))
+              (puthash
+               type
+               (1+ (gethash type counts 0))
+               counts)))
+          TeX-error-list)
+
+    (when (and (with-current-buffer TeX-command-buffer
+                 (and TeX-error-overview-open-after-TeX-run
+                      (or (not (eq TeX-error-overview-open-after-TeX-run
+                                   'errors))
+                          (gethash 'error counts))))
+               (TeX-error-overview-make-entries
+                (TeX-master-directory) (TeX-active-buffer)))
+      (TeX-error-overview))
+
+    (unless (TeX-TeX-sentinel-check process name)
+      (let* ((warnings (and TeX-debug-warnings (gethash 'warning counts)))
+             (bad-boxes (and TeX-debug-bad-boxes (gethash 'bad-box counts)))
+             (add-info (if (or warnings bad-boxes)
+                           (concat " (with "
+                                   (when warnings
+                                     (propertize
+                                      (format "%d warnings" warnings)
+                                      'face
+                                      'TeX-error-description-warning))
+                                   (when (and warnings bad-boxes) " and ")
+                                   (when bad-boxes
+                                     (propertize
+                                      (format "%d bad boxes" bad-boxes)
+                                      'face
+                                      'TeX-error-description-warning))
+                                   ")")
+                         "")))
+        (message (format "%s: formatted %s%s" name (TeX-current-pages)
+                         add-info)))
+      (let (dvi2pdf)
+        (if (with-current-buffer TeX-command-buffer
+              (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+            (setq TeX-command-next dvi2pdf)
+          (setq TeX-command-next TeX-command-Show))))
+
+    (unless (TeX-error-report-has-errors-p)
+      (run-hook-with-args 'TeX-after-compilation-finished-functions
+                          (with-current-buffer TeX-command-buffer
+                            (expand-file-name
+			     (TeX-active-master (TeX-output-extension))))))))
 
 (defun TeX-current-pages ()
   "Return string indicating the number of pages formatted."
@@ -8680,157 +8714,165 @@ variable `TeX-parse-all-errors' is non-nil.
 
 Open the error overview if
 `TeX-error-overview-open-after-TeX-run' is non-nil and there are
-errors or warnings to show."
+errors or warnings to show.  If its value is the symbol
+`errors', only open the overview if there are errors (rather
+than warnings)."
   (if TeX-parse-all-errors
       (TeX-parse-all-errors))
-  (if (and (with-current-buffer TeX-command-buffer
-             TeX-error-overview-open-after-TeX-run)
-           (TeX-error-overview-make-entries
-            (TeX-master-directory) (TeX-active-buffer)))
+
+  (let ((counts (make-hash-table))
+        rerun-msg)
+    (mapc (lambda (entry)
+            (let ((type (nth 0 entry)))
+              (puthash
+               type
+               (1+ (gethash type counts 0))
+               counts)))
+          TeX-error-list)
+
+    (when (and (with-current-buffer TeX-command-buffer
+                 (and TeX-error-overview-open-after-TeX-run
+                      (or (not (eq TeX-error-overview-open-after-TeX-run
+                                   'errors))
+                          (gethash 'error counts))))
+               (TeX-error-overview-make-entries
+                (TeX-master-directory) (TeX-active-buffer)))
       (TeX-error-overview))
-  (cond ((TeX-TeX-sentinel-check process name))
-        ((and (save-excursion
-                (re-search-forward
-                 "^Package biblatex Warning: Please (re)run Biber on the file"
-                 nil t))
-              (with-current-buffer TeX-command-buffer
-                (and (LaTeX-bibliography-list)
-                     (TeX-check-files (TeX-master-file "bbl")
-                                      (TeX-style-list)
-                                      (append TeX-file-extensions
-                                              BibTeX-file-extensions
-                                              TeX-Biber-file-extensions)))))
-         (message "%s%s" "You should run Biber to get citations right, "
-                  (TeX-current-pages))
-         (setq TeX-command-next (with-current-buffer TeX-command-buffer
-                                  TeX-command-Biber)))
-        ((and (save-excursion
-                (re-search-forward
-                 "^\\(?:LaTeX\\|Package natbib\\) Warning: Citation" nil t))
+
+    (setq TeX-command-next nil)
+    (unless (TeX-TeX-sentinel-check process name)
+      (cond
+       ((and (save-excursion
+               (re-search-forward
+                "^Package biblatex Warning: Please (re)run Biber on the file"
+                nil t))
+             (with-current-buffer TeX-command-buffer
+               (and (LaTeX-bibliography-list)
+                    (TeX-check-files (TeX-master-file "bbl")
+                                     (TeX-style-list)
+                                     (append TeX-file-extensions
+                                             BibTeX-file-extensions
+                                             TeX-Biber-file-extensions)))))
+        (setq rerun-msg "run Biber")
+        (setq TeX-command-next
               (with-current-buffer TeX-command-buffer
-                (and (LaTeX-bibliography-list)
-                     (TeX-check-files (TeX-master-file "bbl")
-                                      (TeX-style-list)
-                                      (append TeX-file-extensions
-                                              BibTeX-file-extensions
-                                              TeX-Biber-file-extensions)))))
-         (message "%s%s" "You should run BibTeX to get citations right, "
-                  (TeX-current-pages))
-         (setq TeX-command-next (with-current-buffer TeX-command-buffer
-                                  TeX-command-BibTeX)))
-        ((re-search-forward "Package biblatex Warning: Please rerun LaTeX" nil t)
-         (message "%s%s" "You should run LaTeX again, " (TeX-current-pages))
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward "^(biblatex)\\W+Page breaks have changed" nil t)
-         (message "%s%s" "You should run LaTeX again - page breaks have changed, "
-                  (TeX-current-pages))
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward "^\\(?:LaTeX Warning: Label(s)\\|\
+                TeX-command-Biber)))
+       ((and (save-excursion
+               (re-search-forward
+                "^\\(?:LaTeX\\|Package natbib\\) Warning: Citation" nil t))
+             (with-current-buffer TeX-command-buffer
+               (and (LaTeX-bibliography-list)
+                    (TeX-check-files (TeX-master-file "bbl")
+                                     (TeX-style-list)
+                                     (append TeX-file-extensions
+                                             BibTeX-file-extensions
+                                             TeX-Biber-file-extensions)))))
+        (setq rerun-msg "run BibTeX")
+        (setq TeX-command-next (with-current-buffer TeX-command-buffer
+                                 TeX-command-BibTeX)))
+       ((re-search-forward "Package biblatex Warning: Please rerun LaTeX" nil t)
+        (setq rerun-msg "run LaTeX")
+        (setq TeX-command-next TeX-command-default))
+       ((re-search-forward "^(biblatex)\\W+Page breaks have changed" nil t)
+        (setq rerun-msg "rerun LaTeX for page breaks")
+        (setq TeX-command-next TeX-command-default))
+       ((re-search-forward "^\\(?:LaTeX Warning: Label(s)\\|\
 Package natbib Warning: Citation(s)\\)" nil t)
-         (message "%s%s" "You should run LaTeX again to get references right, "
-                  (TeX-current-pages))
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward
-          "^\\(?:(rerunfilecheck)\\|Package hyperref Warning:\\)\\W+\
+        (setq rerun-msg "rerun LaTeX for references")
+        (setq TeX-command-next TeX-command-default))
+       ((re-search-forward
+         "^\\(?:(rerunfilecheck)\\|Package hyperref Warning:\\)\\W+\
 Rerun to get outlines right" nil t)
-         (message "%s%s" "You should run LaTeX again to get outlines right, "
-                  (TeX-current-pages))
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward "^LaTeX Warning: Reference" nil t)
-         (message "%s%s%s" name ": there were unresolved references, "
-                  (TeX-current-pages))
-         (let (dvi2pdf)
-           (if (with-current-buffer TeX-command-buffer
-                 (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
-               (setq TeX-command-next dvi2pdf)
-             (setq TeX-command-next TeX-command-Show))))
-        ((re-search-forward "^\\(?:LaTeX Warning: Citation\\|\
+        (setq rerun-msg "rerun LaTeX for outlines")
+        (setq TeX-command-next TeX-command-default))
+       ((re-search-forward "^LaTeX Warning: Reference" nil t)
+        (setq rerun-msg "unresolved references"))
+       ((re-search-forward "^\\(?:LaTeX Warning: Citation\\|\
 Package natbib Warning:.*undefined citations\\)" nil t)
-         (message "%s%s%s" name ": there were unresolved citations, "
-                  (TeX-current-pages))
-         (let (dvi2pdf)
-           (if (with-current-buffer TeX-command-buffer
-                 (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
-               (setq TeX-command-next dvi2pdf)
-             (setq TeX-command-next TeX-command-Show))))
-        ((re-search-forward "^No file .*\\.\\(toc\\|lof\\|lot\\)\\.$" nil t)
-         (message "%s" (concat "You should run LaTeX again to get "
-                               (upcase (match-string-no-properties 1))
-                               " right"))
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward "Package longtable Warning: Table widths have \
+        (setq rerun-msg "unresolved citations"))
+       ((re-search-forward "^No file .*\\.\\(toc\\|lof\\|lot\\)\\.$" nil t)
+        (setq rerun-msg (concat "run LaTeX for "
+                                (upcase (match-string-no-properties 1))))
+        (setq TeX-command-next TeX-command-default))
+       ((re-search-forward "Package longtable Warning: Table widths have \
 changed\\. Rerun LaTeX\\." nil t)
-         (message
-          "%s" "You should run LaTeX again to get table formatting right")
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward "^hf-TikZ Warning: Mark '.*' changed\\. \
+        (setq rerun-msg "rerun LaTeX for table formatting")
+        (setq TeX-command-next TeX-command-default))
+       ((re-search-forward "^hf-TikZ Warning: Mark '.*' changed\\. \
 Rerun to get mark in right position\\." nil t)
-         (message
-          "%s" "You should run LaTeX again to get TikZ marks in right position")
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward "^Package Changebar Warning: \
+        (setq rerun-msg "rerun LaTeX for TikZ marks")
+        (setq TeX-command-next TeX-command-default))
+       ((re-search-forward "^Package Changebar Warning: \
 Changebar info has changed." nil t)
-         (message
-          "%s" "You should run LaTeX again to get the change bars right")
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward "^LaTeX Warning: Endnotes may have changed. \
-Rerun to get them right" nil t)
-         (message
-          "%s" "You should run LaTeX again to get the endnotes right")
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward "^\\* xsim warning: \"rerun\"" nil t)
-         (message
-          "%s" "You should run LaTeX again to synchronize exercise properties")
-         (setq TeX-command-next TeX-command-default))
-        ((re-search-forward
-          TeX-LaTeX-sentinel-banner-regexp nil t)
-         (let* ((warnings (and TeX-debug-warnings
-                               (TeX-LaTeX-sentinel-has-warnings)))
-                (bad-boxes (and TeX-debug-bad-boxes
-                                (TeX-LaTeX-sentinel-has-bad-boxes)))
-                (add-info (when (or warnings bad-boxes)
-                            (concat " (with "
-                                    (when warnings "warnings")
-                                    (when (and warnings bad-boxes) " and ")
-                                    (when bad-boxes "bad boxes")
-                                    ")"))))
-           (message "%s" (concat name ": successfully formatted "
-                                 (TeX-current-pages) add-info)))
-         (let (dvi2pdf)
-           (if (with-current-buffer TeX-command-buffer
-                 (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
-               (setq TeX-command-next dvi2pdf)
-             (setq TeX-command-next TeX-command-Show))))
-        (t
-         (message "%s%s%s" name ": problems after " (TeX-current-pages))
-         (setq TeX-command-next TeX-command-default)))
-
-  ;; Check whether the idx file changed.
-  (let (idx-file)
-    (and (file-exists-p
-          (setq idx-file
-                (with-current-buffer TeX-command-buffer
-                  (expand-file-name (TeX-active-master "idx")))))
-         ;; imakeidx package automatically runs makeindex, thus, we need to be
-         ;; sure .ind file isn't newer than .idx.
-         (TeX-check-files (with-current-buffer TeX-command-buffer
-                            (expand-file-name (TeX-active-master "ind")))
+        (setq rerun-msg "rerun LaTeX for endnotes")
+        (setq TeX-command-next TeX-command-default))
+       ((re-search-forward "^\\* xsim warning: \"rerun\"" nil t)
+        (setq rerun-msg "rerun LaTeX for exercise properties")
+        (setq TeX-command-next TeX-command-default)))
+
+      (let* ((warnings (and TeX-debug-warnings (gethash 'warning counts)))
+             (bad-boxes (and TeX-debug-bad-boxes (gethash 'bad-box counts)))
+             (add-info (if (or warnings bad-boxes)
+                           (concat " (with "
+                                   (when warnings
+                                     (propertize
+                                      (format "%d warnings" warnings)
+                                      'face
+                                      'TeX-error-description-warning))
+                                   (when (and warnings bad-boxes) " and ")
+                                   (when bad-boxes
+                                     (propertize
+                                      (format "%d bad boxes" bad-boxes)
+                                      'face
+                                      'TeX-error-description-warning))
+                                   ")")
+                         ""))
+             (msg (format "%s: %%s %s%s%s"
+                          name
+                          (TeX-current-pages)
+                          add-info
+                          (if rerun-msg
+                              (concat " -- " rerun-msg)
+                            ""))))
+        (if (re-search-forward TeX-LaTeX-sentinel-banner-regexp nil t)
+            (progn
+              (message msg "successfully formatted")
+              (unless TeX-command-next
+                (let (dvi2pdf)
+                  (if (with-current-buffer TeX-command-buffer
+                        (and TeX-PDF-mode (setq dvi2pdf (TeX-PDF-from-DVI))))
+                      (setq TeX-command-next dvi2pdf)
+                    (setq TeX-command-next TeX-command-Show)))))
+          (message msg "faced problems formatting")
+          (unless TeX-command-next
+            (setq TeX-command-next TeX-command-default)))))
+
+    ;; Check whether the idx file changed.
+    (let (idx-file)
+      (and (file-exists-p
+            (setq idx-file
+                  (with-current-buffer TeX-command-buffer
+                    (expand-file-name (TeX-active-master "idx")))))
+           ;; imakeidx package automatically runs makeindex, thus, we need to be
+           ;; sure .ind file isn't newer than .idx.
+           (TeX-check-files (with-current-buffer TeX-command-buffer
+                              (expand-file-name (TeX-active-master "ind")))
+                            (with-current-buffer TeX-command-buffer
+                              (list (file-name-nondirectory (TeX-active-master))))
+                            '("idx"))
+           (with-temp-buffer
+             (insert-file-contents-literally idx-file)
+             (not (equal
+                   ;; Compare old md5 hash of the idx file with the new one.
+                   (cdr (assoc idx-file LaTeX-idx-md5-alist))
+                   (md5 (current-buffer)))))
+           (push (cons idx-file t) LaTeX-idx-changed-alist)))
+
+    (unless (TeX-error-report-has-errors-p)
+      (run-hook-with-args 'TeX-after-compilation-finished-functions
                           (with-current-buffer TeX-command-buffer
-                            (list (file-name-nondirectory (TeX-active-master))))
-                          '("idx"))
-         (with-temp-buffer
-           (insert-file-contents-literally idx-file)
-           (not (equal
-                 ;; Compare old md5 hash of the idx file with the new one.
-                 (cdr (assoc idx-file LaTeX-idx-md5-alist))
-                 (md5 (current-buffer)))))
-         (push (cons idx-file t) LaTeX-idx-changed-alist)))
-
-  (unless (TeX-error-report-has-errors-p)
-    (run-hook-with-args 'TeX-after-compilation-finished-functions
-                        (with-current-buffer TeX-command-buffer
-                          (expand-file-name
-                           (TeX-active-master (TeX-output-extension)))))))
+                            (expand-file-name
+                             (TeX-active-master (TeX-output-extension))))))))
 
 ;; should go into latex.el? --pg
 (defun TeX-BibTeX-sentinel (_process _name)
@@ -10547,13 +10589,40 @@ forward, if negative)."
 (defvar TeX-error-overview-list-entries nil
   "List of errors to be used in the error overview.")
 
+(defun TeX-error-overview--info (entry)
+  "Return the raw `TeX-error-list' entry for tabulated-list ENTRY.
+ENTRY's ID is the entry's index into `TeX-error-list', as set up by
+`TeX-error-overview-make-entries'."
+  (with-current-buffer TeX-error-overview-active-buffer
+    (nth (car entry) TeX-error-list)))
+
+(defun TeX-error-overview-type-lessp (entry1 entry2)
+  "Sort predicate for the Type column of `TeX-error-overview-mode'.
+Errors rank before warnings, which rank before bad boxes.
+Return non-nil if ENTRY1 should sort before ENTRY2."
+  (let ((rank '((error . 0) (warning . 1) (bad-box . 2))))
+    (< (or (cdr (assq (nth 0 (TeX-error-overview--info entry1)) rank)) 3)
+       (or (cdr (assq (nth 0 (TeX-error-overview--info entry2)) rank)) 3))))
+
+(defun TeX-error-overview-file-lessp (entry1 entry2)
+  "Sort predicate for the File column of `TeX-error-overview-mode'.
+Sort by file name, breaking ties by line number.
+Return non-nil if ENTRY1 should sort before ENTRY2."
+  (let* ((info1 (TeX-error-overview--info entry1))
+         (info2 (TeX-error-overview--info entry2))
+         (file1 (or (nth 1 info1) ""))
+         (file2 (or (nth 1 info2) "")))
+    (if (string= file1 file2)
+        (< (or (nth 2 info1) 0) (or (nth 2 info2) 0))
+      (string< file1 file2))))
+
 (define-derived-mode TeX-error-overview-mode tabulated-list-mode
                      "TeX errors"
   "Major mode for listing TeX errors."
   :syntax-table nil :abbrev-table nil :interactive nil
-  (setq tabulated-list-format [("File" 25 nil)
+  (setq tabulated-list-format [("File" 25 TeX-error-overview-file-lessp)
                                ("Line" 4 nil :right-align t)
-                               ("Type" 7 nil)
+                               ("Type" 7 TeX-error-overview-type-lessp)
                                ("Message" 0 nil)]
         tabulated-list-padding 1
         tabulated-list-entries TeX-error-overview-list-entries)
@@ -10580,9 +10649,11 @@ forward, if negative)."
              (tool-bar-lines integer)))
 
 (defcustom TeX-error-overview-open-after-TeX-run nil
-  "Whether to open automatically the error overview after running TeX."
+  "Whether to open automatically the error overview after running TeX.
+If it has the value \\='errors, then only open the overview if
+there are errors (rather than warnings)."
   :group 'TeX-output
-  :type 'boolean)
+  :type (or 'boolean 'symbol))
 
 (defun TeX-error-overview ()
   "Show an overview of the errors occurred in the last TeX run."
-- 
2.50.1 (Apple Git-155)

_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex
  • bug#81469: 14.1.0... Al Haji-Ali

Reply via email to