I'd like to locally remap a face to other custom face. The docstring reads:
(face-remap-set-base FACE &rest SPECS)
Set the base remapping of
FACE
in the current buffer toSPECS
. This causes the remappings specified by ‘face-remap-add-relative
’ to apply on top of the face specification given bySPECS
.The remaining arguments,
SPECS
, should form a list of faces. Each list element should be either a face name or a property list of face attribute/value pairs, like in a ‘face’ text property.
Armed with this knowledge, I tried:
(defface my/exceptional-face
'((t (:background "red")))
"My exceptional face.")
(face-remap-set-base 'font-lock-keyword-face '(my/exceptional-face))
In a Lisp buffer, M-x eval-buffer RET
, I'd expect the keywords to show up with a red background. However, this fails with:
(wrong-type-argument listp my/exceptional-face)
Indeed, the face-remap-set-base
function reads:
(defun face-remap-set-base (face &rest specs)
(while (and (consp specs) (not (null (car specs))) (null (cdr specs)))
(setq specs (car specs)))
(if (or (null specs)
(and (eq (car specs) face) (null (cdr specs)))) ; Error raised here
;; Set entry back to default
(face-remap-reset-base face)
;; Set the base remapping
...snip...))
It thus seems that there's no way I can pass a single face to this function. Using:
(face-remap-set-base 'font-lock-keyword-face '(my/exceptional-face nil))
…seems to work though. Is that the expected behavior, or is this a bug?