[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kind-icon 77cc6f8: Return unknown if kind has not match
From: |
ELPA Syncer |
Subject: |
[elpa] externals/kind-icon 77cc6f8: Return unknown if kind has not match |
Date: |
Mon, 22 Nov 2021 22:57:20 -0500 (EST) |
branch: externals/kind-icon
commit 77cc6f8672c72b4fe0408e5fb168968dc0df3daa
Author: JD Smith <93749+jdtsmith@users.noreply.github.com>
Commit: JD Smith <93749+jdtsmith@users.noreply.github.com>
Return unknown if kind has not match
---
kind-icon.el | 89 ++++++++++++++++++++++++++++++------------------------------
1 file changed, 45 insertions(+), 44 deletions(-)
diff --git a/kind-icon.el b/kind-icon.el
index 05af346..354c374 100644
--- a/kind-icon.el
+++ b/kind-icon.el
@@ -226,51 +226,52 @@ frame background color) and the foreground. If
the :face's background, `kind-icon-default-face', or the frame
background-color."
(or (alist-get kind kind-icon--cache)
- (when-let ((map (assq kind kind-icon-mapping))
+ (if-let ((map (assq kind kind-icon-mapping))
(plist (cddr map)))
- (let* ((kind-face (plist-get plist :face))
- (col (if kind-face
- (face-attribute kind-face :foreground nil t)
- (if kind-icon-default-face
- (face-attribute kind-icon-default-face :foreground
nil t)
- (frame-parameter nil 'foreground-color))))
- (kind-face-bg (and kind-face
- (face-attribute kind-face :background nil t)))
- (default-bg (if kind-icon-default-face
- (face-attribute kind-icon-default-face
:background nil t)
- (frame-parameter nil 'background-color)))
- (bg-col (if kind-icon-blend-background
- (kind-icon--rgb-blend
- (color-name-to-rgb col)
- (color-name-to-rgb default-bg)
- kind-icon-blend-frac)
- (if (and kind-face-bg (not (eq kind-face-bg
'unspecified)))
- kind-face-bg
- default-bg)))
- (dfw (default-font-width))
- (half (/ dfw 2))
- (pad-right (propertize " " 'display `(space :width (,half))))
- (pad-left (propertize " " 'display `(space :width (,(- dfw
half)))))
- (disp (if-let ((kind-icon-use-icons)
- (icon-name (plist-get plist :icon))
- (icon (kind-icon--get-icon-safe icon-name col
bg-col)))
- ;; icon: always 2x1, half-space on each side
- (propertize ; pretend it's one char to allow padding
- (concat pad-left (propertize "*" 'display icon)
pad-right)
- 'face `(:background ,bg-col))
- ;; text, 1 or 2 chars, centered with full or half space
on each side
- (let* ((txt (truncate-string-to-width (cadr map) 2))
- (len (length txt))
- (txt-disp (if (eq len 2)
- (concat pad-left
- (propertize "_" 'display
txt)
- pad-right)
- (concat " " txt " "))))
- (propertize txt-disp 'face
- `(:weight bold :foreground ,col
:background ,bg-col))))))
- (if disp
- (setf (alist-get kind kind-icon--cache) disp)
- (propertize (concat pad-left "??" pad-right) 'face
font-lock-warning-face))))))
+ (let* ((kind-face (plist-get plist :face))
+ (col (if kind-face
+ (face-attribute kind-face :foreground nil t)
+ (if kind-icon-default-face
+ (face-attribute kind-icon-default-face :foreground
nil t)
+ (frame-parameter nil 'foreground-color))))
+ (kind-face-bg (and kind-face
+ (face-attribute kind-face :background nil
t)))
+ (default-bg (if kind-icon-default-face
+ (face-attribute kind-icon-default-face
:background nil t)
+ (frame-parameter nil 'background-color)))
+ (bg-col (if kind-icon-blend-background
+ (kind-icon--rgb-blend
+ (color-name-to-rgb col)
+ (color-name-to-rgb default-bg)
+ kind-icon-blend-frac)
+ (if (and kind-face-bg (not (eq kind-face-bg
'unspecified)))
+ kind-face-bg
+ default-bg)))
+ (dfw (default-font-width))
+ (half (/ dfw 2))
+ (pad-right (propertize " " 'display `(space :width (,half))))
+ (pad-left (propertize " " 'display `(space :width (,(- dfw
half)))))
+ (disp (if-let ((kind-icon-use-icons)
+ (icon-name (plist-get plist :icon))
+ (icon (kind-icon--get-icon-safe icon-name col
bg-col)))
+ ;; icon: always 2x1, half-space on each side
+ (propertize ; pretend it's one char to allow padding
+ (concat pad-left (propertize "*" 'display icon)
pad-right)
+ 'face `(:background ,bg-col))
+ ;; text, 1 or 2 chars, centered with full or half
space on each side
+ (let* ((txt (truncate-string-to-width (cadr map) 2))
+ (len (length txt))
+ (txt-disp (if (eq len 2)
+ (concat pad-left
+ (propertize "_" 'display
txt)
+ pad-right)
+ (concat " " txt " "))))
+ (propertize txt-disp 'face
+ `(:weight bold :foreground ,col
:background ,bg-col))))))
+ (if disp
+ (setf (alist-get kind kind-icon--cache) disp)
+ (propertize (concat pad-left "??" pad-right) 'face
font-lock-warning-face)))
+ kind-icon--unknown)))
(defconst kind-icon--unknown
(propertize "???" 'face '(:weight bold :background "red")))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/kind-icon 77cc6f8: Return unknown if kind has not match,
ELPA Syncer <=