[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 619fc5c: Fix 'face property handling in facemenu-ad
From: |
Ivan Shmakov |
Subject: |
[Emacs-diffs] master 619fc5c: Fix 'face property handling in facemenu-add-face. |
Date: |
Thu, 26 Feb 2015 18:12:31 +0000 |
branch: master
commit 619fc5c197ebef5444aed24fe30657989fc2a839
Author: Ivan Shmakov <address@hidden>
Commit: Ivan Shmakov <address@hidden>
Fix 'face property handling in facemenu-add-face.
* lisp/faces.el (face-list-p): Split from face-at-point.
(face-at-point): Use it.
* lisp/facemenu.el (facemenu-add-face): Likewise.
Fixes: debbugs:19912
---
lisp/ChangeLog | 6 ++++++
lisp/facemenu.el | 2 +-
lisp/faces.el | 17 ++++++++++++-----
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c8e307b..e9f6236 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-26 Ivan Shmakov <address@hidden>
+
+ * faces.el (face-list-p): Split from face-at-point.
+ (face-at-point): Use it.
+ * facemenu.el (facemenu-add-face): Likewise. (Bug#19912)
+
2015-02-26 Oscar Fuentes <address@hidden>
* vc/vc.el (vc-annotate-switches): New defcustom.
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 1a765f9..2c246b4 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -732,7 +732,7 @@ effect. See `facemenu-remove-face-function'."
face
(facemenu-active-faces
(cons face
- (if (listp prev)
+ (if (face-list-p prev)
prev
(list prev)))
;; Specify the selected frame
diff --git a/lisp/faces.el b/lisp/faces.el
index ce74c72..54e444b 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -273,6 +273,17 @@ If FRAME is omitted or nil, use the selected 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 @@ Return nil if there is no face."
(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))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 619fc5c: Fix 'face property handling in facemenu-add-face.,
Ivan Shmakov <=