[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 59bbbbc 5/6: company-text-icons-margin: Better
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 59bbbbc 5/6: company-text-icons-margin: Better handling of unspecified colors |
Date: |
Wed, 5 May 2021 15:57:09 -0400 (EDT) |
branch: externals/company
commit 59bbbbc83f257286e4872743c190d8239a0c8495
Author: Mohsin Kaleem <mohkale@kisara.moe>
Commit: Mohsin Kaleem <mohkale@kisara.moe>
company-text-icons-margin: Better handling of unspecified colors
For some reason `face-attribute` returns unspecified on a missing
property instead of nil.
---
company.el | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/company.el b/company.el
index e4ebe85..6a7c57c 100644
--- a/company.el
+++ b/company.el
@@ -1556,17 +1556,25 @@ See `company-text-icons-mapping'."
(declare-function color-rgb-to-hex "color")
(declare-function color-gradient "color")
+(cl-defsubst company-text-icons--extract-property (face property)
+ "Try to extract PROPERTY from FACE.
+If FACE isn't a valid face return FACE as is. If FACE doesn't have
+PROPERTY return nil."
+ (if (facep face)
+ (let ((value (face-attribute face property)))
+ (unless (eq value 'unspecified)
+ value))
+ face))
+
(defun company-text-icons--face (fg bg selected)
- (let ((fg-color (if (facep fg) (face-attribute fg :foreground) fg)))
+ (let ((fg-color (company-text-icons--extract-property fg :foreground)))
`(,@company-text-face-extra-attributes
,@(and fg-color
(list :foreground fg-color))
,@(let* ((bg-is-cons (consp bg))
(bg (if bg-is-cons (if selected (cdr bg) (car bg)) bg))
- (bg-color (if (facep bg) (face-attribute bg :background) bg))
- (bg-color (unless (eq bg-color 'unspecified)
- bg-color))
- (tooltip-bg-color (face-attribute
+ (bg-color (company-text-icons--extract-property bg :background))
+ (tooltip-bg-color (company-text-icons--extract-property
(if selected
'company-tooltip-selection
'company-tooltip)
- [elpa] externals/company updated (9074b71 -> b1b51b5), ELPA Syncer, 2021/05/05
- [elpa] externals/company 38d7542 3/6: company-text-icons-margin: Swap order of BG cons, ELPA Syncer, 2021/05/05
- [elpa] externals/company 3d7110b 1/6: company-text-icons-mapping: Merge faces/colors into format, ELPA Syncer, 2021/05/05
- [elpa] externals/company 1657962 2/6: company-text-icons-mapping: Allow either FG/BG to be face or string, ELPA Syncer, 2021/05/05
- [elpa] externals/company 15bd239 4/6: company-text-icons-margin: Always adjust bg on select, ELPA Syncer, 2021/05/05
- [elpa] externals/company b1b51b5 6/6: Merge pull request #1099 from mohkale/color-text-icons, ELPA Syncer, 2021/05/05
- [elpa] externals/company 59bbbbc 5/6: company-text-icons-margin: Better handling of unspecified colors,
ELPA Syncer <=