summaryrefslogtreecommitdiff
path: root/helm-eshell.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-08-11 06:48:37 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-08-11 06:48:37 +0200
commit0813ab12b4481c9688c06c896296d375e311f1c9 (patch)
tree17a246995d15284111ef01569edcbdf2d9b1c174 /helm-eshell.el
parente21991b4c7d11981499c8d46ab7c0079e31fa835 (diff)
Fix eshell completion on "~" (#1832)
* helm-eshell.el (helm-esh-pcomplete): Do it.
Diffstat (limited to 'helm-eshell.el')
-rw-r--r--helm-eshell.el17
1 files changed, 16 insertions, 1 deletions
diff --git a/helm-eshell.el b/helm-eshell.el
index de15b475..c72e2612 100644
--- a/helm-eshell.el
+++ b/helm-eshell.el
@@ -221,6 +221,7 @@ The function that call this should set `helm-ec-target' to thing at point."
(save-excursion
(eshell-backward-argument 1) (point))
end)))
+ (users-comp (string= target "~"))
(first (car args)) ; Maybe lisp delimiter "(".
last ; Will be the last but parsed by pcomplete.
del-space)
@@ -253,14 +254,28 @@ The function that call this should set `helm-ec-target' to thing at point."
:resume 'noresume
:input (if (and (stringp last)
(not (string= last ""))
+ (not users-comp)
+ ;; Fix completion on
+ ;; "../" see #1832.
(or (file-exists-p last)
(helm-aand
(file-name-directory last)
(file-directory-p it))))
(expand-file-name last)
- last))
+ ;; Don't add "~" to input to
+ ;; provide completion on all
+ ;; users instead of only on
+ ;; current $HOME (#1832).
+ (unless users-comp last)))
+ ;; A space is needed to have completion, remove
+ ;; it when done.
(and del-space (looking-back "\\s-" (1- (point)))
(delete-char -1))
+ ;; We need another flag for space here, but
+ ;; global to pass it to `helm-quit-hook', this
+ ;; space is added when point is just after
+ ;; previous completion and there is there no
+ ;; more completion, see issue #1832.
(unless helm-eshell--delete-space-flag
(insert " ")))
(remove-hook 'helm-quit-hook 'helm-eshell--delete-space)