* Faces?
@ 2020-07-01 15:40 Douglas Lewan
2020-07-01 16:23 ` Faces? Eli Zaretskii
2020-07-01 17:23 ` Faces? Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 7+ messages in thread
From: Douglas Lewan @ 2020-07-01 15:40 UTC (permalink / raw)
To: help-gnu-emacs
Is there a "Hello, World!" kind of tutorial about setting (and
unsetting) faces?
The only thing I find in the emacs info suggests putting face attributes
character by character. I can do that, but there has to be something
more appropriately abstract.
--
,Doug
d.lewan2000@gmail.com
(908) 720 7908
If this is what winning looks like, I'd hate to see what losing is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Faces?
2020-07-01 15:40 Faces? Douglas Lewan
@ 2020-07-01 16:23 ` Eli Zaretskii
2020-07-01 20:51 ` Faces? Douglas Lewan
2020-07-01 17:23 ` Faces? Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-07-01 16:23 UTC (permalink / raw)
To: help-gnu-emacs
> From: Douglas Lewan <d.lewan2000@gmail.com>
> Date: Wed, 1 Jul 2020 11:40:54 -0400
>
> The only thing I find in the emacs info suggests putting face attributes
> character by character. I can do that, but there has to be something
> more appropriately abstract.
Did you look at facemenu.el?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Faces?
2020-07-01 16:23 ` Faces? Eli Zaretskii
@ 2020-07-01 20:51 ` Douglas Lewan
2020-07-01 21:14 ` Faces? Stefan Monnier
2020-07-02 0:41 ` Faces? Emanuel Berg via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 7+ messages in thread
From: Douglas Lewan @ 2020-07-01 20:51 UTC (permalink / raw)
To: help-gnu-emacs
Thanks for all the help. It turns out the door into what I want is the
two functions (add-face-text-property) and (face-list) (or M-x
list-faces-display). From there I'm sure I can begin to do more
sophisticated things.
And, yes, I'm embarrassed that I hadn't looked at any existing lisp code.
--
,Doug
d.lewan2000@gmail.com
(908) 720 7908
If this is what winning looks like, I'd hate to see what losing is.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Faces?
2020-07-01 15:40 Faces? Douglas Lewan
2020-07-01 16:23 ` Faces? Eli Zaretskii
@ 2020-07-01 17:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-07-01 17:31 ` Faces? Emanuel Berg via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 7+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2020-07-01 17:23 UTC (permalink / raw)
To: help-gnu-emacs
Douglas Lewan wrote:
> Is there a "Hello, World!" kind of tutorial about
> setting (and unsetting) faces?
>
> The only thing I find in the emacs info suggests
> putting face attributes character by character.
> I can do that, but there has to be something more
> appropriately abstract.
Here are some face stuff:
;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;; http://user.it.uu.se/~embe8573/emacs-init/test-faces.el
;;; https://dataswamp.org/~incal/emacs-init/test-faces.el
(defun insert-colored-text (str color bright)
"Insert STR at point, in COLOR, and sometimes BRIGHT."
(interactive (list (read-string "string: ")
(read-string "color: ")
(y-or-n-p "bright? ") ))
(insert (propertize str 'font-lock-face
`(:weight ,(if bright 'bold 'normal) :foreground ,color) )))
;; use this to test
(when nil
(progn
(forward-line 1)
(insert "The French flag is ")
(insert-colored-text "blue, " "blue" t)
(insert-colored-text "white, " "white" t)
(insert "and" )
(insert-colored-text " red." "red" nil) ) ; <- eval me
)
(defun test-all-faces ()
"Print a test string in every color, normal and bright."
(interactive)
(forward-line 1)
(let ((str "this is what it looks like"))
(dolist (bold '(nil t))
(dolist (color '("black" "red" "green" "yellow" "blue"
"magenta" "cyan" "white") )
(insert-colored-text
(format "%s in %s (that is %sbold)\n" str color
(if bold "" "not "))
color bold) ))))
;; test all colors:
;; (test-all-faces) ; <- eval me
And even more in this long file [1], in particular
the `font-lock-add-keywords' stuff (line 27) and
"what-face" (line 49).
I wonder tho... why is this, uhm, required?
(require 'erc-button)
(require 'erc-match)
The byte compiler doesn't issue any complaint if
I comment it out. But without it, Emacs reports an
invalid face error on boot (when the file is loaded).
What I can see ERC doesn't get any special treatment
in that file, either.
[1] https://dataswamp.org/~incal/emacs-init/my-faces.el
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-02 0:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-01 15:40 Faces? Douglas Lewan
2020-07-01 16:23 ` Faces? Eli Zaretskii
2020-07-01 20:51 ` Faces? Douglas Lewan
2020-07-01 21:14 ` Faces? Stefan Monnier
2020-07-02 0:41 ` Faces? Emanuel Berg via Users list for the GNU Emacs text editor
2020-07-01 17:23 ` Faces? Emanuel Berg via Users list for the GNU Emacs text editor
2020-07-01 17:31 ` Faces? Emanuel Berg via Users list for the GNU Emacs text editor
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).