From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.bugs Subject: bug#34226: 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-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000af884505807770b7" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="156583"; mail-complaints-to="usenet@blaine.gmane.org" To: 34226@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 27 22:43:16 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gnsCy-000ebo-0u for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Jan 2019 22:43:16 +0100 Original-Received: from localhost ([127.0.0.1]:50756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnsCw-0001QN-Si for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 Jan 2019 16:43:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnsCl-0001QF-LN for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 16:43:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnsCk-00043T-Ah for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 16:43:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48735) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnsCk-000430-6t for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 16:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gnsCk-0002Ix-0n for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 16:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eduardo Ochs Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Jan 2019 21:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34226 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15486253788847 (code B ref -1); Sun, 27 Jan 2019 21:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Jan 2019 21:42:58 +0000 Original-Received: from localhost ([127.0.0.1]:48016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnsCg-0002Id-1X for submit@debbugs.gnu.org; Sun, 27 Jan 2019 16:42:58 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gnsCc-0002IP-VW for submit@debbugs.gnu.org; Sun, 27 Jan 2019 16:42:56 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:45182) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gnsCX-0003sF-MU for submit@debbugs.gnu.org; Sun, 27 Jan 2019 16:42:49 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:34987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnsCW-0001Q7-DF for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 16:42:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnsCU-0003os-SA for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 16:42:48 -0500 Original-Received: from mail-qt1-x82e.google.com ([2607:f8b0:4864:20::82e]:46465) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnsCU-0003j0-KR for bug-gnu-emacs@gnu.org; Sun, 27 Jan 2019 16:42:46 -0500 Original-Received: by mail-qt1-x82e.google.com with SMTP id y20so16275315qtm.13 for ; Sun, 27 Jan 2019 13:42:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=exlxJON21nld8m2zCdQMSBNjWefJuajRePHuLUN6K88=; b=BKCt2TK6HrP8gOCYKOIWBQ6NhNrJz/AIw6z/WdI65CIA6dQgjgxnS/SshZAO/7CbkC DddiR7VZhLvSzqW1nMj2fm5D8wjmO+XT2ldm7fKWYo9Hy40i6iXp1gvY9+Z+XTM71Iwx IvHlgLk4Fszw9etsWI/UQXBMyL1tdL8VGb34/FXM5xrqCkJMFFQ9Cz1X/Wq2QLzDMwwT Dkj0y+k61Ky5mxqsqIq1sMz0F1nJJPx3qUB1zbk3tjtVLFzCc5E9aqQb45/PZ3z0W5Xm /FEI+3bg9W2Rf+LPJxqkRHymtdDr5fT53J+mAOnPHvsm6jFzkxb1XqCpDArmDbH5QNvt Wk9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=exlxJON21nld8m2zCdQMSBNjWefJuajRePHuLUN6K88=; b=WC4x4eY7oMvBwuoDrLAK+oiTbm65+9dr8zxUi/ms0JIoOPhtN9QcESQyWEKgsQ0egT zBPm3Q/s9Ao4bTHM9/4PJ7g1p+skB8oNL3qrCifr8NT347ixcurnj0BtSDANYL6SA52G fROggvH3+IHxD6e97TWc0VT2QWnZix7EQLUKjYh4Bqti8zwRLh+yqjPgLRhoMEtvtEoX tZ2C8JQ+f0jbSiJU1+Fsto11443ECblqM2VauczVzVq4xD24BXSTsKNv5AJpvDExcipr mmeri8AXP7jR0QbMoZLBWbGnhQP6TvujNac4sk74Tu/q1k4eExtVJ7/kOVHm5wmAc+te 6F5Q== X-Gm-Message-State: AJcUukcC2VCFa7CKsSk4d9P4RMxRnq1nt6/8e/7QAh3BTvwNM5CDz3LR dvamU6guTFOsHJW+L47F0AkrXc0oIdlt/0BS5PQVAjw5 X-Google-Smtp-Source: ALg8bN6XhdhGcq2plUniasvZ31RCc2eivsu7QxKeQVFE1wJALPmXFVlc2z+Aw33bbGy/xpCr9s76zNpzlH6JsM5YbqQ= X-Received: by 2002:a0c:89e9:: with SMTP id 38mr18482895qvs.31.1548625363566; Sun, 27 Jan 2019 13:42:43 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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" Xref: news.gmane.org gmane.emacs.bugs:154830 Archived-At: --000000000000af884505807770b7 Content-Type: text/plain; charset="UTF-8" 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 --000000000000af884505807770b7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 th= e "default" face.

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

The shell= script below creates an elisp file - with some code in its
comme= nts meant be executed by hand - and loads and edits that elisp
fi= le 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:
<= br>
In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Vers= ion 3.18.9)
=C2=A0of 2019-01-22 built on libreboot-ThinkPad-T400<= /div>
Repository revision: fd943124439b7644392919bca8bc2a77e6316d92
Repository branch: master
Windowing system distributor = 9;The X.Org Foundation', version 11.0.11804000
System Descrip= tion: Trisquel GNU/Linux Flidas (8.0)

=C2=A0 Cheer= s,
=C2=A0 =C2=A0 Eduardo Ochs

=

--snip--snip--


= cat > /tmp/face-id-bug.el <<'%%%'
;; A test file= for the face id bug.
;; How to use this: run
;;=C2=A0 = =C2=A0emacs24=C2=A0 =C2=A0 =C2=A0 -Q -l /tmp/face-id-bug.el /tmp/face-id-bu= g.el
;;=C2=A0 =C2=A0emacs27.0.50 -Q -l /tmp/face-id-bug.el /tmp/f= ace-id-bug.el
;; and in each case execute the sexps in comments b= elow.

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

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

(defun my-set-glyph (pos char face)
=C2=A0 (ase= t standard-display-table pos
(vector (make-glyph-code char face))))

(if (no= t standard-display-table)
=C2=A0 =C2=A0 (setq standard-display-ta= ble (make-display-table)))

(my-set-glyph ?\^O ?* &= #39;my-face-red)
(my-set-glyph ?\^P ?! 'my-face-green)
<= div>
;; Here's how to see the bug. Run this with C-x C-e:=
;;=C2=A0 =C2=A0(insert 10 15 16)
;; it will insert a n= ewline, a char 15 - displayed as a red star
;; glyph - and a char= 16 - displayed as a green bang glyph.
;;
;; PROBLEM: i= n 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: t= his MAY be related to how emacs attributes face-ids to
;; newly-c= reate faces. In Emacs 24 all these face-ids are different:
;;=C2= =A0 (face-id 'default)
;;=C2=A0 (face-id 'my-face-red)
;;=C2=A0 (face-id 'my-face-green)
;; and in git Emacs= the first two are zero - which means that
;;=C2=A0 (make-glyph-c= ode ?* 'my-face-red)
;;=C2=A0 (make-glyph-code ?* 'defaul= t)
;; are indistinguishable.
%%%


emacs24=C2=A0 =C2=A0 =C2=A0 =C2=A0-Q -l /tmp/face-id-bug.= el /tmp/face-id-bug.el
emacs-27.0.50 -Q -l /tmp/face-id-bug.e= l /tmp/face-id-bug.el

--000000000000af884505807770b7--