summaryrefslogtreecommitdiff
path: root/helm-eshell.el
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2014-03-07 05:54:03 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2014-03-07 05:54:03 +0100
commitfe6366a275a589ca8db5584a3d6898fcc6b95a27 (patch)
treeba40b14d8ee2229b215edd6db5970c72e30a90bc /helm-eshell.el
parent2698bd63918a37cce074168e2e7cc2de990c2c4e (diff)
* helm-eshell.el (helm-ec-insert): Don't insert full path when not needed (#438)
Diffstat (limited to 'helm-eshell.el')
-rw-r--r--helm-eshell.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/helm-eshell.el b/helm-eshell.el
index 6507dc0b..6d7d303b 100644
--- a/helm-eshell.el
+++ b/helm-eshell.el
@@ -74,9 +74,12 @@ The function that call this should set `helm-ec-target' to thing at point."
(search-backward helm-ec-target nil t)
(string= (buffer-substring (point) pt) helm-ec-target))
(delete-region (point) pt)))
- (if (string-match "\\`~/" helm-ec-target)
- (insert (helm-quote-whitespace (abbreviate-file-name candidate)))
- (insert (helm-quote-whitespace candidate))))
+ (cond ((string-match "\\`~/?" helm-ec-target)
+ (insert (helm-quote-whitespace (abbreviate-file-name candidate))))
+ ((string-match "\\`/" helm-ec-target)
+ (insert (helm-quote-whitespace candidate)))
+ (t
+ (insert (helm-quote-whitespace (file-relative-name candidate))))))
(defun helm-esh-get-candidates ()
"Get candidates for eshell completion using `pcomplete'."