[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why does `(window-line-height)' return nil?
From: |
Eli Zaretskii |
Subject: |
Re: Why does `(window-line-height)' return nil? |
Date: |
Sat, 03 Aug 2013 12:01:43 +0300 |
> Date: Sat, 3 Aug 2013 16:26:50 +0800
> From: Xue Fuqiao <xfq.free@gmail.com>
>
> In my *scratch* buffer, all of the following expressions return nil with
> `eval-print-last-sexp' (also tried `eval-last-sexp'):
>
> --8<---------------cut here---------------start------------->8---
> (window-line-height 'header-line)
> (window-line-height 'mode-line)
> (window-line-height)
> (window-line-height 0)
> (window-line-height -1)
> --8<---------------cut here---------------end--------------->8---
>
> Why do they return nil? After reading the doc string, I only found one
> sentence that may be relavant: "Return nil if window display is not
> up-to-date." So, does that mean window display is not up-to-date when
> evaluating the expression?
Yes, that's what it means. This function will almost always return
nil if you evaluate an expression that calls it in the *scratch*
buffer, because that evaluation forces a new redisplay cycle (to
display the result). It does return non-nil values when called from
Lisp code that does not trigger redisplay, though.