all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Óscar Fuentes" <ofv@wanadoo.es>
To: help-gnu-emacs@gnu.org
Subject: Trying to define face dynamically
Date: Thu, 17 Oct 2019 20:54:34 +0200	[thread overview]
Message-ID: <87pnivnqxh.fsf@telefonica.net> (raw)

(Apologies if this message arrives duplicated. Seems that gmane is
eatin/delaying messages again)

On this mode, which uses Emacs 27 specific features:

https://raw.githubusercontent.com/dcolascione/emacs-window-highlight/master/window-highlight.el

I stumbled on

(mapcar (lambda (face)
           (face-remap-add-relative
              face '(:filtered (:window has-keyboard-focus t)
                       window-highlight-focused-window)))
    '(default fringe))

This remaps faces "default" and "fringe" to the face
window-highlight-focused-window (defined elsewhere by the user).

I'm trying to get rid of the hard-coded window-highlight-focused-window
face, take the current face and calculate the new attributes on the fly,
so when the theme changes everything is automatically adapted.

Teorically this would darken the background of the windows that have no
keyboard focus by 10%:

(mapcar (lambda (face)
           (face-remap-add-relative
              face `(:filtered (:window has-keyboard-focus nil)
                     :background ,(color-darken-name
                                   (face-attribute face :background)
				   10.0))))
    '(default fringe))

But this has not the desired effect: faces remain the same and every now
and then Emacs throws an error "wrong-type-argument stringp nil" from
functions such as font-info.

What I'm doing wrong?



             reply	other threads:[~2019-10-17 18:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 18:54 Óscar Fuentes [this message]
2019-10-17 19:30 ` Trying to define face dynamically Eli Zaretskii
2019-10-17 19:54   ` Óscar Fuentes
2019-10-18  0:15     ` Óscar Fuentes

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=87pnivnqxh.fsf@telefonica.net \
    --to=ofv@wanadoo.es \
    --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.