From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#7587: 23.2; `format-mode-line' makes Emacs crash Date: Sat, 11 Dec 2010 00:40:14 +0200 Message-ID: <83fwu51cc1.fsf@gnu.org> References: <87d3pd5mca.fsf@web.de> <83k4jh1ur6.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1292021577 11503 80.91.229.12 (10 Dec 2010 22:52:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Dec 2010 22:52:57 +0000 (UTC) Cc: michael_heerdegen@web.de, 7587@debbugs.gnu.org To: Stefan Monnier , Miles Bader Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 10 23:52:51 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PRBpT-0000h6-Pt for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Dec 2010 23:52:50 +0100 Original-Received: from localhost ([127.0.0.1]:34004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRBpR-0002I2-RF for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Dec 2010 17:52:41 -0500 Original-Received: from [140.186.70.92] (port=59640 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PRBpB-00027q-HV for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2010 17:52:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PRBpA-0005VZ-3r for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2010 17:52:25 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PRBpA-0005VH-0h for bug-gnu-emacs@gnu.org; Fri, 10 Dec 2010 17:52:24 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PRBXO-0004B3-83; Fri, 10 Dec 2010 17:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 Dec 2010 22:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7587 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7587-submit@debbugs.gnu.org id=B7587.129202044116050 (code B ref 7587); Fri, 10 Dec 2010 22:34:02 +0000 Original-Received: (at 7587) by debbugs.gnu.org; 10 Dec 2010 22:34:01 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PRBXM-0004Ap-HT for submit@debbugs.gnu.org; Fri, 10 Dec 2010 17:34:00 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PRBXK-0004Ab-PU for 7587@debbugs.gnu.org; Fri, 10 Dec 2010 17:33:59 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0LD800G00H72XA00@a-mtaout20.012.net.il> for 7587@debbugs.gnu.org; Sat, 11 Dec 2010 00:40:02 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.229.142.197]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LD800GR8HMORP50@a-mtaout20.012.net.il>; Sat, 11 Dec 2010 00:40:02 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 10 Dec 2010 17:34:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:42408 Archived-At: > From: Stefan Monnier > Cc: michael_heerdegen@web.de, 7587@debbugs.gnu.org > Date: Fri, 10 Dec 2010 15:50:31 -0500 > > > This happens because, for some reason I don't understand, when > > face-remapping-alist is non-nil, lookup_basic_face insists on getting > > only one of the basic faces, and otherwise aborts: > > I don't know anything about this code Who does? Miles, do you? > but the name `lookup_basic_face' suggests it only works for basic > faces Actually, it works for non-basic faces as well--but only if face-remapping-alist is nil. See this part of it, which I cited: if (NILP (Vface_remapping_alist)) return face_id; /* Nothing to do. */ The patch I suggest simply make lookup_basic_face behave consistently regardless of the value of face-remapping-alist. > so maybe the problem is that the function gets incorrectly called > for a non-basic face. It _does_ get called with a basic face (`mode-line'), but that face has been remapped. Remapping actually creates a new face ID in the face cache, but lookup_basic_face gets an ID (an integer), not a symbol Qmode_line etc. So if the face ID that lookup_basic_face gets is not one of the IDs reserved for the 12 basic faces, _and_ face-remapping-alist is non-nil, lookup_basic_face always pukes. Here's more context about the chain of calls that leads to the crash: The call to lookup_basic_face comes from init_iterator: /* Perhaps remap BASE_FACE_ID to a user-specified alternative. */ if (! NILP (Vface_remapping_alist)) remapped_base_face_id = lookup_basic_face (XFRAME (w->frame), base_face_id); init_iterator does this because it expects a truly basic face in base_face_id, and it wants to use its face-remapped variety, as the user would expect. But in this case, we pass to it an already remapped basic face, see this part of format-mode-line: if (!NILP (face)) { if (EQ (face, Qt)) face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive); face_id = lookup_named_face (XFRAME (WINDOW_FRAME (w)), face, 0); } ... init_iterator (&it, w, -1, -1, NULL, face_id); lookup_named_face returns the face ID of the remapped mode-line face. So in this case, face_id is already an ID of the remapped mode-line face, and returning it unaltered from lookup_basic_face is TRT. As an alternative, we could refrain from calling lookup_basic_face in init_iterator if the argument base_face_id is not one of the 12 basic face IDs.