]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/flymake.el: Small improvements for buffers display.
authorJuri Linkov <juri@linkov.net>
Mon, 22 Apr 2024 06:54:18 +0000 (09:54 +0300)
committerEshel Yaron <me@eshelyaron.com>
Mon, 22 Apr 2024 18:38:27 +0000 (20:38 +0200)
(flymake-mode-map): Bind mouse-1 click on the fringe to
'flymake-show-buffer-diagnostics' (bug#70459).
(flymake-show-buffer-diagnostics): Display buffer diagnostics
at the bottom.
(flymake-show-project-diagnostics): Display project diagnostics
at the bottom.

(cherry picked from commit 419550c7907275bf962986e1cc8fba1989d8659c)

lisp/progmodes/flymake.el

index 22a139d30453c155febd1b7aca5fa00eb06038bf..f5bf68db574f603a22141d5e73bc0db0cdfb4b16 100644 (file)
@@ -1331,7 +1331,10 @@ Interactively, with a prefix arg, FORCE is t."
                   nil))))))))
 
 (defvar flymake-mode-map
-  (let ((map (make-sparse-keymap))) map)
+  (let ((map (make-sparse-keymap)))
+    (define-key map `[,flymake-fringe-indicator-position mouse-1]
+                #'flymake-show-buffer-diagnostics)
+    map)
   "Keymap for `flymake-mode'.")
 
 ;;;###autoload
@@ -1972,8 +1975,12 @@ buffer."
                        (current-buffer)))))
     (with-current-buffer target
       (setq flymake--diagnostics-buffer-source source)
-      (display-buffer (current-buffer))
-      (revert-buffer))))
+      (revert-buffer)
+      (display-buffer (current-buffer)
+                      `((display-buffer-reuse-window
+                         display-buffer-below-selected)
+                        (window-height . (lambda (window)
+                          (fit-window-to-buffer window 10))))))))
 
 \f
 ;;; Per-project diagnostic listing
@@ -2073,8 +2080,11 @@ some of this variable's contents the diagnostic listings.")
     (with-current-buffer buffer
       (flymake-project-diagnostics-mode)
       (setq-local flymake--project-diagnostic-list-project prj)
-      (display-buffer (current-buffer))
-      (revert-buffer))))
+      (revert-buffer)
+      (display-buffer (current-buffer)
+                      `((display-buffer-reuse-window
+                         display-buffer-at-bottom)
+                        (window-height . fit-window-to-buffer))))))
 
 (defun flymake--update-diagnostics-listings (buffer)
   "Update diagnostics listings somehow relevant to BUFFER."