branch: elpa/helm commit d4f18d4fb9a3028d119b02d79aca6d03e6c5c4d6 Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Fail safe when all-the-icons is not installed with bookmarks, imenu and buffers. --- helm-bookmark.el | 11 +++++++---- helm-buffers.el | 14 ++++++++------ helm-imenu.el | 20 +++++++++++++++----- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/helm-bookmark.el b/helm-bookmark.el index e34ed40e25..d1471fb5e4 100644 --- a/helm-bookmark.el +++ b/helm-bookmark.el @@ -58,8 +58,13 @@ :type '(repeat (choice symbol))) (defcustom helm-bookmark-use-icon nil - "Display candidates with an icon with `all-the-icons' when non nil." - :type 'boolean) + "Display candidates with an icon with `all-the-icons' when non nil. +Don't use `setq' to set this." + :type 'boolean + :set (lambda (var val) + (if (featurep 'all-the-icons) + (set var val) + (set var nil)))) (defcustom helm-bookmark-default-sort-method 'adaptive "Sort method for `helm-filtered-bookmarks'. @@ -810,8 +815,6 @@ E.g. prepended with *." Optional source `helm-source-bookmark-addressbook' is loaded only if external addressbook-bookmark package is installed." (interactive) - (when helm-bookmark-use-icon - (require 'all-the-icons)) (helm :sources helm-bookmark-default-filtered-sources :prompt "Search Bookmark: " :buffer "*helm filtered bookmarks*" diff --git a/helm-buffers.el b/helm-buffers.el index d9bf199adc..3493ad39c9 100644 --- a/helm-buffers.el +++ b/helm-buffers.el @@ -144,8 +144,13 @@ you want to keep the recentest order when narrowing candidates." :type 'function) (defcustom helm-buffers-show-icons nil - "Prefix buffer names with an icon when non nil." - :type 'boolean) + "Prefix buffer names with an icon when non nil. +Don't use `setq' to set this." + :type 'boolean + :set (lambda (var val) + (if (featurep 'all-the-icons) + (set var val) + (set var nil)))) ;;; Faces @@ -533,10 +538,7 @@ The list is reordered with `helm-buffer-list-reorder-fn'." Should be called after others transformers i.e. (boring buffers)." (cl-assert helm-fuzzy-matching-highlight-fn nil "Wrong type argument functionp: nil") - (cl-loop with helm-buffers-show-icons = (and (featurep 'all-the-icons) - (default-toplevel-value - 'helm-buffers-show-icons)) - for i in buffers + (cl-loop for i in buffers for (name size mode meta) = (if helm-buffer-details-flag (helm-buffer--details i 'details) (helm-buffer--details i)) diff --git a/helm-imenu.el b/helm-imenu.el index 6e68389b64..c51f9e0627 100644 --- a/helm-imenu.el +++ b/helm-imenu.el @@ -95,14 +95,25 @@ string." (defcustom helm-imenu-hide-item-type-name nil "Hide display name of imenu item type along with the icon when non nil. -This value can be toggled with \\<helm-imenu-map>\\[helm-imenu-toggle-type-view]." +This value can be toggled with \\<helm-imenu-map>\\[helm-imenu-toggle-type-view]. +Don't use `setq' to set this." :group 'helm-imenu - :type 'boolean) + :type 'boolean + :set (lambda (var val) + (if (featurep 'all-the-icons) + (set var val) + (set var nil)))) (defcustom helm-imenu-use-icon nil - "Display an icon from all-the-icons package when non nil." + "Display an icon from all-the-icons package when non nil. + +Don't use `setq' to set this." :group 'helm-imenu - :type 'boolean) + :type 'boolean + :set (lambda (var val) + (if (featurep 'all-the-icons) + (set var val) + (set var nil)))) (defcustom helm-imenu-icon-type-alist '(("Array" . (all-the-icons-material "crop" :face font-lock-builtin-face)) @@ -420,7 +431,6 @@ The sexp should be an `all-the-icons' function with its args." "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)) (or (helm-aand (assoc-default