From 611b85b66366961dfcf53885438771b30569ffe0 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Mon, 21 Sep 2020 15:05:55 +0200 Subject: [PATCH] Tweak how Man selects the previous window on failure * lisp/man.el (Man-bgproc-sentinel): Ensure that we select the correct previous window (bug#38164). --- lisp/man.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/man.el b/lisp/man.el index 1a82b120629..5ee60cae9f3 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1508,8 +1508,11 @@ manpage command." (when delete-buff (if (window-live-p (get-buffer-window Man-buffer t)) - (quit-restore-window - (get-buffer-window Man-buffer t) 'kill) + (progn + (quit-restore-window + (get-buffer-window Man-buffer t) 'kill) + ;; Ensure that we end up in the correct window. + (select-window (old-selected-window))) (kill-buffer Man-buffer))) (when message -- 2.39.2