From 4636672203f22d41ab7974f335f0f85acbf80ddc Mon Sep 17 00:00:00 2001 From: Lucius Hu Date: Wed, 13 Jul 2022 17:39:40 -0400 Subject: [PATCH] syntax-checking: prevent changing window when quitting error list When toggling off flycheck's error list window, it calls `quit-window` which might also change the focus to another window. Wrapping this form `save-selected-window` ensures the focus always returns to where toggling command is first invoked. --- layers/+checkers/syntax-checking/funcs.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layers/+checkers/syntax-checking/funcs.el b/layers/+checkers/syntax-checking/funcs.el index c6ead10a1..1831794b1 100644 --- a/layers/+checkers/syntax-checking/funcs.el +++ b/layers/+checkers/syntax-checking/funcs.el @@ -34,8 +34,8 @@ true." "Toggle flycheck's error list window. If the error list is visible, hide it. Otherwise, show it." (interactive) - (-if-let (window (flycheck-get-error-list-window)) - (quit-window nil window) + (if-let ((window (flycheck-get-error-list-window))) + (save-selected-window (quit-window nil window)) (flycheck-list-errors))) (defun spacemacs/goto-flycheck-error-list ()