unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14636: 24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer
@ 2013-06-16 15:24 E Sabof
  2013-06-16 16:35 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: E Sabof @ 2013-06-16 15:24 UTC (permalink / raw)
  To: 14636

[-- Attachment #1: Type: text/plain, Size: 184 bytes --]

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))

[-- Attachment #2: Type: text/html, Size: 311 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14636: 24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer
  2013-06-16 15:24 bug#14636: 24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer E Sabof
@ 2013-06-16 16:35 ` Eli Zaretskii
  2013-06-16 16:44   ` E Sabof
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2013-06-16 16:35 UTC (permalink / raw)
  To: E Sabof; +Cc: 14636-done

> Date: Sun, 16 Jun 2013 16:24:43 +0100
> From: E Sabof <esabof@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14636: 24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer
  2013-06-16 16:35 ` Eli Zaretskii
@ 2013-06-16 16:44   ` E Sabof
  2013-06-16 16:53     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: E Sabof @ 2013-06-16 16:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14636-done

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

On Sun, Jun 16, 2013 at 5:35 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> > Date: Sun, 16 Jun 2013 16:24:43 +0100
> > From: E Sabof <esabof@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.

[-- Attachment #2: Type: text/html, Size: 1553 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14636: 24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer
  2013-06-16 16:44   ` E Sabof
@ 2013-06-16 16:53     ` Eli Zaretskii
  2013-06-16 17:19       ` E Sabof
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2013-06-16 16:53 UTC (permalink / raw)
  To: E Sabof; +Cc: 14636

> Date: Sun, 16 Jun 2013 17:44:07 +0100
> From: E Sabof <esabof@gmail.com>
> Cc: 14636-done@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14636: 24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer
  2013-06-16 16:53     ` Eli Zaretskii
@ 2013-06-16 17:19       ` E Sabof
  2013-06-16 17:32         ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: E Sabof @ 2013-06-16 17:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 14636

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]

  > 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).

[-- Attachment #2: Type: text/html, Size: 1449 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#14636: 24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer
  2013-06-16 17:19       ` E Sabof
@ 2013-06-16 17:32         ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2013-06-16 17:32 UTC (permalink / raw)
  To: E Sabof; +Cc: 14636

> Date: Sun, 16 Jun 2013 18:19:06 +0100
> From: E Sabof <esabof@gmail.com>
> Cc: 14636@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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-16 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-16 15:24 bug#14636: 24.3.50.1; window-line-height doesn't seem to work, unless the point is at the end-of-buffer E Sabof
2013-06-16 16:35 ` Eli Zaretskii
2013-06-16 16:44   ` E Sabof
2013-06-16 16:53     ` Eli Zaretskii
2013-06-16 17:19       ` E Sabof
2013-06-16 17:32         ` Eli Zaretskii

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).