all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Boris Buliga <boris@d12frosted.io>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Overriding inherited face attributes
Date: Wed, 28 Nov 2018 23:44:47 +0200	[thread overview]
Message-ID: <CAD5F_-DDur7xO66+HG8tR-zmiXkEy8hTswhwRnXHEBkmTJJSZg@mail.gmail.com> (raw)
In-Reply-To: <83in0hdjo4.fsf@gnu.org>

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


  parent reply	other threads:[~2018-11-28 21:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-27 20:18 Overriding inherited face attributes Boris Buliga
2018-11-27 21:33 ` Stephen Berman
2018-11-28  6:19   ` Eli Zaretskii
2018-11-28 12:24     ` Stephen Berman
2018-11-28 13:06       ` Eli Zaretskii
2018-11-28 13:13         ` Stephen Berman
2018-11-28 16:18           ` Eli Zaretskii
2018-11-28 20:01             ` Stephen Berman
2018-11-28 20:35               ` Eli Zaretskii
2018-11-28 21:34                 ` Stephen Berman
2018-11-29  7:14                   ` Eli Zaretskii
2018-11-29 17:30                     ` Stephen Berman
2018-11-28 21:44                 ` Boris Buliga [this message]
2018-11-29  7:08                   ` Eli Zaretskii
2018-11-28  7:39   ` Boris Buliga
2018-11-28  7:51     ` Eli Zaretskii
2018-11-28  8:42       ` Boris Buliga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAD5F_-DDur7xO66+HG8tR-zmiXkEy8hTswhwRnXHEBkmTJJSZg@mail.gmail.com \
    --to=boris@d12frosted.io \
    --cc=eliz@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.