emacs-devel
[Top][All Lists]
Advanced

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

Re: master b2150e0: Preserve point under 'dired-auto-revert-buffer' (sec


From: martin rudalics
Subject: Re: master b2150e0: Preserve point under 'dired-auto-revert-buffer' (second case)
Date: Wed, 19 Jul 2017 10:18:32 +0200

> If I debugged this correctly, it seems that the crucial
> difference is that, on calling quit-window after
> pop-to-buffer-same-window, the window displaying the directory has a
> non-nil quit-restore window parameter (in fact, its value contains the
> buffer visiting the todo-file), while on calling quit-window after
> switch-to-buffer, the quit-restore window parameter is nil.  Is this
> correct (cc'ing Martin)?

Yes.  ‘switch-to-buffer’ misses a number of features which make it
behave differently from ‘display-buffer’ based functions.  In
particular, it cannot be used for displaying buffers temporarily.

> The only difference in the buffer lists of the two outputs is after
> quit-window (the last line in each output).  Is this difference due to
> the different quit-restore window parameter values?

‘quit-window’ works on a per window basis.  Earlier the situation was as
follows: Consider two windows showing two different portions of the same
buffer.  If in one of these windows you temporarily worked on another
buffer, then quitting that window would not restore the buffer
previously shown in it because there is already another window showing
that buffer.  Even if it did restore the buffer, it would not have
restored that window's position of point.  ‘quit-window’ simply tries to
restore the buffer as previously shown in that window regardless of what
the buffer list says.

> If so, I'm not sure
> what the best course of action is.  This is what's supposed to happen
> (what the test tests for): (1) the todo-mode buffer is displayed in a
> window; (2) calling dired makes the window display a directory; (3)
> calling todo-show makes the window display the todo-mode buffer again;
> (4) calling todo-quit buries the todo-mode buffer, so the window
> displays the directory again; (5) now immediately calling quit-window in
> the directory should not make the window display the todo-mode buffer
> again, if there is an alternative.  This worked when dired used
> switch-to-buffer, but no longer works now that dired uses
> pop-to-buffer-same-window.  I'd be grateful for any advice.

The problematic step is (4).  ‘quit-window’ has no idea of the semantics
of ‘bury-buffer’ (neither do I).  But if no one objects we could install
the attached patch.

martin

Attachment: window.el.diff
Description: Text document


reply via email to

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