From: Eshel Yaron Date: Mon, 10 Oct 2022 12:59:14 +0000 (+0300) Subject: ENHANCED: use next-error-select-buffer when switching to a buffer X-Git-Tag: V8.5.18-sweep-0.6.0 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9077b2985a708fb7e586f0b18f4e5d5fba4d597d;p=dict.git ENHANCED: use next-error-select-buffer when switching to a buffer * sweeprolog.el: sweeprolog-mode: add hook to window-selection-change-functions. --- diff --git a/sweeprolog.el b/sweeprolog.el index 28c07f8..71117ef 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -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