unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* face-remap-add-relative and map-apply in mode hook
@ 2020-11-21 15:33 Oscar Brink
  2020-11-21 16:07 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Oscar Brink @ 2020-11-21 15:33 UTC (permalink / raw)
  To: help-gnu-emacs

I want to add a hook to a major mode to change how some faces look in the mode.

I do not understand why the following does not work

(1)
;; This does NOT work
(lambda ()
  (map-apply (lambda (face specs) (face-remap-add-relative face specs))
	  '(('font-lock-comment-delimiter-face . (:foreground "#6EDA8D"))
	    ('font-lock-comment-face . (:foreground "#6EDA8D")))))

AFAICT using the debugger, (1) does run face-remap-add-relative but nothing happens visually.

(2)
;; This does work
(lambda ()
  (progn
    (face-remap-add-relative 'font-lock-comment-delimiter-face :foreground "#6EDA8D")
    (face-remap-add-relative 'font-lock-comment-face :foreground "#6EDA8D"))

(2) works. It seems to me to be roughly equivalent to (1).

Regards,
Oscar



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: face-remap-add-relative and map-apply in mode hook
  2020-11-21 15:33 face-remap-add-relative and map-apply in mode hook Oscar Brink
@ 2020-11-21 16:07 ` Eli Zaretskii
  2020-11-22 14:17   ` Michael Heerdegen
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2020-11-21 16:07 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 21 Nov 2020 15:33:05 +0000
> From: "Oscar Brink" <oscar@brink.pw>
> 
> I do not understand why the following does not work
> 
> (1)
> ;; This does NOT work
> (lambda ()
>   (map-apply (lambda (face specs) (face-remap-add-relative face specs))
> 	  '(('font-lock-comment-delimiter-face . (:foreground "#6EDA8D"))
> 	    ('font-lock-comment-face . (:foreground "#6EDA8D")))))

For starters, remove the quotes from the file names inside the quoted
list.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: face-remap-add-relative and map-apply in mode hook
  2020-11-21 16:07 ` Eli Zaretskii
@ 2020-11-22 14:17   ` Michael Heerdegen
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Heerdegen @ 2020-11-22 14:17 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

> > ;; This does NOT work
> > (lambda ()
> >   (map-apply (lambda (face specs) (face-remap-add-relative face specs))
> > 	  '(('font-lock-comment-delimiter-face . (:foreground "#6EDA8D"))
> > 	    ('font-lock-comment-face . (:foreground "#6EDA8D")))))
>
> For starters, remove the quotes from the file names inside the quoted
> list.

Yip (from the face names).  Then it works for me.

Michael.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-22 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-21 15:33 face-remap-add-relative and map-apply in mode hook Oscar Brink
2020-11-21 16:07 ` Eli Zaretskii
2020-11-22 14:17   ` Michael Heerdegen

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).