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

    Add action to remove candidates from file-name-history
---
 helm-files.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/helm-files.el b/helm-files.el
index 6dff0286c5..f8d520ecd9 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -6081,6 +6081,16 @@ list."
   (with-helm-alive-p
     (helm-exit-and-execute-action 'helm-ff-file-name-history-ff)))
 
+(defun helm-ff-file-name-history-delete-item (_candidate)
+  (let ((files (helm-marked-candidates)))
+    (with-helm-display-marked-candidates
+      helm-marked-buffer-name
+      (helm-ff--count-and-collect-dups files)
+      (when (y-or-n-p "Delete file(s) from history? ")
+        (cl-loop for f in files do
+                 (setq file-name-history (delete f file-name-history))))
+      (message nil))))
+
 (defun helm-ff-file-name-history ()
   "Switch to `file-name-history' without quitting `helm-find-files'."
   (interactive)
@@ -6105,7 +6115,8 @@ list."
                                       (helm-set-pattern
                                        (expand-file-name candidate))
                                       (with-helm-after-update-hook 
(helm-exit-minibuffer)))
-                        "Find file in helm" 'helm-ff-file-name-history-ff)
+                        "Find file in helm" 'helm-ff-file-name-history-ff
+                        "Delete candidate(s)" 
'helm-ff-file-name-history-delete-item)
                :keymap helm-file-name-history-map)))
     (with-helm-alive-p
       (helm :sources src

Reply via email to