unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: RE: `fit-window-to-buffer-as-displayed'?
Date: Tue, 11 Jan 2011 09:47:34 -0800	[thread overview]
Message-ID: <AD98B69892FC4A34BCE5073E3358638C@us.oracle.com> (raw)

> >> At the time fit-window-to-buffer-as-displayed is called, the 
> >> text might not be completely displayed yet.
> >
> > Well obviously one would call 
> > `fit-window-to-buffer-as-displayed' only after
> > (one knew that) it was displayed. ;-)
> 
> And how do you know and/or make sure it's *completely* displayed?

You might not be able to know for sure - hence the smily.

But likely you would not want to call it before you added `display' properties
etc. that you wanted to be taken into account for the fitting.  Of course
calling it after such code has finished is still no guarantee.  You can try
forcing redisplay, but in many cases that won't be necessary.

The point is that calls to fit the window to what is displayed would
intentionally be made after the buffer has been displayed in all its glory.
Whether that intention is realized in all cases is another story.

> > And if it were called when not displayed then, in that 
> > situation, we could either have it be a no-op or have it
> > do what `fit-window-to-buffer' does now.
> 
> But fit-window-to-buffer doesn't work right in many cases, so 
> that'd not be a complete solution.

Any bugs should be fixed, of course.  By "what it does now" I was referring to
the current intended behavior of taking into account screen lines, not text
lines.

> > I think there can be use cases for its current behavior.  And use
> > cases for just fitting to the buffer text, ignoring all display
> > considerations (treating it as plain, fixed-width text, no more).
> 
> Maybe there can be, but I can't think of any of them, so I 
> think they'd be very far fetched and insignificant.
> 
> > I probably have nothing to offer wrt the implementation.  I do think
> > though that this is bound to be somewhat complex and success is likely
> > to be partial and conditional (works for some display artifacts in
> > some situations, but is not perfect).  There are a lot of different
> > things one can do with display, even just counting the `display'
> > text/overlay property.  (And note that some of them take place beyond
> > buffer positions, so tests involving (point) won't necessarily cut
> > the mustard.)
> 
> There's no point trying to add support for some properties 
> but not all: adding support for all properties is likely to be easier
> because it'd rely on (re)using the existing display code.

I agree with the attempt.  I was only suggesting that the job might not be
simple.  You mentioned checking `posn-point' in a loop.  I pointed out that some
display happens outside of any positions that point can assume - outside of the
buffer text altogether (e.g. margins).

Anyway, making `fit-window-to-buffer' take display artifacts into account would
be an improvement.  If you want to have it always take all such into account
(i.e. not let programmers pick & choose), that's still a fine improvement.
Let's please do it.




             reply	other threads:[~2011-01-11 17:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11 17:47 Drew Adams [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-01-10 21:46 `fit-window-to-buffer-as-displayed'? Drew Adams
2011-01-10 23:51 ` `fit-window-to-buffer-as-displayed'? Stefan Monnier
2011-01-11  0:35   ` `fit-window-to-buffer-as-displayed'? Drew Adams
2011-01-11  5:30     ` `fit-window-to-buffer-as-displayed'? 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=AD98B69892FC4A34BCE5073E3358638C@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).