GNU bug report logs - #14636
24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer

Previous Next

Package: emacs;

Reported by: E Sabof <esabof <at> gmail.com>

Date: Sun, 16 Jun 2013 15:26:01 UTC

Severity: normal

Found in version 24.3.50.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14636 in the body.
You can then email your comments to 14636 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14636; Package emacs. (Sun, 16 Jun 2013 15:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to E Sabof <esabof <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 16 Jun 2013 15:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: E Sabof <esabof <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50.1; window-line-height doesn't seem to work, unless the point
 is at the end-of-buffer
Date: Sun, 16 Jun 2013 16:24:43 +0100
[Message part 1 (text/plain, inline)]
In emacs -Q

(window-line-height)
C-o
C-x C-e

Results in nil.

Interestingly enough, I can specify line numbers (or not) and it will work,
but only as long as (= (point) (point-max))
[Message part 2 (text/html, inline)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 16 Jun 2013 16:37:01 GMT) Full text and rfc822 format available.

Notification sent to E Sabof <esabof <at> gmail.com>:
bug acknowledged by developer. (Sun, 16 Jun 2013 16:37:02 GMT) Full text and rfc822 format available.

Message #10 received at 14636-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: E Sabof <esabof <at> gmail.com>
Cc: 14636-done <at> debbugs.gnu.org
Subject: Re: bug#14636: 24.3.50.1;
 window-line-height doesn't seem to work, unless the point is at
 the	end-of-buffer
Date: Sun, 16 Jun 2013 19:35:13 +0300
> Date: Sun, 16 Jun 2013 16:24:43 +0100
> From: E Sabof <esabof <at> gmail.com>
> 
> In emacs -Q
> 
> (window-line-height)
> C-o
> C-x C-e
> 
> Results in nil.

That's a documented limitation.  From the doc string:

  Return nil if window display is not up-to-date.  In that case, use
  `pos-visible-in-window-p' to obtain the information.

> Interestingly enough, I can specify line numbers (or not) and it will work,
> but only as long as (= (point) (point-max))

You cannot easily predict when the window display will be up-to-date
by the time this function runs.

Closing as not-a-bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14636; Package emacs. (Sun, 16 Jun 2013 16:45:01 GMT) Full text and rfc822 format available.

Message #13 received at 14636-done <at> debbugs.gnu.org (full text, mbox):

From: E Sabof <esabof <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 14636-done <at> debbugs.gnu.org
Subject: Re: bug#14636: 24.3.50.1; window-line-height doesn't seem to work,
 unless the point is at the end-of-buffer
Date: Sun, 16 Jun 2013 17:44:07 +0100
[Message part 1 (text/plain, inline)]
On Sun, Jun 16, 2013 at 5:35 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Date: Sun, 16 Jun 2013 16:24:43 +0100
> > From: E Sabof <esabof <at> gmail.com>
> >
> > In emacs -Q
> >
> > (window-line-height)
> > C-o
> > C-x C-e
> >
> > Results in nil.
>
> That's a documented limitation.  From the doc string:
>
>   Return nil if window display is not up-to-date.  In that case, use
>   `pos-visible-in-window-p' to obtain the information.
>
> > Interestingly enough, I can specify line numbers (or not) and it will
> work,
> > but only as long as (= (point) (point-max))
>
> You cannot easily predict when the window display will be up-to-date
> by the time this function runs.
>
> Closing as not-a-bug.
>

I have also tried

(progn (pos-visible-in-window-p)
       (window-line-height))

but it didn't seem to make any difference.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14636; Package emacs. (Sun, 16 Jun 2013 16:54:01 GMT) Full text and rfc822 format available.

Message #16 received at 14636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: E Sabof <esabof <at> gmail.com>
Cc: 14636 <at> debbugs.gnu.org
Subject: Re: bug#14636: 24.3.50.1;
 window-line-height doesn't seem to work, unless the point is at the
 end-of-buffer
Date: Sun, 16 Jun 2013 19:53:42 +0300
> Date: Sun, 16 Jun 2013 17:44:07 +0100
> From: E Sabof <esabof <at> gmail.com>
> Cc: 14636-done <at> debbugs.gnu.org
> 
> > That's a documented limitation.  From the doc string:
> >
> >   Return nil if window display is not up-to-date.  In that case, use
> >   `pos-visible-in-window-p' to obtain the information.
> >
> > > Interestingly enough, I can specify line numbers (or not) and it will
> > work,
> > > but only as long as (= (point) (point-max))
> >
> > You cannot easily predict when the window display will be up-to-date
> > by the time this function runs.
> >
> > Closing as not-a-bug.
> >
> 
> I have also tried
> 
> (progn (pos-visible-in-window-p)
>        (window-line-height))
> 
> but it didn't seem to make any difference.

Why should it?  Calling pos-visible-in-window-p does not guarantee
that the window will be up-to-date, it just gives you the same
information without requiring that the display be up-to-date.  Its
disadvantage is that it is slower.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14636; Package emacs. (Sun, 16 Jun 2013 17:20:02 GMT) Full text and rfc822 format available.

Message #19 received at 14636 <at> debbugs.gnu.org (full text, mbox):

From: E Sabof <esabof <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 14636 <at> debbugs.gnu.org
Subject: Re: bug#14636: 24.3.50.1; window-line-height doesn't seem to work,
 unless the point is at the end-of-buffer
Date: Sun, 16 Jun 2013 18:19:06 +0100
[Message part 1 (text/plain, inline)]
  > I have also tried

> >
> > (progn (pos-visible-in-window-p)
> >        (window-line-height))
> >
> > but it didn't seem to make any difference.
>
> Why should it?  Calling pos-visible-in-window-p does not guarantee
> that the window will be up-to-date, it just gives you the same
> information without requiring that the display be up-to-date.  Its
> disadvantage is that it is slower.
>

You might be confusing posn-at-point (which returns the height of the
character amoung other things), with pos-visible-in-window-p, which returns
t or nil.

In any case, the height of the character can be different from the height
of the line, so they are not equivalent. So either a) the documentation is
incomplete and misleading, or b) there is a bug in the implementation
(which I think is more likely, given the arbitrary circumstances under
which this function does and doesn't work).
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14636; Package emacs. (Sun, 16 Jun 2013 17:34:01 GMT) Full text and rfc822 format available.

Message #22 received at 14636 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: E Sabof <esabof <at> gmail.com>
Cc: 14636 <at> debbugs.gnu.org
Subject: Re: bug#14636: 24.3.50.1;
 window-line-height doesn't seem to work, unless the point is at the
 end-of-buffer
Date: Sun, 16 Jun 2013 20:32:55 +0300
> Date: Sun, 16 Jun 2013 18:19:06 +0100
> From: E Sabof <esabof <at> gmail.com>
> Cc: 14636 <at> debbugs.gnu.org
> 
> You might be confusing posn-at-point (which returns the height of the
> character amoung other things), with pos-visible-in-window-p, which returns
> t or nil.

I'm not confusing them.  And pos-visible-in-window-p can return more
than just nil or t, see its doc string.

> In any case, the height of the character can be different from the height
> of the line, so they are not equivalent.

They are not equivalent, in the sense that a single call to
pos-visible-in-window-p will not do what window-line-height does.  You
need to call pos-visible-in-window-p twice, for the line you are
interested in and the one after it, to get the same information.

> So either a) the documentation is incomplete and misleading, or b)
> there is a bug in the implementation (which I think is more likely,
> given the arbitrary circumstances under which this function does and
> doesn't work).

There's no bug.  It looks arbitrary to you because whether the window
display is up-to-date when window-line-height runs is impossible to
predict.  Take a look at the source of window-line-height, and you
will see it.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 15 Jul 2013 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 38 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.