From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Printing to STDERR when %d is "Cannot access memory ..." Date: Wed, 13 Jun 2018 22:46:54 +0300 Message-ID: <83tvq631w1.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1528919161 10895 195.159.176.226 (13 Jun 2018 19:46:01 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 13 Jun 2018 19:46:01 +0000 (UTC) Cc: emacs-devel@gnu.org To: Keith David Bershatsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 13 21:45:57 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fTBiO-0002i8-LD for ged-emacs-devel@m.gmane.org; Wed, 13 Jun 2018 21:45:56 +0200 Original-Received: from localhost ([::1]:36606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTBkV-0005FF-Uk for ged-emacs-devel@m.gmane.org; Wed, 13 Jun 2018 15:48:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTBjX-0005CM-TW for emacs-devel@gnu.org; Wed, 13 Jun 2018 15:47:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTBjX-0008Mj-0Y for emacs-devel@gnu.org; Wed, 13 Jun 2018 15:47:07 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTBjQ-0008F6-Fb; Wed, 13 Jun 2018 15:47:00 -0400 Original-Received: from [176.228.60.248] (port=2634 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fTBjP-00080C-SZ; Wed, 13 Jun 2018 15:47:00 -0400 In-reply-to: (message from Keith David Bershatsky on Wed, 13 Jun 2018 12:34:14 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226308 Archived-At: > Date: Wed, 13 Jun 2018 12:34:14 -0700 > From: Keith David Bershatsky > Cc: emacs-devel@gnu.org,Davis Herring > > My STDERR printout (with the NULL font now being assigned a 0 value) is as follows: > > it->c (120021) > char (ð) > w->hscroll (0) > hscl (false) > it->hpos (5) > it->vpos (0) > it->current_x (55) > new_x (55) > font->space_width (0) > it->lnum_pixel_width (55) > it->lnum_width (3) > it->first_visible_x (0) > relative_x (55) > it->face_id (38) > foreground_face (magenta) > background_face (black) > rc (MOVE_X_REACHED) > > I create the font pointer like this .... It has worked for everything so far except this special character (U0001D4D5) on Emacs built --with-x. I believe the face_id is correct in this example because the foreground (magenta) and background (black) are correctly returned. > > struct face *face = mc_lookup_face (it); > struct font *font = face->font; > Lisp_Object foreground_face = face->lface[LFACE_FOREGROUND_INDEX]; > Lisp_Object background_face = face->lface[LFACE_BACKGROUND_INDEX]; > > ... using the following function: > > struct face * > mc_lookup_face (struct it *it) > { > if (!NILP (Vface_remapping_alist) > && (it->face_id == DEFAULT_FACE_ID /* Qdefault */ > || it->face_id == MODE_LINE_FACE_ID /* Qmode_line */ > || it->face_id == MODE_LINE_INACTIVE_FACE_ID /* Qmode_line_inactive */ > || it->face_id == HEADER_LINE_FACE_ID /* Qheader_line */ > || it->face_id == TOOL_BAR_FACE_ID /* Qtool_bar */ > || it->face_id == FRINGE_FACE_ID /* Qfringe */ > || it->face_id == SCROLL_BAR_FACE_ID /* Qscroll_bar */ > || it->face_id == BORDER_FACE_ID /* Qborder */ > || it->face_id == CURSOR_FACE_ID /* Qcursor */ > || it->face_id == MOUSE_FACE_ID /* Qmouse */ > || it->face_id == MENU_FACE_ID /* Qmenu */ > || it->face_id == WINDOW_DIVIDER_FACE_ID /* Qwindow_divider */ > || it->face_id == WINDOW_DIVIDER_FIRST_PIXEL_FACE_ID /* Qwindow_divider_first_pixel */ > || it->face_id == WINDOW_DIVIDER_LAST_PIXEL_FACE_ID /* Qwindow_divider_last_pixel */ > || it->face_id == VERTICAL_BORDER_FACE_ID /* Qvertical_border */ > || it->face_id == INTERNAL_BORDER_FACE_ID)) /* Qinternal_border */ > return FACE_FROM_ID (it->f, lookup_basic_face (it->f, it->face_id)); > else > return FACE_FROM_ID (it->f, it->face_id); > } I don't think face->font is guaranteed to be non-NULL. You need to check that explicitly, and you need some fallback for when it is NULL, to serve as a substitute for font->space_width.