Subject: bug#3598: 23.0.94; doc string of frame-root-window

From: martin rudalics <[email-masked]>
Date: Sat, 20 Jun 2009 10:08:20 +0200

>> and I mostly try to avoid `save-selected-window' based routines.
 >
 > What is the reason you avoid it? Is it because of performance?

Hysterical reasons.  Earlier (maybe < 2005) versions failed to restore
the current buffer and I spent hours debugging that.  I don't even know
whether all issues have been fixed by now.

 > I find myself using it more than I would like, but mainly I don't like all of
 > the debugger minutia it goes through, starting with Emacs 22 (21?). I have to
 > remember (and recognize) that I can skip that particular dolist or mapcar etc.
 > that maps over all the frames. In Emacs 20, that doesn't happen (no doubt it is
 > less correct).

The inherent problem of all `save-selected-window' based routines is the
selected window vs current buffer relation.  Unfortunately, there's no
perfect solution for this since sometimes you want to look at a
particular window only to check its geometry or some related settings
and IMHO `one-window-p' definitively belongs to that category.  Other
times you are interested in the buffer shown by the window as well and
there it makes well sense to make the window's buffer current too.  BTW,
in this context note how often Emacs code used to talk (and occasionally
still does) about selected buffers and current windows.

 > Then maybe that idiom should be provided as a user function? Or maybe
 > one-window-p should be made more convenient in your terms, so that it can do
 > that?
 >
 > All I mean is that this operation of telling whether a window is alone in its
 > frame is not something that only internal Emacs code needs to do. It is a pretty
 > common operation. If the only choices are (1) a function that you feel is not so
 > great and (2) an internal function, then you must feel that Emacs is missing
 > something for users, no?

I most certainly do.  But I'm not sure whether it'd better to rewrite
`one-window-p' or provide a separate function.

martin