[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-25 4f19767: * lisp/faces.el (faces--attribute-at-poi
From: |
Artur Malabarba |
Subject: |
[Emacs-diffs] emacs-25 4f19767: * lisp/faces.el (faces--attribute-at-point): Fix an issue |
Date: |
Sun, 15 Nov 2015 17:44:17 +0000 |
branch: emacs-25
commit 4f19767dfa527955b94c9133e8ce03cf1c766750
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>
* lisp/faces.el (faces--attribute-at-point): Fix an issue
Previous code would signal an error when the face at point was
a manually built list of attributes such as '(:foregroud "white").
* test/automated/faces-tests.el (faces--test-color-at-point): Add a test
---
lisp/faces.el | 6 +++++-
test/automated/faces-tests.el | 5 +++++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/lisp/faces.el b/lisp/faces.el
index f96df05..d612461 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1971,7 +1971,11 @@ unnamed faces (e.g, `foreground-color')."
(get-char-property (point) 'font-lock-face))
(get-char-property (point) 'face)))
(found nil))
- (dolist (face (if (listp faces) faces (list faces)))
+ ;; The attribute might be a face, a list of faces, or a list of
+ ;; attributes that make a face. Normalize it to a list of faces.
+ (dolist (face (if (and (listp faces) (facep (car faces)))
+ faces
+ (list faces)))
(cond (found)
((and face (symbolp face))
(let ((value (face-attribute-specified-or
diff --git a/test/automated/faces-tests.el b/test/automated/faces-tests.el
index 007bc80..ff9dfc5 100644
--- a/test/automated/faces-tests.el
+++ b/test/automated/faces-tests.el
@@ -38,6 +38,11 @@
(should (equal (background-color-at-point) "black"))
(should (equal (foreground-color-at-point) "black")))
(with-temp-buffer
+ (insert (propertize "STRING" 'face '(:foreground "black" :background
"black")))
+ (goto-char (point-min))
+ (should (equal (background-color-at-point) "black"))
+ (should (equal (foreground-color-at-point) "black")))
+ (with-temp-buffer
(emacs-lisp-mode)
(setq-local font-lock-comment-face 'faces--test1)
(setq-local font-lock-constant-face 'faces--test2)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-25 4f19767: * lisp/faces.el (faces--attribute-at-point): Fix an issue,
Artur Malabarba <=