[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: `fit-window-to-buffer-as-displayed'?
From: |
Stefan Monnier |
Subject: |
Re: `fit-window-to-buffer-as-displayed'? |
Date: |
Mon, 10 Jan 2011 18:51:09 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> In this it seems to be trying, at least somewhat, to fit the window
> not simply to the buffer content (plain text, fixed-char size) but to
> the buffer as actually displayed.
Yes, it tries as best it can. It's not flawless, tho, largely for lack
of better primitive functions.
> 1. Am I missing something - is there something that would help with this?
> Something that would give me the actual height and width of a buffer as
> currently displayed (e.g. in pixels)?
At the time fit-window-to-buffer-as-displayed is called, the text might
not be completely displayed yet.
> 2. If not, could that please be added to Emacs? (I'll file an enhancement
Agreed, please.
> request if it makes sense.) Either a new function,
> `fit-window-to-buffer-as-displayed' or (better, IMO) an enhancement to
> `fit-window-to-buffer' that adds an optional parameter AS-DISPLAYED.
No need for a new parameter: it's a bug-fix.
It's not trivial to fix, tho, and it's not clear which kind of primitive
the C code could/should provide in order to make it possible.
Maybe we could simply do something like a binary search, where each loop
iteration forces redisplay, then checks with posn-point if EOB is right
at the end of the window.
Stefan