Commit 8a75bde4 authored by Bernhard Rotter's avatar Bernhard Rotter Committed by Eli Zaretskii

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.
parent 1cc90d21
......@@ -409,13 +409,11 @@ to writing a completion function."
(setq filename (substring filename 1)
pcomplete-stub filename
glob-name t))
(let* ((paths (eshell-parse-colon-path eshell-path-env))
(let* ((paths (eshell-get-path))
(cwd (file-name-as-directory
(expand-file-name default-directory)))
(path "") (comps-in-path ())
(file "") (filepath "") (completions ()))
(if (eshell-under-windows-p)
(push "." paths))
;; Go thru each path in the search path, finding completions.
(while paths
(setq path (file-name-as-directory
......@@ -74,10 +74,8 @@ but Eshell will be able to understand
"Search the environment path for NAME."
(if (file-name-absolute-p name)
(let ((list (eshell-parse-colon-path eshell-path-env))
(let ((list (eshell-get-path))
suffixes n1 n2 file)
(if (eshell-under-windows-p)
(push "." list))
(while list
(setq n1 (concat (car list) name))
(setq suffixes eshell-binary-suffixes)
......@@ -232,6 +232,14 @@ It might be different from \(getenv \"PATH\"), when
`default-directory' points to a remote host.")
(make-variable-buffer-local 'eshell-path-env)
(defun eshell-get-path ()
"Return $PATH as list.
Add the current directory on windows."
(if (eshell-under-windows-p)
(concat "." path-separator eshell-path-env)
(defun eshell-parse-colon-path (path-env)
"Split string with `parse-colon-path'.
Prepend remote identification of `default-directory', if any."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment