PATH- and completion-related fixes in Eshell on MS-Windows
* lisp/eshell/esh-ext.el (eshell-search-path): When running on MS-Windows, prepend "." to list of directories produced from PATH, as Windows always implicitly searches the current directory first. (eshell-force-execution): Make it have a non-nil default value on MS-Windows and MS-DOS. * lisp/eshell/em-cmpl.el (eshell-complete-commands-list): If eshell-force-execution is non-nil, complete on readable files and directories, not only executables. When running on MS-Windows, prepend "." to list of directories produced from PATH, as Windows always implicitly searches the current directory first.
This commit is contained in:
parent
5e7ed98f7c
commit
3c3eb1d5f2
2 changed files with 18 additions and 9 deletions
|
@ -405,7 +405,9 @@ to writing a completion function."
|
|||
"Generate list of applicable, visible commands."
|
||||
(let ((filename (pcomplete-arg)) glob-name)
|
||||
(if (file-name-directory filename)
|
||||
(pcomplete-executables)
|
||||
(if eshell-force-execution
|
||||
(pcomplete-dirs-or-entries nil 'file-readable-p)
|
||||
(pcomplete-executables))
|
||||
(if (and (> (length filename) 0)
|
||||
(eq (aref filename 0) eshell-explicit-command-char))
|
||||
(setq filename (substring filename 1)
|
||||
|
@ -416,6 +418,8 @@ to writing a completion function."
|
|||
(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
|
||||
|
@ -431,7 +435,9 @@ to writing a completion function."
|
|||
(if (and (not (member file completions)) ;
|
||||
(or (string-equal path cwd)
|
||||
(not (file-directory-p filepath)))
|
||||
(file-executable-p filepath))
|
||||
(if eshell-force-execution
|
||||
(file-readable-p filepath)
|
||||
(file-executable-p filepath)))
|
||||
(setq completions (cons file completions)))
|
||||
(setq comps-in-path (cdr comps-in-path)))
|
||||
(setq paths (cdr paths)))
|
||||
|
|
|
@ -60,14 +60,15 @@ loaded into memory, thus beginning a new process."
|
|||
:type '(repeat string)
|
||||
:group 'eshell-ext)
|
||||
|
||||
(defcustom eshell-force-execution nil
|
||||
"If non-nil, try to execute binary files regardless of permissions.
|
||||
(defcustom eshell-force-execution
|
||||
(not (null (memq system-type '(windows-nt ms-dos))))
|
||||
"If non-nil, try to execute files regardless of execute permissions.
|
||||
This can be useful on systems like Windows, where the operating system
|
||||
doesn't happen to honor the permission bits in certain cases; or in
|
||||
cases where you want to associate an interpreter with a particular
|
||||
kind of script file, but the language won't let you but a '#!'
|
||||
interpreter line in the file, and you don't want to make it executable
|
||||
since nothing else but Eshell will be able to understand
|
||||
doesn't support the execution bit for shell scripts; or in cases where
|
||||
you want to associate an interpreter with a particular kind of script
|
||||
file, but the language won't let you but a '#!' interpreter line in
|
||||
the file, and you don't want to make it executable since nothing else
|
||||
but Eshell will be able to understand
|
||||
`eshell-interpreter-alist'."
|
||||
:type 'boolean
|
||||
:group 'eshell-ext)
|
||||
|
@ -78,6 +79,8 @@ since nothing else but Eshell will be able to understand
|
|||
name
|
||||
(let ((list (eshell-parse-colon-path eshell-path-env))
|
||||
suffixes n1 n2 file)
|
||||
(if (eshell-under-windows-p)
|
||||
(push "." list))
|
||||
(while list
|
||||
(setq n1 (concat (car list) name))
|
||||
(setq suffixes eshell-binary-suffixes)
|
||||
|
|
Loading…
Add table
Reference in a new issue