bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34226: Running (defface my-face-foo ...) just after emacs -Q creates


From: Eduardo Ochs
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

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]