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

    Improve helm-projects-history
    
    Cleanup helm-browse-project-history on startup.
    Add an action to remove projects.
---
 helm-files.el | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index 9d84b6ac8e..39c135bc33 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -6920,15 +6920,30 @@ VC handled directories.")
 
 ;;;###autoload
 (defun helm-projects-history (&optional arg)
-  "Jump to project already visisted with `helm-browse-project'."
+  "Jump to project already visisted with `helm-browse-project'.
+Prefix arg allows browsing files recursively under a project not handled
+by git or hg, otherwise it has no effect."
   (interactive "P")
+  (setq helm-browse-project-history
+        (cl-loop for p in helm-browse-project-history
+                 when (file-directory-p p)
+                 collect p))
   (helm :sources
         (helm-build-sync-source "Project history"
           :candidates helm-browse-project-history
-          :action (lambda (candidate)
-                    (with-helm-default-directory candidate
-                        (helm-browse-project
-                         (or arg helm-current-prefix-arg)))))
+          :action (helm-make-actions
+                   "Browse project"
+                   (lambda (candidate)
+                     (with-helm-default-directory candidate
+                       (helm-browse-project
+                        (or arg helm-current-prefix-arg))))
+                   "Remove project(s)"
+                   (lambda (_candidate)
+                     (let ((mkd (helm-marked-candidates)))
+                       (cl-loop for c in mkd do
+                                (setq helm-browse-project-history
+                                      (delete c helm-browse-project-history)))
+                       (message "%s projects removed" (length mkd))))))
         :buffer "*helm browse project history*"))
 
 ;;;###autoload

Reply via email to