--- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -732,7 +732,7 @@ defun facemenu-add-face (face &optional start end) face (facemenu-active-faces (cons face - (if (listp prev) + (if (face-list-p prev) prev (list prev))) ;; Specify the selected frame --- a/lisp/faces.el +++ b/lisp/faces.el @@ -273,6 +273,22 @@ (not (internal-lisp-face-empty-p face frame))) +(defun face-list-p (face-or-list) + "True if FACE-OR-LIST is a list of faces. +Return nil if FACE-OR-LIST is a non-nil atom, or a cons cell whose car +is either 'foreground-color, 'background-color, or a symbol starting +with a colon (:)." + ;; The logic of merge_face_ref (xfaces.c) is recreated here. + (or (null face-or-list) + (and (consp face-or-list) + (symbolp (car face-or-list)) + (not (memq (car face-or-list) + '(foreground-color background-color))) + (let ((n (symbol-name (car face-or-list)))) + (or (zerop (length n)) + (not (eq ?: (aref n 0)))))))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Setting face attributes from X resources.