summaryrefslogtreecommitdiff
path: root/helm-external.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thievol@posteo.net>2021-10-22 09:02:07 +0200
committerThierry Volpiatto <thievol@posteo.net>2021-10-22 09:04:43 +0200
commit99de86329d948357e8f645bff6ac06a96fd801bc (patch)
tree67dccc1eff101571562a2a47cf2bd14ab07bc9e3 /helm-external.el
parent20ea3ec4fd775969a1c23fd7343fdd6de53931ce (diff)
Update helm-external-command-history
This is needed now we use helm sources instead of helm-comp-read which does this automatically.
Diffstat (limited to 'helm-external.el')
-rw-r--r--helm-external.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/helm-external.el b/helm-external.el
index b861bce1..dba43e5f 100644
--- a/helm-external.el
+++ b/helm-external.el
@@ -208,6 +208,13 @@ to use."
(cl-loop for i in helm-external-command-history
when (executable-find i) collect i))))
+(defun helm-run-external-command-action (candidate &optional detached)
+ (helm-run-or-raise candidate nil detached)
+ (setq helm-external-command-history
+ (cons candidate
+ (delete candidate
+ helm-external-command-history))))
+
;;;###autoload
(defun helm-run-external-command ()
"Preconfigured `helm' to run External PROGRAM asyncronously from Emacs.
@@ -215,10 +222,10 @@ If program is already running try to run `helm-raise-command' if
defined otherwise exit with error. You can set your own list of
commands with `helm-external-commands-list'."
(interactive)
- (let ((actions '(("Run program" . helm-run-or-raise)
+ (let ((actions '(("Run program" . helm-run-external-command-action)
("Run program detached" .
(lambda (candidate)
- (helm-run-or-raise candidate nil 'detached))))))
+ (helm-run-external-command-action candidate 'detached))))))
(helm :sources `(,(helm-build-in-buffer-source "External Commands history"
:data helm-external-command-history
:must-match t
@@ -229,6 +236,7 @@ commands with `helm-external-commands-list'."
:action actions))
:buffer "*helm externals commands*"
:prompt "RunProgram: ")
+ ;; Remove from history no more valid executables.
(setq helm-external-command-history
(cl-loop for i in helm-external-command-history
when (executable-find i) collect i))))