From: Eshel Yaron Date: Sat, 10 May 2025 09:42:21 +0000 (+0200) Subject: Improve flymake diagnostics list next-error support X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f5265eb7f8465ddb9078d59a8165dba1dd716951;p=emacs.git Improve flymake diagnostics list next-error support --- diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index e837dc70b19..dc4033631cc 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -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))) diff --git a/lisp/simple.el b/lisp/simple.el index 9388b7a1553..fcc91910a6e 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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)