unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eduardo Ochs <eduardoochs@gmail.com>
To: 34226@debbugs.gnu.org
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	[thread overview]
Message-ID: <CADs++6jBKqFjb5UEzsf4Frjs=dE1uGHRLXcWGSZPnu12a=EBBQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2744 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3898 bytes --]

             reply	other threads:[~2019-01-27 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-27 21:42 Eduardo Ochs [this message]
2019-01-28 15:26 ` bug#34226: Running (defface my-face-foo ...) just after emacs -Q creates a face whose face-id is 0 Eli Zaretskii
2019-04-17  0:14   ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADs++6jBKqFjb5UEzsf4Frjs=dE1uGHRLXcWGSZPnu12a=EBBQ@mail.gmail.com' \
    --to=eduardoochs@gmail.com \
    --cc=34226@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).