emacs-devel
[Top][All Lists]
Advanced

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

Re: FW: fit-frame.el


From: Stefan Monnier
Subject: Re: FW: fit-frame.el
Date: Mon, 10 Mar 2008 14:24:27 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> Could you describe what is the behavior of your function when
>> there are more than 1 windows in the frame?  After trying it out,
>> I'm still not sure.

> With no prefix arg, the frame is fit to all of the buffers displayed in it.
> This means that, within the maximum frame-size limits (see the doc for these
> - user variables), each buffer contributes to the frame size needed. There
> is no explicit resizing of windows within the frame. If each buffer can be
> shown fully (no display wrapping) with the frame still within its limits,
> then each buffer will be shown fully.

To me, as a user of your code, I found this behavior to look like your
code is just buggy: after calling fit-frame on a frame with several
windows, the result was a frame of different size, where some of the
windows were too small for their buffers and others were too large, so
it looked like it was just all messed up.

> There is this TODO item in fit-frame.el:

> ;;  Emacs needs a command similar to `fit-frame'
> ;;  for windows, that is, a command that will fit
> ;;  the existing windows of a frame to their
> ;;  buffers, as well as possible.  That could be
> ;;  then be used in combination with `fit-frame'.

> Until that is available, I think that `fit-frame' does the best that can be
> expected. The best use case for it is one-window-p frames, but it can also
> be useful for other frames, depending on what they are showing. When you are
> in a context where it is not useful, don't use it. ;-)

I'm not convinced that this "best we can do" is useful.

>> Also when the C-u arg is provided, it seems to resize the frame to the
>> size it should have if it displayed only 1 window,

> Correct (for plain C-u).

That's what I inferred from the behavior, not from the docstring.

>> whereas of course it's not the case: there are other windows
>> there (otherwise C-u makes no difference anyway).  So again,
>> the result is somewhat unexpected.

> It's not unexpected if that's what's described in the doc.

The doc says:

  To fit the frame to all of its displayed buffers, use no prefix arg.
  To fit it to just the current buffer, use a plain prefix arg (`C-u').

but it's far from clear what might be meant by "fit a frame to the
current buffer" (unless the current buffer is the only one shown in the
frame, that is).

> The main use case to think about here is one-window frames.

I think it makes sense to restrict its use to one-window-p (and hence
throw away the C-u argument).  And then rename it to fit-frame-to-buffer.
We might also want to have a variant that only shrinks the frame.
Such a variant probably wouldn't need any customization.



        Stefan




reply via email to

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