]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix problem with next-error-message-highlight in *Occur*
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 15 Oct 2020 07:17:45 +0000 (09:17 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 15 Oct 2020 07:17:45 +0000 (09:17 +0200)
* lisp/simple.el (next-error-message-highlight): This function is
called directly, so clean up the code a bit (bug#32676).
(next-error-found): Pass in the error buffer.

lisp/simple.el

index a24f2844aa3e92079e77e8f30ec64356613bb2dd..bd19969341f36844017836ed60721186ba1edf89 100644 (file)
@@ -393,7 +393,7 @@ and TO-BUFFER is a target buffer."
   (when next-error-recenter
     (recenter next-error-recenter))
   (funcall next-error-found-function from-buffer to-buffer)
-  (next-error-message-highlight)
+  (next-error-message-highlight from-buffer)
   (run-hooks 'next-error-hook))
 
 (defun next-error-select-buffer (buffer)
@@ -478,20 +478,18 @@ buffer causes automatic display of the corresponding source code location."
          (next-error-no-select 0))
       (error t))))
 
-(defun next-error-message-highlight ()
+(defun next-error-message-highlight (error-buffer)
   "Highlight the current error message in the ‘next-error’ buffer."
   (when next-error-message-highlight
-    (with-current-buffer next-error-last-buffer
+    (with-current-buffer error-buffer
       (when next-error--message-highlight-overlay
         (delete-overlay next-error--message-highlight-overlay))
-      (save-excursion
-        (goto-char compilation-current-error)
-        (let ((ol (make-overlay (line-beginning-position) (line-end-position))))
-          ;; do not override region highlighting
-          (overlay-put ol 'priority -50)
-          (overlay-put ol 'face 'next-error-message)
-          (overlay-put ol 'window (get-buffer-window))
-          (setf next-error--message-highlight-overlay ol))))))
+      (let ((ol (make-overlay (line-beginning-position) (line-end-position))))
+        ;; do not override region highlighting
+        (overlay-put ol 'priority -50)
+        (overlay-put ol 'face 'next-error-message)
+        (overlay-put ol 'window (get-buffer-window))
+        (setf next-error--message-highlight-overlay ol)))))
 
 \f
 ;;;