* *real* number of lines a window can display currently
@ 2003-10-07 16:07 Klaus Berndl
2003-10-07 16:19 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Klaus Berndl @ 2003-10-07 16:07 UTC (permalink / raw)
What i search for is a function which gives me the *real* number of lines a
certain window displays currently....neither `window-height' nor
`window-text-height' nor `window-body-height' are usable for this because
none of them consider the current font-height of text in the buffer or if
images are displayed (so some lines of the buffer in the window are higher
than others etc..).
What would help is (count-screen-lines (window-start) (window-end)) but
unfortunately not in all situations: This works only correct if the end of
the buffer is not before the window-end, means there are no "empty" lines left
in the window. If there are "empty" lines then these ones are not count :-(
The `window-displayed-lines' function of XEmacs is better:
`window-displayed-height' is a built-in function
(window-displayed-height &optional WINDOW)
Documentation:
Return the number of lines currently displayed in WINDOW.
This counts the actual number of lines displayed in WINDOW
(as opposed to `window-height'). The modeline and horizontal
scrollbar do not count as lines. If there is some blank space
between the end of the buffer and the end of the window, this
function pretends that there are lines of text in the default
font there.
This is what i search for GNU Emacs 21.X... Does something like this exist or
is there another way to reach my goal?
Thanks a lot,
Klaus
--
Klaus Berndl mailto: klaus.berndl@sdm.de
sd&m AG http://www.sdm.de
software design & management
Carl-Wery-Str. 42, 81739 Muenchen, Germany
Tel +49 89 63812-392, Fax -220
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: *real* number of lines a window can display currently
2003-10-07 16:07 *real* number of lines a window can display currently Klaus Berndl
@ 2003-10-07 16:19 ` Stefan Monnier
2003-10-14 1:03 ` Alan Wehmann
2003-10-14 6:22 ` Klaus Berndl
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2003-10-07 16:19 UTC (permalink / raw)
> `window-displayed-height' is a built-in function
> (window-displayed-height &optional WINDOW)
[...]
> This is what i search for GNU Emacs 21.X... Does something like this exist or
> is there another way to reach my goal?
I don't think such a thing exists or can be coded in elisp (the
count-screen-lines function fails in several cases other the one you
mention). But coding it in C shouldn't be too difficult: just look at the
number of rows in the glyph matrix [he said, pretending he known what he's
talking about].
I'm curious to know what you need it for,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: *real* number of lines a window can display currently
2003-10-07 16:19 ` Stefan Monnier
@ 2003-10-14 1:03 ` Alan Wehmann
2003-10-14 6:22 ` Klaus Berndl
1 sibling, 0 replies; 4+ messages in thread
From: Alan Wehmann @ 2003-10-14 1:03 UTC (permalink / raw)
calc.el could use such a function. If you want more justification for
this statement I'd have to refresh my memory about the details of how
its stack is displayed & I'd probably refer you to some old posts on
the subject (in comp.emacs). To get the stack to display correctly in
different situations, I've just empirically altered one of its
functions so that it works. My situations are Windows 2000 Pro at
work, XEmacs 21.4.8, Windows 98 at home, XEmacs 21.4.8, a Sun platform
at work--accessed via Telnet in console mode & with Xemacs 20.4
(earlier with Emacs 19.34), and Mandrake Linux 9.0 at home, with a
forgotten version of XEmacs and both in console mode and with
X-windows.
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> > `window-displayed-height' is a built-in function
> > (window-displayed-height &optional WINDOW)
> [...]
> > This is what i search for GNU Emacs 21.X... Does something like
> > this exist or is there another way to reach my goal?
>
> I don't think such a thing exists or can be coded in elisp (the
> count-screen-lines function fails in several cases other the one you
> mention). But coding it in C shouldn't be too difficult: just look
> at the number of rows in the glyph matrix [he said, pretending he
> known what he's talking about].
>
> I'm curious to know what you need it for,
>
>
> Stefan
--
Alan Wehmann
wehmann@fnal.gov
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: *real* number of lines a window can display currently
2003-10-07 16:19 ` Stefan Monnier
2003-10-14 1:03 ` Alan Wehmann
@ 2003-10-14 6:22 ` Klaus Berndl
1 sibling, 0 replies; 4+ messages in thread
From: Klaus Berndl @ 2003-10-14 6:22 UTC (permalink / raw)
On Tue, 07 Oct 2003, Stefan Monnier wrote:
> > `window-displayed-height' is a built-in function
> > (window-displayed-height &optional WINDOW)
> [...]
> > This is what i search for GNU Emacs 21.X... Does something like this exist
> > or is there another way to reach my goal?
>
> I don't think such a thing exists or can be coded in elisp (the
> count-screen-lines function fails in several cases other the one you
> mention). But coding it in C shouldn't be too difficult: just look at the
> number of rows in the glyph matrix [he said, pretending he known what he's
> talking about].
Hmm, could i write a feature-request for this? ;-)
>
> I'm curious to know what you need it for,
Could be needed by tools like ECB which uses tree-buffers. ECB currently does
a very smart recentering of a tree-buffer, so always a maximum of useful
informations are visible, e.g. as many subnodes as possible if a node is
expanded. ECB can currently use `count-screen-lines' for this and this works
perfect except for some very seldom (or almost pathological ;-) cases....
But nevertheless such a function would help to write the code even better
working perfectly for all cases.
Klaus
--
Klaus Berndl mailto: klaus.berndl@sdm.de
sd&m AG http://www.sdm.de
software design & management
Carl-Wery-Str. 42, 81739 Muenchen, Germany
Tel +49 89 63812-392, Fax -220
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-10-14 6:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-07 16:07 *real* number of lines a window can display currently Klaus Berndl
2003-10-07 16:19 ` Stefan Monnier
2003-10-14 1:03 ` Alan Wehmann
2003-10-14 6:22 ` Klaus Berndl
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).