[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm 19eba70ac5 1/4: Provide icons in helm-filtered-bookma
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm 19eba70ac5 1/4: Provide icons in helm-filtered-bookmarks |
Date: |
Sun, 13 Mar 2022 04:58:18 -0400 (EDT) |
branch: elpa/helm
commit 19eba70ac5a3ce73c752d938689f16a51627e3f5
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Provide icons in helm-filtered-bookmarks
In addition to provide icons, the tricky part is to make adaptive
sorting work with the leading space where the icon is stored as a
diplay prop.
Also helm adaptive was storing the full display part in
helm-adaptive-history which was wrong when bookmark was shown with its
location; To fix it, now bookmark show its location in another display
prop stored in a trailing space.
helm adaptive is now removing both leading and trailing space when
comparing candidates.
---
helm-adaptive.el | 14 +++++++++++++-
helm-bookmark.el | 16 ++++++++++++++--
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/helm-adaptive.el b/helm-adaptive.el
index e553f6dade..a44b514869 100644
--- a/helm-adaptive.el
+++ b/helm-adaptive.el
@@ -234,7 +234,19 @@ This is a filtered candidate transformer you can use with
the
for info = (or (and (assq 'multiline source)
(replace-regexp-in-string
"\n\\'" "" cand))
- cand)
+ ;; Some transformers like in
+ ;; bookmarks may add a leading
+ ;; space to provide additional
+ ;; infos like an icon as a
+ ;; display prop, strip out this
+ ;; leading space for
+ ;; comparison. Same for a
+ ;; trailing space (helm
+ ;; boookmark add bmk location as
+ ;; a display prop when
+ ;; displaying it).
+ (helm-aand (replace-regexp-in-string
"\\` " "" cand)
+ (replace-regexp-in-string "
\\'" "" it)))
when (cl-member info candidates
:test 'helm-adaptive-compare)
collect (car it) into sorted
diff --git a/helm-bookmark.el b/helm-bookmark.el
index 283d433c5d..f1ef4959d1 100644
--- a/helm-bookmark.el
+++ b/helm-bookmark.el
@@ -544,6 +544,12 @@ 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")))
;; Add a * if bookmark have annotation
if (and isannotation (not (string-equal isannotation "")))
do (setq trunc (concat "*" (if helm-bookmark-show-location trunc i)))
@@ -606,9 +612,15 @@ 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 bmk sep (if (listp loc) (car loc) loc))
+ (cons (concat (propertize " " 'display (concat icon " "))
+ bmk
+ (propertize
+ " " 'display
+ (concat sep (if (listp loc) (car loc)
loc))))
i)
- (cons bmk i)))))
+ (cons (concat (propertize " " 'display (concat icon " "))
+ bmk)
+ i)))))
;;; Edit/rename/save bookmarks.