[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 4eb0303: Compute chart-face-list dynamically
From: |
Stefan Monnier |
Subject: |
Re: master 4eb0303: Compute chart-face-list dynamically |
Date: |
Thu, 18 Mar 2021 11:21:06 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> +(defun chart--face-list ()
> + (and
> + (display-color-p)
> + (let ((cl chart-face-color-list)
> + (pl chart-face-pixmap-list)
> + (faces ())
> + nf)
> + (while cl
> + (setq nf (make-face
> + (intern (concat "chart-" (car cl) "-" (car pl)))))
> + (set-face-background nf (if (condition-case nil
> + (> (x-display-color-cells) 4)
> + (error t))
> + (car cl)
> + "white"))
> + (set-face-foreground nf "black")
> + (if (and chart-face-use-pixmaps pl)
> + (condition-case nil
> + (set-face-background-pixmap nf (car pl))
> + (error (message "Cannot set background pixmap %s" (car pl)))))
> + (push nf faces)
> + (setq cl (cdr cl)
> + pl (cdr pl)))
> + faces)))
BTW, an even better option is to make that face-list not depend on the
display at all, and instead have the definition of each face depend on
the display, which `defface` has supported for eons.
This way the same buffer can appear properly and simultaneously in
different displays with different capabilities.
Stefan
- Re: master 4eb0303: Compute chart-face-list dynamically,
Stefan Monnier <=