Subject: Re: bug#38058: 12.2; Error triangle doesn't appear at once

From: Ikumi Keita <[email-masked]>
Date: Fri, 06 Dec 2019 17:00:25 +0900

Hi Per, sorry for very late response.

>>>>> [email-masked] (Per Starbäck) writes:
> This happens to me all the time. I've excluded my own emacs
> initializations in the example but then need to load tex-site
> explicitly. I do:

> $ emacs -q --no-site-file -l tex-site /tmp/foo.tex

> where /tmp/foo.tex contains
> ------------------------------
> \documentclass{article}

> \begin{document}
> \error
> \end{document}
> ------------------------------

> Then C-c C-c RET to run LaTeX which yields an error. Now the "error
> triangle" in the toolbar doesn't appear (that is the "Next Error"
> button). I expect it to appear.

Thanks for your report.  The following change addresses the problem
which you described, on my side.  Could you see whether it works for you
as well?

Regards,
Ikumi Keita

diff --git a/tex-buf.el b/tex-buf.el
index 9aaa585c..37047b27 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1134,7 +1134,7 @@ Return the new process."
 	  (setq compilation-in-progress (cons process compilation-in-progress))
 	  process)
       (setq mode-line-process ": run")
-      (set-buffer-modified-p (buffer-modified-p))
+      (force-mode-line-update)
       (sit-for 0)				; redisplay
       (call-process TeX-shell nil buffer nil
 		    TeX-shell-command-option command))))
@@ -1444,7 +1444,7 @@ reasons.  Use `TeX-run-function' instead."
       (apply TeX-sentinel-function nil name nil)
 
       ;; Force mode line redisplay soon
-      (set-buffer-modified-p (buffer-modified-p)))))
+      (force-mode-line-update))))
 
 (defun TeX-command-sentinel (process msg)
   "Process TeX command output buffer after the process dies."
@@ -1480,10 +1480,15 @@ reasons.  Use `TeX-run-function' instead."
 	     ;; If buffer and mode line will show that the process
 	     ;; is dead, we can delete it now.  Otherwise it
 	     ;; will stay around until M-x list-processes.
-	     (delete-process process)
+	     (delete-process process))
+
+	   ;; Force mode line redisplay soon
+	   ;; Do this in the command buffer so that "Next Error" item
+	   ;; will appear in the menu bar just after compilation.
+	   ;; (bug#38058)
+	   (with-current-buffer TeX-command-buffer
+	     (force-mode-line-update)))))
 
-	     ;; Force mode line redisplay soon
-	     (set-buffer-modified-p (buffer-modified-p))))))
   (setq compilation-in-progress (delq process compilation-in-progress)))

@@ -1944,7 +1949,7 @@ command."
   "Format the mode line for a buffer containing output from PROCESS."
     (setq mode-line-process (concat ": "
 				    (symbol-name (process-status process))))
-    (set-buffer-modified-p (buffer-modified-p)))
+    (force-mode-line-update))
 
 (defun TeX-command-filter (process string)
   "Filter to process normal output."
@@ -1963,7 +1968,7 @@ command."
   "Format the mode line for a buffer containing TeX output from PROCESS."
     (setq mode-line-process (concat " " TeX-current-page ": "
 				    (symbol-name (process-status process))))
-    (set-buffer-modified-p (buffer-modified-p)))
+    (force-mode-line-update))
 
 (defun TeX-format-filter (process string)
   "Filter to process TeX output."