Skip to content

Commit 8a75bde

Browse files
ber-roEli-Zaretskii
authored andcommitted
Fix path for current directory in eshell on MS-Windows
On MS-Windows, PATH implicitly includes the current directory. Do it right for Eshell by adding "./" instead of ".", to avoid finding .FOO instead of ./FOO. * lisp/eshell/esh-util.el (eshell-get-path): New function. * lisp/eshell/em-cmpl.el (eshell-complete-commands-list): * lisp/eshell/esh-ext.el (eshell-search-path): Use eshell-get-path.
1 parent 1cc90d2 commit 8a75bde

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

lisp/eshell/em-cmpl.el

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,11 @@ to writing a completion function."
409409
(setq filename (substring filename 1)
410410
pcomplete-stub filename
411411
glob-name t))
412-
(let* ((paths (eshell-parse-colon-path eshell-path-env))
412+
(let* ((paths (eshell-get-path))
413413
(cwd (file-name-as-directory
414414
(expand-file-name default-directory)))
415415
(path "") (comps-in-path ())
416416
(file "") (filepath "") (completions ()))
417-
(if (eshell-under-windows-p)
418-
(push "." paths))
419417
;; Go thru each path in the search path, finding completions.
420418
(while paths
421419
(setq path (file-name-as-directory

lisp/eshell/esh-ext.el

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ but Eshell will be able to understand
7474
"Search the environment path for NAME."
7575
(if (file-name-absolute-p name)
7676
name
77-
(let ((list (eshell-parse-colon-path eshell-path-env))
77+
(let ((list (eshell-get-path))
7878
suffixes n1 n2 file)
79-
(if (eshell-under-windows-p)
80-
(push "." list))
8179
(while list
8280
(setq n1 (concat (car list) name))
8381
(setq suffixes eshell-binary-suffixes)

lisp/eshell/esh-util.el

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,14 @@ It might be different from \(getenv \"PATH\"), when
232232
`default-directory' points to a remote host.")
233233
(make-variable-buffer-local 'eshell-path-env)
234234

235+
(defun eshell-get-path ()
236+
"Return $PATH as list.
237+
Add the current directory on windows."
238+
(eshell-parse-colon-path
239+
(if (eshell-under-windows-p)
240+
(concat "." path-separator eshell-path-env)
241+
eshell-path-env)))
242+
235243
(defun eshell-parse-colon-path (path-env)
236244
"Split string with `parse-colon-path'.
237245
Prepend remote identification of `default-directory', if any."

0 commit comments

Comments
 (0)