[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm b61f10b123 2/4: Add a new user var to display or not
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm b61f10b123 2/4: Add a new user var to display or not icons in bookmarks |
Date: |
Sun, 13 Mar 2022 04:58:19 -0400 (EDT) |
branch: elpa/helm
commit b61f10b123d5cd0c22d3d877381e05dcb58ae717
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Add a new user var to display or not icons in bookmarks
Also add the necessary declare-function and require.
---
helm-bookmark.el | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/helm-bookmark.el b/helm-bookmark.el
index f1ef4959d1..dd007d5407 100644
--- a/helm-bookmark.el
+++ b/helm-bookmark.el
@@ -29,6 +29,10 @@
(declare-function helm-browse-project "helm-files" (arg))
(declare-function addressbook-bookmark-edit "ext:addressbook-bookmark.el"
(bookmark))
+(declare-function all-the-icons-fileicon "ext:all-the-icons.el")
+(declare-function all-the-icons-icon-for-file"ext:all-the-icons.el")
+(declare-function all-the-icons-octicon "ext:all-the-icons.el")
+
(defgroup helm-bookmark nil
"Predefined configurations for `helm.el'."
@@ -54,6 +58,11 @@
:group 'helm-bookmark
:type '(repeat (choice symbol)))
+(defcustom helm-bookmark-use-icon nil
+ "Display candidates with an icon with `all-the-icons' when non nil."
+ :type 'boolean
+ :group 'helm-bookmark)
+
(defface helm-bookmark-info
`((t ,@(and (>= emacs-major-version 27) '(:extend t))
@@ -544,12 +553,13 @@ If `browse-url-browser-function' is set to something else
than
(helm-substring
i bookmark-bmenu-file-column)
i)
- for icon = (cond ((and isfile hff)
- (all-the-icons-octicon "file-directory"))
- ((and isfile isinfo) (all-the-icons-octicon "info"))
- (isfile (all-the-icons-icon-for-file isfile))
- ((or iswoman isman)
- (all-the-icons-fileicon "man-page")))
+ for icon = (when helm-bookmark-use-icon
+ (cond ((and isfile hff)
+ (all-the-icons-octicon "file-directory"))
+ ((and isfile isinfo) (all-the-icons-octicon
"info"))
+ (isfile (all-the-icons-icon-for-file isfile))
+ ((or iswoman isman)
+ (all-the-icons-fileicon "man-page"))))
;; Add a * if bookmark have annotation
if (and isannotation (not (string-equal isannotation "")))
do (setq trunc (concat "*" (if helm-bookmark-show-location trunc i)))
@@ -612,13 +622,13 @@ If `browse-url-browser-function' is set to something else
than
(propertize trunc 'face 'helm-bookmark-file
'help-echo isfile)))
collect (if helm-bookmark-show-location
- (cons (concat (propertize " " 'display (concat icon " "))
+ (cons (concat (and icon (propertize " " 'display (concat
icon " ")))
bmk
(propertize
" " 'display
(concat sep (if (listp loc) (car loc)
loc))))
i)
- (cons (concat (propertize " " 'display (concat icon " "))
+ (cons (concat (and icon (propertize " " 'display (concat
icon " ")))
bmk)
i)))))
@@ -753,6 +763,8 @@ 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*"