branch: elpa/helm
commit 23f72fb284d4336dca209ef3996d59a65ab7f2d9
Author: Thierry Volpiatto <thie...@posteo.net>
Commit: Thierry Volpiatto <thie...@posteo.net>

    Use adaptive sort in insert bookmark location
    
    Limit the command to only Helm as well.
---
 helm-files.el | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index 17901bcd32..c235fab03a 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -5668,19 +5668,21 @@ source is `helm-source-find-files'."
   "Insert helm-find-files bookmark in minibuffer."
   (interactive)
   (require 'helm-bookmark)
-  (helm :sources (helm-bookmark-build-source
-                  "bookmark insert location"
-                  'helm-bookmark-helm-find-files-setup-alist
-                  helm-source-in-buffer
-                  :action (lambda (candidate)
-                            (with-selected-window (minibuffer-window)
-                              (goto-char (point-max))
-                              (when (re-search-backward "/" nil t)
-                                (delete-region (match-end 0) (point-max))
-                                (forward-char 1))
-                              (bookmark-insert-location candidate))))
-        :buffer "*helm bookmark insert*"
-        :allow-nest t))
+  (with-helm-alive-p
+    (helm :sources (helm-bookmark-build-source
+                    "bookmark insert location"
+                    'helm-bookmark-helm-find-files-setup-alist
+                    helm-source-in-buffer
+                    :filtered-candidate-transformer 'helm-adaptive-sort
+                    :action (lambda (candidate)
+                              (with-selected-window (minibuffer-window)
+                                (goto-char (point-max))
+                                (when (re-search-backward "/" nil t)
+                                  (delete-region (match-end 0) (point-max))
+                                  (forward-char 1))
+                                (bookmark-insert-location candidate))))
+          :buffer "*helm bookmark insert*"
+          :allow-nest t)))
 (put 'helm-ff-bookmark-insert-location 'helm-only t)
 
 (defun helm-find-files-initial-input (&optional input)

Reply via email to