GNU bug report logs -
#19912
facemenu-add-face: does not handle 'face being set to a property list
Previous Next
Reported by: Ivan Shmakov <ivan <at> siamics.net>
Date: Sat, 21 Feb 2015 12:13:01 UTC
Severity: minor
Tags: patch
Done: Ivan Shmakov <ivan <at> siamics.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Please consider the (once again) revised patch MIMEd.
* lisp/faces.el (face-list-p): Split from face-at-point.
(face-at-point): Use it.
* lisp/facemenu.el (facemenu-add-face): Likewise. (Bug#19912)
Unless there be objections, I hope to push this new change
to ‘master’ within the next day or two.
--
FSF associate member #7257 np. Isle of Avalon — Iron Maiden … B6A0 230E 334A
[Message part 2 (text/diff, inline)]
--- 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,17 @@ defun face-nontrivial-p (face &optional frame)
(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 keyword."
+ ;; The logic of merge_face_ref (xfaces.c) is recreated here.
+ (and (listp face-or-list)
+ (not (memq (car face-or-list)
+ '(foreground-color background-color)))
+ (not (keywordp (car face-or-list)))))
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Setting face attributes from X resources.
@@ -1922,11 +1933,7 @@ defun face-at-point (&optional thing multiple)
(get-char-property (point) 'face))))
(cond ((facep faceprop)
(push faceprop faces))
- ((and (listp faceprop)
- ;; Don't treat an attribute spec as a list of faces.
- (not (keywordp (car faceprop)))
- (not (memq (car faceprop)
- '(foreground-color background-color))))
+ ((face-list-p faceprop)
(dolist (face faceprop)
(if (facep face)
(push face faces))))))
This bug report was last modified 10 years and 138 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.