]> git.eshelyaron.com Git - dict.git/commitdiff
ENHANCED: use next-error-select-buffer when switching to a buffer V8.5.18-sweep-0.6.0
authorEshel Yaron <me@eshelyaron.com>
Mon, 10 Oct 2022 12:59:14 +0000 (15:59 +0300)
committerEshel Yaron <me@eshelyaron.com>
Mon, 10 Oct 2022 13:05:00 +0000 (16:05 +0300)
* sweeprolog.el: sweeprolog-mode: add hook to
window-selection-change-functions.

sweeprolog.el

index 28c07f80f6e37a72b9e31291c1cb3e0592fdd289..71117ef6fdf58050254ed0065901c19c40fff43a 100644 (file)
@@ -6,7 +6,7 @@
 ;; Maintainer: Eshel Yaron <~eshel/dev@lists.sr.ht>
 ;; Keywords: prolog languages extensions
 ;; URL: https://git.sr.ht/~eshel/sweep
-;; Package-Version: 0.5.4
+;; Package-Version: 0.6.0
 ;; Package-Requires: ((emacs "28"))
 
 ;; This file is NOT part of GNU Emacs.
@@ -2655,7 +2655,14 @@ if-then-else constructs in SWI-Prolog."
   (when sweeprolog-enable-flymake
     (add-hook 'flymake-diagnostic-functions #'sweeprolog-diagnostic-function nil t)
     (flymake-mode)
-    (setq-local next-error-function #'flymake-goto-next-error))
+    (setq-local next-error-function #'flymake-goto-next-error)
+    (add-hook 'window-selection-change-functions
+              (let ((buffer (current-buffer)))
+                (lambda (win)
+                  (when (equal buffer
+                               (window-buffer win))
+                    (next-error-select-buffer buffer))))
+              nil t))
   (when (and (boundp 'cycle-spacing-actions)
              (consp cycle-spacing-actions)
              sweeprolog-enable-cycle-spacing