diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-08-14 09:15:01 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2017-08-14 09:15:01 +0200 |
commit | 0154a99d33837dbf79776b78951d07cb2c6f3417 (patch) | |
tree | 352732b442b741da8073d028ce77158e797ea839 /helm-eshell.el | |
parent | c1652c0a09e183aee1e1d38f340706d1072ea426 (diff) |
Rename var and fn that handle quit in eshell (#1832)
* helm-eshell.el (helm-eshell--quit-flag): Renamed from `helm-eshell--delete-suffix-flag`.
(helm-esh-pcomplete): update new var and fn names, use the quit flag
for dot restoration.
(helm-eshell--quit-hook-fn): Renamed from `helm-eshell--delete-suffix`.
Diffstat (limited to 'helm-eshell.el')
-rw-r--r-- | helm-eshell.el | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/helm-eshell.el b/helm-eshell.el index be21f786..d59b3df2 100644 --- a/helm-eshell.el +++ b/helm-eshell.el @@ -203,7 +203,7 @@ The function that call this should set `helm-ec-target' to thing at point." -(defvar helm-eshell--delete-suffix-flag nil) +(defvar helm-eshell--quit-flag nil) ;;;###autoload (defun helm-esh-pcomplete () @@ -250,10 +250,10 @@ The function that call this should set `helm-ec-target' to thing at point." "\\`\\*" "" (car (last (ignore-errors (pcomplete-parse-arguments)))))) - ;; Set helm-eshell--delete-suffix-flag to non-nil only on + ;; Set helm-eshell--quit-flag to non-nil only on ;; quit, this tells to not add final suffix when quitting ;; helm. - (add-hook 'helm-quit-hook 'helm-eshell--delete-suffix) + (add-hook 'helm-quit-hook 'helm-eshell--quit-hook-fn) (with-helm-show-completion beg end (unwind-protect (or (helm :sources (helm-make-source "Eshell completions" 'helm-esh-source @@ -283,12 +283,13 @@ The function that call this should set `helm-ec-target' to thing at point." ;; users instead of only on ;; current $HOME (#1832). (unless users-comp last))) - (and del-dot (insert ".")) + ;; Delete removed dot on quit + (and del-dot helm-eshell--quit-flag (insert ".")) ;; A space is needed to have completion, remove ;; it when nothing found. (and del-space (looking-back "\\s-" (1- (point))) (delete-char -1)) - (if (and (null helm-eshell--delete-suffix-flag) + (if (and (null helm-eshell--quit-flag) (looking-back "[.]\\{1,2\\}\\'" (1- (point)))) (insert "/") ;; We need another flag for space here, but @@ -296,14 +297,14 @@ The function that call this should set `helm-ec-target' to thing at point." ;; space is added when point is just after ;; previous completion and there is no ;; more completion, see issue #1832. - (unless (or helm-eshell--delete-suffix-flag + (unless (or helm-eshell--quit-flag (looking-back "/\\'" (1- (point)))) (insert " ")))) - (remove-hook 'helm-quit-hook 'helm-eshell--delete-suffix) - (setq helm-eshell--delete-suffix-flag nil))))))) + (remove-hook 'helm-quit-hook 'helm-eshell--quit-hook-fn) + (setq helm-eshell--quit-flag nil))))))) -(defun helm-eshell--delete-suffix () - (setq helm-eshell--delete-suffix-flag t)) +(defun helm-eshell--quit-hook-fn () + (setq helm-eshell--quit-flag t)) ;;;###autoload (defun helm-eshell-history () |