From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Why does `(window-line-height)' return nil? Date: Sat, 03 Aug 2013 12:01:43 +0300 Message-ID: <83li4jxi4o.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1375520528 15727 80.91.229.3 (3 Aug 2013 09:02:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 3 Aug 2013 09:02:08 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Aug 03 11:02:09 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V5Xiy-0006Ik-IV for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Aug 2013 11:02:08 +0200 Original-Received: from localhost ([::1]:40904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Xiy-0003Ua-2Q for geh-help-gnu-emacs@m.gmane.org; Sat, 03 Aug 2013 05:02:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Xig-0003U9-EO for help-gnu-emacs@gnu.org; Sat, 03 Aug 2013 05:01:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5XiZ-0007Wt-5A for help-gnu-emacs@gnu.org; Sat, 03 Aug 2013 05:01:50 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:35569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5XiY-0007Vk-TU for help-gnu-emacs@gnu.org; Sat, 03 Aug 2013 05:01:43 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MQY003005W33V00@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Sat, 03 Aug 2013 12:01:41 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MQY002ZZ6ETWA60@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Sat, 03 Aug 2013 12:01:41 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:92690 Archived-At: > Date: Sat, 3 Aug 2013 16:26:50 +0800 > From: Xue Fuqiao > > 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.