[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm 4948d844be: Provide new user vars to avoid hardcoding
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm 4948d844be: Provide new user vars to avoid hardcoding icons |
Date: |
Wed, 1 Jun 2022 03:01:14 -0400 (EDT) |
branch: elpa/helm
commit 4948d844be20819995466424a4b5610870eb9ba0
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Provide new user vars to avoid hardcoding icons
in helm-imenu-icon-for-type.
---
helm-imenu.el | 159 ++++++++++++++++++++++++++++++++--------------------------
1 file changed, 88 insertions(+), 71 deletions(-)
diff --git a/helm-imenu.el b/helm-imenu.el
index 574fc21f60..9cd39cb659 100644
--- a/helm-imenu.el
+++ b/helm-imenu.el
@@ -104,6 +104,86 @@ This value can be toggled with
\\<helm-imenu-map>\\[helm-imenu-toggle-type-view]
:group 'helm-imenu
:type 'boolean)
+(defcustom helm-imenu-icon-type-alist
+ '(("Array" . (all-the-icons-material "crop" :face
font-lock-builtin-face))
+ ("Array" . (all-the-icons-material "crop" :face
font-lock-builtin-face))
+ ("Boolean" . (all-the-icons-material "crop" :face
font-lock-builtin-face))
+ ("Boolean" . (all-the-icons-material "crop" :face
font-lock-builtin-face))
+ ("Class" . (all-the-icons-octicon "package" :face
font-lock-type-face))
+ ("Class" . (all-the-icons-octicon "package" :face
font-lock-type-face))
+ ("Color" . (all-the-icons-material "color_lens" :face
font-lock-builtin-face))
+ ("Colors" . (all-the-icons-material "color_lens" :face
font-lock-builtin-face))
+ ("Constant" . (all-the-icons-material "crop" :face
font-lock-builtin-face))
+ ("Constants" . (all-the-icons-material "crop" :face
font-lock-builtin-face))
+ ("Constructor" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Constructors" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Enum Member" . (all-the-icons-octicon "three-bars" :face
font-lock-type-face))
+ ("Enum Members" . (all-the-icons-octicon "three-bars" :face
font-lock-type-face))
+ ("Enum" . (all-the-icons-faicon "cog" :face
font-lock-type-face))
+ ("Enums" . (all-the-icons-faicon "cog" :face
font-lock-type-face))
+ ("Event" . (all-the-icons-wicon "lightning" :face
font-lock-builtin-face))
+ ("Events" . (all-the-icons-wicon "lightning" :face
font-lock-builtin-face))
+ ("Field" . (all-the-icons-octicon "three-bars" :face
font-lock-type-face))
+ ("Fields" . (all-the-icons-octicon "three-bars" :face
font-lock-type-face))
+ ("File" . (all-the-icons-faicon "file" :face
font-lock-variable-name-face))
+ ("Files" . (all-the-icons-faicon "file" :face
font-lock-variable-name-face))
+ ("Folder" . (all-the-icons-faicon "folder" :face
font-lock-variable-name-face))
+ ("Folders" . (all-the-icons-faicon "folder" :face
font-lock-variable-name-face))
+ ("Interface" . (all-the-icons-octicon "package" :face
font-lock-builtin-face))
+ ("Interfaces" . (all-the-icons-octicon "package" :face
font-lock-builtin-face))
+ ("Keyword" . (all-the-icons-octicon "key" :face
font-lock-builtin-face))
+ ("Keywords" . (all-the-icons-octicon "key" :face
font-lock-builtin-face))
+ ("Method" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Methods" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Defun" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Defuns" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Fn" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Fns" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Function" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Functions" . (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
+ ("Misc" . (all-the-icons-faicon "globe" :face
font-lock-function-name-face))
+ ("Miscs" . (all-the-icons-faicon "globe" :face
font-lock-function-name-face))
+ ("Module" . (all-the-icons-faicon "angle-double-right" :face
font-lock-builtin-face))
+ ("Modules" . (all-the-icons-faicon "angle-double-right" :face
font-lock-builtin-face))
+ ("Numeric" . (all-the-icons-material "crop" :face
font-lock-builtin-face))
+ ("Numeric" . (all-the-icons-material "crop" :face
font-lock-builtin-face))
+ ("Object" . (all-the-icons-faicon "angle-double-right" :face
font-lock-builtin-face))
+ ("Objects" . (all-the-icons-faicon "angle-double-right" :face
font-lock-builtin-face))
+ ("Operator" . (all-the-icons-faicon "calculator" :face
font-lock-builtin-face))
+ ("Operators" . (all-the-icons-faicon "calculator" :face
font-lock-builtin-face))
+ ("Property" . (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
+ ("Propertys" . (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
+ ("Reference" . (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
+ ("References" . (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
+ ("Snippet" . (all-the-icons-material "border_style" :face
font-lock-variable-name-face))
+ ("Snippet" . (all-the-icons-material "border_style" :face
font-lock-variable-name-face))
+ ("String" . (all-the-icons-material "text_fields" :face
font-lock-variable-name-face))
+ ("Strings" . (all-the-icons-material "text_fields" :face
font-lock-variable-name-face))
+ ("Struct" . (all-the-icons-faicon "cog" :face
font-lock-type-face))
+ ("Structs" . (all-the-icons-faicon "cog" :face
font-lock-type-face))
+ ("Text" . (all-the-icons-material "text_fields" :face
font-lock-variable-name-face))
+ ("Texts" . (all-the-icons-material "text_fields" :face
font-lock-variable-name-face))
+ ("Top level" . (all-the-icons-faicon "globe" :face
font-lock-function-name-face))
+ ("Type" . (all-the-icons-faicon "cog" :face
font-lock-type-face))
+ ("Types" . (all-the-icons-faicon "cog" :face
font-lock-type-face))
+ ("Type Parameter" . (all-the-icons-material "code" :face
font-lock-type-face))
+ ("Type Parameters" . (all-the-icons-material "code" :face
font-lock-type-face))
+ ("Unit" . (all-the-icons-faicon "bar-chart" :face
font-lock-builtin-face))
+ ("Units" . (all-the-icons-faicon "bar-chart" :face
font-lock-builtin-face))
+ ("Value" . (all-the-icons-faicon "cog" :face
font-lock-type-face))
+ ("Values" . (all-the-icons-faicon "cog" :face
font-lock-type-face))
+ ("Variable" . (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
+ ("Variables" . (all-the-icons-octicon "book":face
font-lock-variable-name-face)))
+ "An alist of types associated with a sexp returning an icon.
+The sexp should be an `all-the-icons' function with its args."
+ :type '(alist :key-type string :value-type sexp)
+ :group 'helm-imenu)
+
+(defcustom helm-imenu-default-type-sexp
+ '(all-the-icons-faicon "globe" :face font-lock-function-name-face)
+ "Default sexp to use when no type for an object is found."
+ :type 'sexp
+ :group 'helm-imenu)
;;; keymap
(defvar helm-imenu-map
@@ -335,80 +415,17 @@ This value can be toggled with
\\<helm-imenu-map>\\[helm-imenu-toggle-type-view]
lst)))
(defun helm-imenu-icon-for-type (type)
+ "Return an icon for type TYPE.
+The icon is found in `helm-imenu-icon-type-alist', if not
+`helm-imenu-default-type-sexp' is evaled to provide a default icon."
(require 'all-the-icons)
(let ((all-the-icons-scale-factor 1.0)
(all-the-icons-default-adjust 0.0))
- (helm-acase type
- ("Array" (all-the-icons-material "crop" :face font-lock-builtin-face))
- ("Array" (all-the-icons-material "crop" :face font-lock-builtin-face))
- ("Boolean" (all-the-icons-material "crop" :face font-lock-builtin-face))
- ("Boolean" (all-the-icons-material "crop" :face font-lock-builtin-face))
- ("Class" (all-the-icons-octicon "package" :face font-lock-type-face))
- ("Class" (all-the-icons-octicon "package" :face font-lock-type-face))
- ("Color" (all-the-icons-material "color_lens" :face
font-lock-builtin-face))
- ("Colors" (all-the-icons-material "color_lens" :face
font-lock-builtin-face))
- ("Constant" (all-the-icons-material "crop" :face font-lock-builtin-face))
- ("Constants" (all-the-icons-material "crop" :face
font-lock-builtin-face))
- ("Constructor" (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
- ("Constructors" (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
- ("Enum Member" (all-the-icons-octicon "three-bars" :face
font-lock-type-face))
- ("Enum Members" (all-the-icons-octicon "three-bars" :face
font-lock-type-face))
- ("Enum" (all-the-icons-faicon "cog" :face font-lock-type-face))
- ("Enums" (all-the-icons-faicon "cog" :face font-lock-type-face))
- ("Event" (all-the-icons-wicon "lightning" :face font-lock-builtin-face))
- ("Events" (all-the-icons-wicon "lightning" :face
font-lock-builtin-face))
- ("Field" (all-the-icons-octicon "three-bars" :face font-lock-type-face))
- ("Fields" (all-the-icons-octicon "three-bars" :face
font-lock-type-face))
- ("File" (all-the-icons-faicon "file" :face font-lock-variable-name-face))
- ("Files" (all-the-icons-faicon "file" :face
font-lock-variable-name-face))
- ("Folder" (all-the-icons-faicon "folder" :face
font-lock-variable-name-face))
- ("Folders" (all-the-icons-faicon "folder" :face
font-lock-variable-name-face))
- ("Interface" (all-the-icons-octicon "package" :face
font-lock-builtin-face))
- ("Interfaces" (all-the-icons-octicon "package" :face
font-lock-builtin-face))
- ("Keyword" (all-the-icons-octicon "key" :face font-lock-builtin-face))
- ("Keywords" (all-the-icons-octicon "key" :face font-lock-builtin-face))
- ("Method" (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
- ("Methods" (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
- ("Defun" (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
- ("Defuns" (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
- ("Fn" (all-the-icons-faicon "cube" :face font-lock-function-name-face))
- ("Fns" (all-the-icons-faicon "cube" :face font-lock-function-name-face))
- ("Function" (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
- ("Functions" (all-the-icons-faicon "cube" :face
font-lock-function-name-face))
- ("Misc" (all-the-icons-faicon "globe" :face
font-lock-function-name-face))
- ("Miscs" (all-the-icons-faicon "globe" :face
font-lock-function-name-face))
- ("Module" (all-the-icons-faicon "angle-double-right" :face
font-lock-builtin-face))
- ("Modules" (all-the-icons-faicon "angle-double-right" :face
font-lock-builtin-face))
- ("Numeric" (all-the-icons-material "crop" :face font-lock-builtin-face))
- ("Numeric" (all-the-icons-material "crop" :face font-lock-builtin-face))
- ("Object" (all-the-icons-faicon "angle-double-right" :face
font-lock-builtin-face))
- ("Objects" (all-the-icons-faicon "angle-double-right" :face
font-lock-builtin-face))
- ("Operator" (all-the-icons-faicon "calculator" :face
font-lock-builtin-face))
- ("Operators" (all-the-icons-faicon "calculator" :face
font-lock-builtin-face))
- ("Property" (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
- ("Propertys" (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
- ("Reference" (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
- ("References" (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
- ("Snippet" (all-the-icons-material "border_style" :face
font-lock-variable-name-face))
- ("Snippet" (all-the-icons-material "border_style" :face
font-lock-variable-name-face))
- ("String" (all-the-icons-material "text_fields" :face
font-lock-variable-name-face))
- ("Strings" (all-the-icons-material "text_fields" :face
font-lock-variable-name-face))
- ("Struct" (all-the-icons-faicon "cog" :face font-lock-type-face))
- ("Structs" (all-the-icons-faicon "cog" :face font-lock-type-face))
- ("Text" (all-the-icons-material "text_fields" :face
font-lock-variable-name-face))
- ("Texts" (all-the-icons-material "text_fields" :face
font-lock-variable-name-face))
- ("Top level" (all-the-icons-faicon "globe" :face
font-lock-function-name-face))
- ("Type" (all-the-icons-faicon "cog" :face font-lock-type-face))
- ("Types" (all-the-icons-faicon "cog" :face font-lock-type-face))
- ("Type Parameter" (all-the-icons-material "code" :face
font-lock-type-face))
- ("Type Parameters" (all-the-icons-material "code" :face
font-lock-type-face))
- ("Unit" (all-the-icons-faicon "bar-chart" :face font-lock-builtin-face))
- ("Units" (all-the-icons-faicon "bar-chart" :face font-lock-builtin-face))
- ("Value" (all-the-icons-faicon "cog" :face font-lock-type-face))
- ("Values" (all-the-icons-faicon "cog" :face font-lock-type-face))
- ("Variable" (all-the-icons-octicon "book" :face
font-lock-variable-name-face))
- ("Variables" (all-the-icons-octicon "book":face
font-lock-variable-name-face))
- (t (all-the-icons-faicon "globe" :face font-lock-function-name-face)))))
+ (or (helm-aand (assoc-default
+ type helm-imenu-icon-type-alist)
+ (apply (car it) (cdr it)))
+ (apply (car helm-imenu-default-type-sexp)
+ (cdr helm-imenu-default-type-sexp)))))
(defun helm-imenu-transformer (candidates)
(cl-loop for (k . v) in candidates
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/helm 4948d844be: Provide new user vars to avoid hardcoding icons,
ELPA Syncer <=