bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38164: quit-restore-window doesn't restore point in man


From: Juri Linkov
Subject: bug#38164: quit-restore-window doesn't restore point in man
Date: Tue, 12 Nov 2019 22:50:12 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>>>> (progn
>>>>     (man "XYZ")
>>>>     (read-string "-->"))
>>>>
>>>> This is because quit-restore-window moves point to wrong window.
>>>
>>> What should 'quit-restore-window' do here in particular?
>>
>> quit-restore-window should move point to old-selected-window,
>> i.e. the minibuffer window that was selected before Man-bgproc-sentinel
>> kicked in.  But I don't understand why it's not doing that.
>
> I'm not sure what you mean.  At the time 'man' calls 'display-buffer',
> the latter simply records the window returned by 'selected-window' as
> the one to reselect when the *Man XYZ* window gets deleted.  That
> recorded window is not the minibuffer window here, even if I evaluate
> the form via M-:.  Am I missing something?

Removing these lines from 'quit-restore-window' fixes the problem:

      ;; Select old window.
      (when (window-live-p (nth 2 quit-restore))
        (select-window (nth 2 quit-restore)))

If there lines are the whole purpose of 'quit-restore-window',
then in man.el we need to reselect the original window explicitly:

diff --git a/lisp/man.el b/lisp/man.el
index ce01fdc805..76890f74a9 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1469,8 +1469,10 @@ Man-bgproc-sentinel
 
       (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)
+              (select-window (old-selected-window)))
           (kill-buffer Man-buffer)))
 
       (when message





reply via email to

[Prev in Thread] Current Thread [Next in Thread]