[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 5111c43 2/5: (margin): Add GUI or unicode margi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 5111c43 2/5: (margin): Add GUI or unicode margin function |
Date: |
Wed, 31 Mar 2021 12:57:08 -0400 (EDT) |
branch: externals/company
commit 5111c43d011689a183d85c442e47e7cbd658f30e
Author: Mohsin Kaleem <mohkale@kisara.moe>
Commit: Mohsin Kaleem <mohkale@kisara.moe>
(margin): Add GUI or unicode margin function
A margin function that switches between vscode and unicode icons based
on display-graphic-p.
---
company.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/company.el b/company.el
index c9e70ae..3f85908 100644
--- a/company.el
+++ b/company.el
@@ -1478,7 +1478,7 @@ end of the match."
(variable . "ѱ")))
(defun company-unicode-icons-margin (candidate selected)
- "Margin function which returns icons from vscode's light theme."
+ "Margin function which returns unicode icons."
(when-let ((candidate candidate)
(kind (company-call-backend 'kind candidate))
(icon (alist-get kind company-unicode-icons-mapping)))
@@ -1487,6 +1487,16 @@ end of the match."
'company-tooltip-selection
'company-tooltip))))
+(defun company-unicode-or-vscode-icons-margin (candidate selected)
+ "Margin function which picks from vscodes icons or unicode icons
+based on `display-graphic-p'."
+ (if (display-graphic-p)
+ ;; Default to dark because who in their right mind uses light 😜
+ (cl-case (frame-parameter nil 'background-mode)
+ ('light (company-vscode-light-icons-margin candidate selected))
+ (t (company-vscode-dark-icons-margin candidate selected)))
+ (company-unicode-icons-margin candidate selected)))
+
(defcustom company-format-margin-function nil
"Function to format the margin.
It accepts 2 params `candidate' and `selected' and can be used for