[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Overriding inherited face attributes
From: |
Boris Buliga |
Subject: |
Re: Overriding inherited face attributes |
Date: |
Wed, 28 Nov 2018 23:44:47 +0200 |
Hi,
I don't see how it's specific to propetize. I can attach face differently,
for
example, by using add-text-properties or add-face-text-property:
> (setq my-test-string "hello")
"hello"
> (add-text-properties 0 5 '(face (:inherit (:foreground "orange")))
my-test-string)
nil
> my-test-string
#("hello" 0 5 (face (:inherit (:foreground "orange"))))
;; insert it and you'll get orange text
> (setq my-test-string "hello")
"hello"
> (add-text-properties 0 5 '(face (:foreground "red" :inherit
(:foreground "orange"))) my-test-string)
nil
> my-test-string
#("hello" 0 5 (face (:foreground "red" :inherit (:foreground "orange"))))
;; insert it and you'll get orange text
> (setq my-test-string "hello")
"hello"
> (add-text-properties 0 5 '(face (:inherit (:foreground "orange")
:foreground "red" )) my-test-string)
nil
> my-test-string
#("hello" 0 5 (face (:inherit (:foreground "orange") :foreground "red")))
;; insert it and you'll get red text
> (setq my-test-string "hello")
"hello"
> (add-text-properties 0 5 '(face ((:foreground "red") (:inherit
(:foreground "orange")))) my-test-string)
nil
> my-test-string
#("hello" 0 5 (face ((:foreground "red") (:inherit ...))))
;; insert it and you'll get red text
> (setq my-test-string "hello")
"hello"
> (add-text-properties 0 5 '(face ((:inherit (:foreground "orange"))
(:foreground "red"))) my-test-string)
nil
> my-test-string
#("hello" 0 5 (face ((:inherit ...) (:foreground "red"))))
;; insert it and you'll get orange text
> (setq my-test-string "hello")
"hello"
> (add-face-text-property 0 5 '( :foreground "red" :inherit (:foreground
"orange")) nil my-test-string)
nil
> my-test-string
#("hello" 0 5 (face (:foreground "red" :inherit (:foreground "orange"))))
;; insert it and you'll get orange text
> (setq my-test-string "hello")
"hello"
> (add-face-text-property 0 5 '(:inherit (:foreground "orange")
:foreground "red") nil my-test-string)
nil
> my-test-string
#("hello" 0 5 (face (:inherit (:foreground "orange") :foreground "red")))
;; insert it and you'll get red text
As you can see, it's a matter of properties. No matter how you add them,
using
propertize, add-text-properties or add-face-text-property.
On Wed, 28 Nov 2018 at 22:37, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Stephen Berman <stephen.berman@gmx.net>
> > Cc: help-gnu-emacs@gnu.org
> > Date: Wed, 28 Nov 2018 21:01:36 +0100
> >
> > It would be helpful to know from precisely which part of the
> > documentation it follows that evaluating this:
> >
> > (insert (propertize "hello" 'face '(:foreground "red" :inherit
> > (:foreground "orange"))))
> >
> > displays "hello" in orange while evaluating this:
> >
> > (insert (propertize "hello" 'face '(:inherit (:foreground "orange")
> > :foreground "red")))
> >
> > displays "hello" in red.
>
> So this is only about what propertize does? And only when some of the
> later properties override earlier ones?
>
> > I don't see how it follows from the passage in the Lisp manual I
> > cited ("Faces occurring earlier in the list have higher priority")
>
> It doesn't, because what you cited is not related to propertize, it's
> related to how we process faces that come from several different
> sources that affect the same piece of text.
>
>
--
Cheers,
Boris
- Re: Overriding inherited face attributes, (continued)
- Re: Overriding inherited face attributes, Eli Zaretskii, 2018/11/28
- Re: Overriding inherited face attributes, Stephen Berman, 2018/11/28
- Re: Overriding inherited face attributes, Eli Zaretskii, 2018/11/28
- Re: Overriding inherited face attributes, Stephen Berman, 2018/11/28
- Re: Overriding inherited face attributes, Eli Zaretskii, 2018/11/28
- Re: Overriding inherited face attributes, Stephen Berman, 2018/11/28
- Re: Overriding inherited face attributes, Eli Zaretskii, 2018/11/28
- Re: Overriding inherited face attributes, Stephen Berman, 2018/11/28
- Re: Overriding inherited face attributes, Eli Zaretskii, 2018/11/29
- Re: Overriding inherited face attributes, Stephen Berman, 2018/11/29
- Re: Overriding inherited face attributes,
Boris Buliga <=
- Re: Overriding inherited face attributes, Eli Zaretskii, 2018/11/29
Re: Overriding inherited face attributes, Boris Buliga, 2018/11/28