GNU bug report logs - #34226
Running (defface my-face-foo ...) just after emacs -Q creates a face whose face-id is 0

Previous Next

Package: emacs;

Reported by: Eduardo Ochs <eduardoochs <at> gmail.com>

Date: Sun, 27 Jan 2019 21:43:01 UTC

Severity: normal

Tags: fixed

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34226 in the body.
You can then email your comments to 34226 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#34226; Package emacs. (Sun, 27 Jan 2019 21:43:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Eduardo Ochs <eduardoochs <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 27 Jan 2019 21:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eduardo Ochs <eduardoochs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Running (defface my-face-foo ...) just after emacs -Q creates a face
 whose face-id is 0
Date: Sun, 27 Jan 2019 19:42:32 -0200
[Message part 1 (text/plain, inline)]
In emacs from git the faces that are created in the .emacs receive bad
face-ids - in particular, the first one gets face-id 0, which is the
same as the face-id for the "default" face.

I discovered this bug because the first face that my .emacs creates is
used to make "^O"s be displayed as red stars, and in git emacs these
red stars were not being displayed in red.

The shell script below creates an elisp file - with some code in its
comments meant be executed by hand - and loads and edits that elisp
file from both emacs24 and emacs-27.0.50 with "-Q" to show the (bad)
behaviour that I was getting from my .emacs.

The relevant part of the M-x report-emacs-bug buffer is:

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2019-01-22 built on libreboot-ThinkPad-T400
Repository revision: fd943124439b7644392919bca8bc2a77e6316d92
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description: Trisquel GNU/Linux Flidas (8.0)

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev


--snip--snip--


cat > /tmp/face-id-bug.el <<'%%%'
;; A test file for the face id bug.
;; How to use this: run
;;   emacs24      -Q -l /tmp/face-id-bug.el /tmp/face-id-bug.el
;;   emacs27.0.50 -Q -l /tmp/face-id-bug.el /tmp/face-id-bug.el
;; and in each case execute the sexps in comments below.

(defface my-face-red
  '((t (:foreground "red")))
  "Face used for the red star glyph (char 15).")

(defface my-face-green
  '((t (:foreground "green")))
  "Face used for the green bang glyph (char 16).")

(defun my-set-glyph (pos char face)
  (aset standard-display-table pos
(vector (make-glyph-code char face))))

(if (not standard-display-table)
    (setq standard-display-table (make-display-table)))

(my-set-glyph ?\^O ?* 'my-face-red)
(my-set-glyph ?\^P ?! 'my-face-green)

;; Here's how to see the bug. Run this with C-x C-e:
;;   (insert 10 15 16)
;; it will insert a newline, a char 15 - displayed as a red star
;; glyph - and a char 16 - displayed as a green bang glyph.
;;
;; PROBLEM: in Emacs 24 both glyphs display as expected; in Emacs from
;; git - at least on 2019jan27 - the red star glyph appears as a star
;; in the default face, that is not red.
;;
;; A GUESS: this MAY be related to how emacs attributes face-ids to
;; newly-create faces. In Emacs 24 all these face-ids are different:
;;  (face-id 'default)
;;  (face-id 'my-face-red)
;;  (face-id 'my-face-green)
;; and in git Emacs the first two are zero - which means that
;;  (make-glyph-code ?* 'my-face-red)
;;  (make-glyph-code ?* 'default)
;; are indistinguishable.
%%%


emacs24       -Q -l /tmp/face-id-bug.el /tmp/face-id-bug.el
emacs-27.0.50 -Q -l /tmp/face-id-bug.el /tmp/face-id-bug.el
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34226; Package emacs. (Mon, 28 Jan 2019 15:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 34226 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Eduardo Ochs <eduardoochs <at> gmail.com>
Cc: 34226 <at> debbugs.gnu.org
Subject: Re: bug#34226: Running (defface my-face-foo ...) just after emacs -Q
 creates a face whose face-id is 0
Date: Mon, 28 Jan 2019 17:26:14 +0200
> From: Eduardo Ochs <eduardoochs <at> gmail.com>
> Date: Sun, 27 Jan 2019 19:42:32 -0200
> 
> In emacs from git the faces that are created in the .emacs receive bad
> face-ids - in particular, the first one gets face-id 0, which is the
> same as the face-id for the "default" face.
> 
> I discovered this bug because the first face that my .emacs creates is
> used to make "^O"s be displayed as red stars, and in git emacs these
> red stars were not being displayed in red.
> 
> The shell script below creates an elisp file - with some code in its
> comments meant be executed by hand - and loads and edits that elisp
> file from both emacs24 and emacs-27.0.50 with "-Q" to show the (bad)
> behaviour that I was getting from my .emacs.

Thanks for the easy test case.  Should be fixed now.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34226; Package emacs. (Wed, 17 Apr 2019 00:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 34226 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Eduardo Ochs <eduardoochs <at> gmail.com>, 34226 <at> debbugs.gnu.org
Subject: Re: bug#34226: Running (defface my-face-foo ...) just after emacs -Q
 creates a face whose face-id is 0
Date: Tue, 16 Apr 2019 20:14:17 -0400
tags 34226 fixed
close 34226 
quit

Eli Zaretskii <eliz <at> gnu.org> writes:

>> In emacs from git the faces that are created in the .emacs receive bad
>> face-ids - in particular, the first one gets face-id 0, which is the
>> same as the face-id for the "default" face.
>> 
>> I discovered this bug because the first face that my .emacs creates is
>> used to make "^O"s be displayed as red stars, and in git emacs these
>> red stars were not being displayed in red.
>> 
>> The shell script below creates an elisp file - with some code in its
>> comments meant be executed by hand - and loads and edits that elisp
>> file from both emacs24 and emacs-27.0.50 with "-Q" to show the (bad)
>> behaviour that I was getting from my .emacs.
>
> Thanks for the easy test case.  Should be fixed now.

No further comments, assuming it is fixed.

cd06d173a6 2019-01-28T17:24:04+02:00 "Fix bug with face-id after restoring from pdump"




Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 17 Apr 2019 00:15:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 34226 <at> debbugs.gnu.org and Eduardo Ochs <eduardoochs <at> gmail.com> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 17 Apr 2019 00:15:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 15 May 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 341 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.