unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34226: Running (defface my-face-foo ...) just after emacs -Q creates a face whose face-id is 0
@ 2019-01-27 21:42 Eduardo Ochs
  2019-01-28 15:26 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Ochs @ 2019-01-27 21:42 UTC (permalink / raw)
  To: 34226

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-17  0:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-27 21:42 bug#34226: Running (defface my-face-foo ...) just after emacs -Q creates a face whose face-id is 0 Eduardo Ochs
2019-01-28 15:26 ` Eli Zaretskii
2019-04-17  0:14   ` Noam Postavsky

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).