branch: elpa/helm
commit fe73c960fcd301fb54f0e58c8813699a83d57eee
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    Add a bookmark category and its affix fn
---
 helm-mode.el | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/helm-mode.el b/helm-mode.el
index 1951cd6a150..9c608e8056f 100644
--- a/helm-mode.el
+++ b/helm-mode.el
@@ -1086,7 +1086,10 @@ that use `helm-comp-read'.  See `helm-M-x' for example."
             (category . man)))
     (info . (metadata
              (affixation-function . helm-completion-info-file-affixation)
-             (category . info))))
+             (category . info)))
+    (bookmark . (metadata
+                 (affixation-function . helm-completion-bookmark-affixation)
+                 (category . bookmark))))
   "Extra metadatas for completing-read.
 
 It is used to add `affixation-function' or `annotation-function' if original
@@ -1159,7 +1162,8 @@ FLAGS is a list of variables to renitialize to nil when 
exiting or quitting.")
     ("list-charset-chars" . charset)
     ("info-display-manual" . info)
     ;; Emacs-30 only
-    ("eww" . eww-help))
+    ("eww" . eww-help)
+    ("bookmark-jump" . bookmark))
   "An alist to specify metadata category by command.
 
 Some commands provide a completion-table with no category
@@ -1340,6 +1344,15 @@ is used."
             (helm-aand (propertize doc 'face 'helm-completions-detailed)
                        (propertize " " 'display (concat sep it)))))))
 
+(defun helm-completion-bookmark-affixation (_completions)
+  (lambda (comp)
+    (let* ((sep (helm-make-separator comp))
+           (loc (bookmark-location comp)))
+      (list (propertize comp 'face 'bookmark-menu-bookmark)
+            ""
+            (helm-aand (propertize loc 'face 'helm-completions-detailed)
+                       (propertize " " 'display (concat sep it)))))))
+
 (defun helm--get-theme-doc-1 (sym)
   (let ((fn (locate-file (concat (symbol-name sym) "-theme.el")
                        (custom-theme--load-path)

Reply via email to