aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Shmakov2015-02-26 18:09:48 +0000
committerIvan Shmakov2015-02-26 18:09:48 +0000
commit619fc5c197ebef5444aed24fe30657989fc2a839 (patch)
treeb72fe2090fed30313f1eff9435b673cd22b14efa
parent5917b7907ad0cdc38f14967d16aa8472be572e3f (diff)
downloademacs-619fc5c197ebef5444aed24fe30657989fc2a839.tar.gz
emacs-619fc5c197ebef5444aed24fe30657989fc2a839.zip
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
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/facemenu.el2
-rw-r--r--lisp/faces.el17
3 files changed, 19 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c8e307b213b..e9f62365f03 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12015-02-26 Ivan Shmakov <ivan@siamics.net>
2
3 * faces.el (face-list-p): Split from face-at-point.
4 (face-at-point): Use it.
5 * facemenu.el (facemenu-add-face): Likewise. (Bug#19912)
6
12015-02-26 Oscar Fuentes <ofv@wanadoo.es> 72015-02-26 Oscar Fuentes <ofv@wanadoo.es>
2 8
3 * vc/vc.el (vc-annotate-switches): New defcustom. 9 * vc/vc.el (vc-annotate-switches): New defcustom.
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 1a765f9ebdb..2c246b44d54 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -732,7 +732,7 @@ effect. See `facemenu-remove-face-function'."
732 face 732 face
733 (facemenu-active-faces 733 (facemenu-active-faces
734 (cons face 734 (cons face
735 (if (listp prev) 735 (if (face-list-p prev)
736 prev 736 prev
737 (list prev))) 737 (list prev)))
738 ;; Specify the selected frame 738 ;; Specify the selected frame
diff --git a/lisp/faces.el b/lisp/faces.el
index ce74c728474..54e444b730a 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -273,6 +273,17 @@ If FRAME is omitted or nil, use the selected frame."
273 (not (internal-lisp-face-empty-p face frame))) 273 (not (internal-lisp-face-empty-p face frame)))
274 274
275 275
276(defun face-list-p (face-or-list)
277 "True if FACE-OR-LIST is a list of faces.
278Return nil if FACE-OR-LIST is a non-nil atom, or a cons cell whose car
279is either 'foreground-color, 'background-color, or a keyword."
280 ;; The logic of merge_face_ref (xfaces.c) is recreated here.
281 (and (listp face-or-list)
282 (not (memq (car face-or-list)
283 '(foreground-color background-color)))
284 (not (keywordp (car face-or-list)))))
285
286
276 287
277;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 288;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
278;;; Setting face attributes from X resources. 289;;; Setting face attributes from X resources.
@@ -1922,11 +1933,7 @@ Return nil if there is no face."
1922 (get-char-property (point) 'face)))) 1933 (get-char-property (point) 'face))))
1923 (cond ((facep faceprop) 1934 (cond ((facep faceprop)
1924 (push faceprop faces)) 1935 (push faceprop faces))
1925 ((and (listp faceprop) 1936 ((face-list-p faceprop)
1926 ;; Don't treat an attribute spec as a list of faces.
1927 (not (keywordp (car faceprop)))
1928 (not (memq (car faceprop)
1929 '(foreground-color background-color))))
1930 (dolist (face faceprop) 1937 (dolist (face faceprop)
1931 (if (facep face) 1938 (if (facep face)
1932 (push face faces)))))) 1939 (push face faces))))))