]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve flymake diagnostics list next-error support
authorEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 09:42:21 +0000 (11:42 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 09:42:21 +0000 (11:42 +0200)
lisp/progmodes/flymake.el
lisp/simple.el

index e837dc70b19f99609ab7c608fc2a76f056519e86..dc4033631ccd7a1490182b34fab87db754c08285 100644 (file)
@@ -1865,9 +1865,11 @@ Optional argument ACTION is passed to `display-buffer', which see."
   "Show location of diagnostic at POS.
 POS can be a buffer position or a button"
   (interactive "d" flymake-diagnostics-buffer-mode)
-  (pop-to-buffer
-   (flymake-diagnostics-buffer-show-diagnostic
-    (if (button-type pos) (button-start pos) pos))))
+  (let ((diags-buf (current-buffer)))
+    (pop-to-buffer
+     (flymake-diagnostics-buffer-show-diagnostic
+      (if (button-type pos) (button-start pos) pos)))
+    (next-error-found diags-buf (current-buffer))))
 
 (defun flymake--tabulated-diagnostic-origin (diag)
   (or (flymake-diagnostic-origin diag)
@@ -1983,6 +1985,9 @@ moving."
                     (point-min)
                   flymake-current-diagnostic-pos))
      (forward-line n)
+     (setq overlay-arrow-position
+           (set-marker (or overlay-arrow-position (make-marker))
+                       (line-beginning-position)))
      (setq flymake-current-diagnostic-pos (point)))))
 
 (define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode
@@ -1990,7 +1995,8 @@ moving."
   "A mode for listing Flymake diagnostics."
   :interactive nil
   (setq tabulated-list-format flymake--diagnostics-base-tabulated-list-format
-        tabulated-list-entries 'flymake--diagnostics-buffer-entries)
+        tabulated-list-entries 'flymake--diagnostics-buffer-entries
+        next-error-last-buffer (current-buffer))
   (setq-local next-error-function #'flymake--diagnostics-next-error)
   (tabulated-list-init-header))
 
@@ -2077,7 +2083,6 @@ some of this variable's contents the diagnostic listings.")
         (vconcat [("File" 25 t)]
                  flymake--diagnostics-base-tabulated-list-format))
   (setq tabulated-list-entries 'flymake--project-diagnostics-entries)
-  (setq-local next-error-function #'flymake--diagnostics-next-error)
   (tabulated-list-init-header))
 
 (cl-defun flymake--project-diagnostics (&optional (project (project-current)))
index 9388b7a1553052fd30966c15ee7c44da821c0adb..fcc91910a6eb256058dd9666e1adb97ca8d8accb 100644 (file)
@@ -455,7 +455,7 @@ where `next-error-function' is bound to an appropriate function."
   (interactive
    (list (get-buffer
           (read-buffer "Select next-error buffer: " nil nil
-                       (compf next-error-buffer-p cdr)))))
+                       (compf next-error-buffer-p get-buffer)))))
   (setq next-error-last-buffer buffer))
 
 (defalias 'goto-next-locus 'next-error)