emacs-devel
[Top][All Lists]
Advanced

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

Re: master b3dd0ce: Provide new option `delete-window-set-selected'


From: martin rudalics
Subject: Re: master b3dd0ce: Provide new option `delete-window-set-selected'
Date: Thu, 10 Jun 2021 17:01:59 +0200

> A few comments about this changeset:

Appreciated!

> Why a variable that is a user option is documented only in the ELisp
> manual?  I think it should also be mentioned in the "Change Window"
> node of the user manual, where we describe "C-x 0" and "C-x 1".

In a restricted sense I suppose because we nowhere describe terms like
"frame selected window" or "most recently used window" there.  So in the
C-x 0 paragraph something like "The option @code{delete-window..} allows
to choose which window becomes the new selected window instead." should
do what you have in mind here.  OK?

>> +           Note that a window with a non-@code{nil}
>> +@code{no-other-window} parameter is never chosen.
>
> Doesn't this depend on some argument to the relevant functions?

Yes.  I have added such an argument to `get-mru-window' and friends.
But see my last remark below.

>>   @cindex largest window
>> -@defun get-largest-window &optional all-frames dedicated not-selected
>> +@defun get-largest-window &optional all-frames dedicated not-selected 
no-other
>>   This function returns the window with the largest area (height times
>> -width).  The optional argument @var{all-frames} specifies the windows to
>> -search, and has the same meaning as in @code{next-window}.
>> -
>> -A minibuffer window is never a candidate.  A dedicated window
>> -(@pxref{Dedicated Windows}) is never a candidate unless the optional
>> -argument @var{dedicated} is non-@code{nil}.  The selected window is not
>> -a candidate if the optional argument @var{not-selected} is
>> -non-@code{nil}.  If the optional argument @var{not-selected} is
>> -non-@code{nil} and the selected window is the only candidate, this
>> -function returns @code{nil}.
>> -
>> -If there are two candidate windows of the same size, this function
>> -prefers the one that comes first in the cyclic ordering of windows,
>> -starting from the selected window.
>> +width).  If there are two candidate windows of the same size, it prefers
>> +the one that comes first in the cyclic ordering of windows, starting
>> +from the selected window.  The meaning of the arguments is the same as
>> +for @code{get-lru-window}.
>>   @end defun
>
> This hunk loses the information about minibuffer windows and dedicated
> windows, at least.  it also seems to lose the information about when
> the selected window isn't a candidate.  Why?

This information is now provided by the sentence "The meaning of the
arguments is the same as for ‘get-lru-window’."  just as with the
preceding `get-mru-window'.

>> +(defun window-at-pos (x y &optional frame no-other)
>> +  "Return live window at coordinates X, Y on specified FRAME.
>
> A better name for this function is window-at-x-y, IMO.  "Pos" can have
> ambiguous interpretations, see above.

So `window-at-x-y' be it.

>> +X and Y are counted in pixels from an origin at 0, 0 of FRAME's
>> +native frame.  A coordinate on an edge shared by two windows is
>> +attributed to the window on the right (or below).  Return nil if
>
> If you say "FRAME-relative coordinates", doesn't that tell the same
> story, just much more succinctly and clearly?

It does.

>> +(defcustom delete-window-set-selected 'mru
>
> Wouldn't the name delete-window-choose-selected be better?

I'll go for that unless Juri has a better idea.

> The doc
> string says that much:
>
>> +  "How to choose a frame's selected window after window deletion.
>
> Or maybe delete-selected-window-choose-replacement?
>
>> +               ;; If `delete-window-internal' selected a window with a
>> +               ;; non-nil 'no-other-window' parameter as its frame's
>> +               ;; selected window, try to choose another one.
>> +               (catch 'found
>> +                 (walk-window-tree
>> +                  (lambda (other)
>> +                    (unless (window-parameter other 'no-other-window)
>> +                      (set-frame-selected-window frame other)
>> +                      (throw 'found t)))
>> +                  frame))))
>
> That "try" means that we could sometimes fail, and return a window
> with a non-nil 'no-other-window' parameter, right?  If so, the doc
> strings, which say such a window will _never_ be returned, are
> inaccurate, right?

Functions like `get-mru-window' never return such a window provided
their NO-OTHER argument has been set.  The snippet you cite is from
`delete-window' which, in that case, leaves the window selected by
`delete-window-internal' alone and these doc strings are right.  But
I'll amend the documentation of the new option appropriately.

Thanks, martin




reply via email to

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