From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#18357: 24.3.93; Calendar not fully displayed Date: Mon, 01 Sep 2014 11:18:52 +0200 Message-ID: <540439FC.7030206@gmx.at> References: <874mwv40ja.fsf@rosalinde.fritz.box> <83vbpaguyl.fsf@gnu.org> <87a96mqkl3.fsf@rosalinde.fritz.box> <5401C6E7.9070000@gmx.at> <5401C837.9090704@gmx.at> <83sikegla7.fsf@gnu.org> <5401D6F6.6010109@gmx.at> <83r3zygjbd.fsf@gnu.org> <5401FE87.8090207@gmx.at> <83k35qgc2d.fsf@gnu.org> <540206CA.40204@gmx.at> <83iol9hnhq.fsf@gnu.org> <54021337.9020800@gmx.at> <871trxrcso.fsf@rosalinde.fritz.box> <540306F9.6040107@gmx.at> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1409563240 29507 80.91.229.3 (1 Sep 2014 09:20:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Sep 2014 09:20:40 +0000 (UTC) Cc: 18357@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 01 11:20:33 2014 Return-path: Envelope-to: geb-bug-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 1XONmq-00040g-5X for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Sep 2014 11:20:32 +0200 Original-Received: from localhost ([::1]:58815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XONmp-0005Dj-NR for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Sep 2014 05:20:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XONmV-0004tZ-5x for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 05:20:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XONmN-0001eN-MT for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 05:20:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XONmN-0001dq-Jw for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 05:20:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XONmM-0001JS-VT for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 05:20:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Sep 2014 09:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18357 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18357-submit@debbugs.gnu.org id=B18357.14095631484969 (code B ref 18357); Mon, 01 Sep 2014 09:20:02 +0000 Original-Received: (at 18357) by debbugs.gnu.org; 1 Sep 2014 09:19:08 +0000 Original-Received: from localhost ([127.0.0.1]:55395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XONlT-0001I4-Ex for submit@debbugs.gnu.org; Mon, 01 Sep 2014 05:19:08 -0400 Original-Received: from mout.gmx.net ([212.227.15.18]:58764) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XONlP-0001HU-HH for 18357@debbugs.gnu.org; Mon, 01 Sep 2014 05:19:04 -0400 Original-Received: from [93.82.13.101] ([93.82.13.101]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LbMmA-1Y9Dqd1DhK-00kwVv; Mon, 01 Sep 2014 11:18:57 +0200 In-Reply-To: <540306F9.6040107@gmx.at> X-Provags-ID: V03:K0:8gFHMEig4zC84ccZW94MLOjomBijbMnB1/qHZaPRKYOpa+Anm2N ow/QIQRHcFK0qVf/eOKyQJDMhHClpJtsHtjugIESuY7kS9LIAiGyA0w317H8jaCgpHIArrS FVEXvqH6AuMWtByIN8OF7P700ffwEt/N7QfC6gYbg8ExO7K1+aGTNv5/+XgeTcsFNdNIwcW rJY/En7JliG67LZfmjk/A== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92917 Archived-At: The following is based on my scenario. With emacs -Q evaluate the following form (progn (custom-set-faces '(mode-line ((t (:background "#000040" :foreground "wheat" :box (:line-width 2 :color "#000040") :weight bold :family "Verdana")))) '(mode-line-inactive ((t (:inherit mode-line :background "grey48" :foreground "wheat" :box (:line-width 2 :color "#000040")))))) (setq calendar-week-start-day 1) (calendar)) In `calendar' two interesting things happen. The first one is a `split-window-sensibly' call to set up the calendar window. I've put a breakpoint in estimate_mode_line_height giving the following backtrace (the function estimate_window_mode_line_height works around the problem to set a breakpoint exclusively for calls from CURRENT_MODE_LINE_HEIGHT, the redefinitions appear below for anyone interested). #0 estimate_mode_line_height (f=0x17ca658, face_id=MODE_LINE_INACTIVE_FACE_ID) at xdisp.c:1908 #1 0x0102406d in estimate_window_mode_line_height (w=0x4988718) at xdisp.c:1928 #2 0x010860f0 in Fwindow_mode_line_height (window=...) at window.c:1010 [...] #87 0x010fa4f7 in main (argc=2, argv=0xa32808) at emacs.c:1645 Lisp Backtrace: "window-mode-line-height" (0x82ae8c) "window--min-size-1" (0x82b1b8) "window-min-size" (0x82b4e8) 0x12a2bb8 PVEC_COMPILED "walk-window-tree-1" (0x82bb48) "walk-window-tree-1" (0x82be78) "walk-window-tree" (0x82c1a8) "window--sanitize-window-sizes" (0x82c4c8) "byte-code" (0x82c760) "split-window" (0x82cb68) "split-window-below" (0x82cea8) "split-window-sensibly" (0x82d1e4) "funcall" (0x82d1e0) "window--try-to-split-window" (0x82d668) "display-buffer-pop-up-window" (0x82d998) "display-buffer--maybe-pop-up-frame-or-window" (0x82dcb8) "display-buffer" (0x82dff8) "pop-to-buffer" (0x82e328) "calendar-basic-setup" (0x82e658) "calendar" (0x82e8f0) "progn" (0x82eadc) "eval" (0x82ebe0) "eval-last-sexp-1" (0x82ef0c) "eval-last-sexp" (0x82f338) "funcall-interactively" (0x82f334) "call-interactively" (0x82f550) "command-execute" (0x82f890) (gdb) If I here print the value of the box_line_width of the MODE_LINE_INACTIVE_FACE_ID I get: (gdb) p face->box_line_width $24 = -1 which is obviously not up to date given the specification I requested. It's only during the next redisplay that the value of 2 is recognized and applied: #0 realize_x_face (cache=0xf94eb0, attrs=0x82d91c) at xfaces.c:5617 #1 0x010f1d25 in realize_face (cache=0xf94eb0, attrs=0x82d91c, former_face_id=1) at xfaces.c:5443 #2 0x010f1c4c in realize_named_face (f=0x17ca658, symbol=..., id=1) at xfaces.c:5414 #3 0x010f11b7 in realize_basic_faces (f=0x17ca658) at xfaces.c:5225 #4 0x010e7259 in recompute_basic_faces (f=0x17ca658) at xfaces.c:725 #5 0x0102ae1a in init_iterator (it=0x82da44, w=0x4988718, charpos=-1, bytepos=-1, row=0x0, base_face_id=DEFAULT_FACE_ID) at xdisp.c:2890 #6 0x010424de in x_consider_frame_title (frame=...) at xdisp.c:11623 #7 0x010428dd in prepare_menu_bars () at xdisp.c:11725 #8 0x01046b0b in redisplay_internal () at xdisp.c:13549 #9 0x0104590e in redisplay () at xdisp.c:13168 #10 0x010ff5e1 in read_char (commandflag=1, map=..., prev_event=..., used_mouse_menu=0x82f7ef, end_time=0x0) at keyboard.c:2590 #11 0x0110cf87 in read_key_sequence (keybuf=0x82f8e4, bufsize=30, prompt=..., dont_downcase_last=false, can_return_switch_frame=true, fix_current_buffer=true, prevent_redisplay=false) at keyboard.c:9152 #12 0x010fd149 in command_loop_1 () at keyboard.c:1462 #13 0x011891ce in internal_condition_case (bfun=0x10fcdc4 , handlers=..., hfun=0x10fc62f ) at eval.c:1347 #14 0x010fca7a in command_loop_2 (ignore=...) at keyboard.c:1193 #15 0x01188782 in internal_catch (tag=..., func=0x10fca56 , arg=...) at eval.c:1111 #16 0x010fca34 in command_loop () at keyboard.c:1172 #17 0x010fc1cb in recursive_edit_1 () at keyboard.c:782 #18 0x010fc388 in Frecursive_edit () at keyboard.c:853 #19 0x010fa4f7 in main (argc=2, argv=0xa32808) at emacs.c:1645 Lisp Backtrace: "redisplay_internal (C function)" (0x205e398) (gdb) p XINT (value) $25 = 2 (gdb) The second interesting thing happening in `calendar' is the call to `fit-window-to-buffer'. Since this call happens _between_ the two backtraces reproduced above, it does not add the line-widths of the box to the height of the mode line. In the present case, the missing 4 pixels are responsible for (1) not making the calendar window high enough and (2) scrolling the calendar window to move `point' out of the scroll margin. Obviously, putting in a `sit-for' before calling `calendar' realizes the mode line face and the subsequential calls use the correct value. I suppose that we should realize the mode line face whenever we call estimate_mode_line_height but have no idea whether and how this can be done. martin CURRENT_MODE_LINE_HEIGHT redefinitions. #define CURRENT_MODE_LINE_HEIGHT(W) \ (W->mode_line_height >= 0 \ ? W->mode_line_height \ : (W->mode_line_height \ = estimate_window_mode_line_height (W))) \ int estimate_window_mode_line_height (struct window *w) { int x; if (MATRIX_MODE_LINE_HEIGHT (w->current_matrix)) x = MATRIX_MODE_LINE_HEIGHT (w->current_matrix); else x = estimate_mode_line_height (XFRAME (w->frame), CURRENT_MODE_LINE_FACE_ID (w)); return x; }