* Re: master 4eb0303: Compute chart-face-list dynamically
[not found] ` <20210318101613.D719D209AA@vcs0.savannah.gnu.org>
@ 2021-03-18 15:21 ` Stefan Monnier
2021-03-19 8:30 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2021-03-18 15:21 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
> +(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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: master 4eb0303: Compute chart-face-list dynamically
2021-03-18 15:21 ` master 4eb0303: Compute chart-face-list dynamically Stefan Monnier
@ 2021-03-19 8:30 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-03-19 8:30 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 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.
Definitely. Using defface instead of creating the faces on the fly
would make more sense in most cases. But I didn't want to change the
interface here -- which is a list of colours, and faces that are created
based on that list.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-19 8:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210318101612.19064.35443@vcs0.savannah.gnu.org>
[not found] ` <20210318101613.D719D209AA@vcs0.savannah.gnu.org>
2021-03-18 15:21 ` master 4eb0303: Compute chart-face-list dynamically Stefan Monnier
2021-03-19 8:30 ` Lars Ingebrigtsen
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).