unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 'Emacs-Devel' <emacs-devel@gnu.org>
Subject: Re: FW: fit-frame.el
Date: Mon, 10 Mar 2008 14:24:27 -0400	[thread overview]
Message-ID: <jwvd4q2mosm.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <000f01c882d0$df847ef0$c2b22382@us.oracle.com> (Drew Adams's message of "Mon, 10 Mar 2008 09:04:59 -0800")

>> 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	other threads:[~2008-03-10 18:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-10  4:44 FW: fit-frame.el Drew Adams
2008-03-10 15:34 ` Stefan Monnier
2008-03-10 17:04   ` Drew Adams
2008-03-10 18:24     ` Stefan Monnier [this message]
2008-03-10 20:45       ` Drew Adams
2008-03-11 18:17         ` Stefan Monnier
2008-03-11 18:45           ` Drew Adams
2008-03-11 21:00             ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvd4q2mosm.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).