Subject: Re: bug#32825: 27.0.50; Deterministic window management

From: martin rudalics <[email-masked]>
Date: Mon, 12 Nov 2018 09:45:41 +0100

> Regarding TAGS, I spend much time killing TAGS buffers, but they
 > quickly reappear in the buffer list like in a whac-a-mole type of game.
 > Shouldn't such internal types of buffers be named with a leading space
 > in their buffer names?

Etags files are called TAGS and we usually set the buffer name from
the name of the file it's visiting.  We should be able to prepend a
space but I have no idea where and when we visit the TAGS file.

 >> I'd rather restart with a buffer from the window-local list
 >> provided that list is "long enough".  That's fuzzy to implement.
 >
 > You mean a cyclic window-local buffer list?

If it's long enough, yes.  Note also that once a member of the global
list has been taken it will pollute the local list forever thus also
needlessly increasing the list of previous buffers for a window.

More precisely, the problem is that of "navigational security"
(alternating 'switch-to-prev-buffer' and 'switch-to-next-buffer' calls
should reliably reproduce the buffer previously shown in a window to
avoid violating the principle of least surprise) vs "minimum
annoyance" (that of not switching to a buffer a user expressly doesn't
want to see).

So I think that while the solution is to not allow
'switch-to-prev-buffer' to switch to such an unwanted buffer, we
should allow 'switch-to-next-buffer' to switch to it.  But I haven't
yet thought about all the implications.

Also I'm not sure whether we should maintain for each window separate
lists of buffers we do not want to switch to but we might want to
consult in 'display-buffer-in-previous-window' or to leave such
buffers in the windows' lists of previous buffers and have
'switch-to-prev-buffer' skip such buffers with the help of some
predicate.  The latter would be more likely the way to go because we
then could allow a simple user option to provide that predicate.

 > Maybe the notion of burying should also apply to window-local
 > buffer list?  So burying a buffer should push it to the end of
 > window-local buffer list?

If 'switch-to-prev-buffer' didn't already do that it would be severely
broken.

martin