aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-04-29 20:52:02 +0300
committerEli Zaretskii2015-04-29 20:52:02 +0300
commit3c3eb1d5f2f56bc8e49ae40881a543fbddf8f312 (patch)
tree36d10723b0d144bfe61946733465a72090d59ae9
parent5e7ed98f7c6497b67376977fafdf2dd860537f14 (diff)
downloademacs-3c3eb1d5f2f56bc8e49ae40881a543fbddf8f312.tar.gz
emacs-3c3eb1d5f2f56bc8e49ae40881a543fbddf8f312.zip
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.
-rw-r--r--lisp/eshell/em-cmpl.el10
-rw-r--r--lisp/eshell/esh-ext.el17
2 files changed, 18 insertions, 9 deletions
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index dbea9e5ceec..93b275e2ffb 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -405,7 +405,9 @@ to writing a completion function."
405 "Generate list of applicable, visible commands." 405 "Generate list of applicable, visible commands."
406 (let ((filename (pcomplete-arg)) glob-name) 406 (let ((filename (pcomplete-arg)) glob-name)
407 (if (file-name-directory filename) 407 (if (file-name-directory filename)
408 (pcomplete-executables) 408 (if eshell-force-execution
409 (pcomplete-dirs-or-entries nil 'file-readable-p)
410 (pcomplete-executables))
409 (if (and (> (length filename) 0) 411 (if (and (> (length filename) 0)
410 (eq (aref filename 0) eshell-explicit-command-char)) 412 (eq (aref filename 0) eshell-explicit-command-char))
411 (setq filename (substring filename 1) 413 (setq filename (substring filename 1)
@@ -416,6 +418,8 @@ to writing a completion function."
416 (expand-file-name default-directory))) 418 (expand-file-name default-directory)))
417 (path "") (comps-in-path ()) 419 (path "") (comps-in-path ())
418 (file "") (filepath "") (completions ())) 420 (file "") (filepath "") (completions ()))
421 (if (eshell-under-windows-p)
422 (push "." paths))
419 ;; Go thru each path in the search path, finding completions. 423 ;; Go thru each path in the search path, finding completions.
420 (while paths 424 (while paths
421 (setq path (file-name-as-directory 425 (setq path (file-name-as-directory
@@ -431,7 +435,9 @@ to writing a completion function."
431 (if (and (not (member file completions)) ; 435 (if (and (not (member file completions)) ;
432 (or (string-equal path cwd) 436 (or (string-equal path cwd)
433 (not (file-directory-p filepath))) 437 (not (file-directory-p filepath)))
434 (file-executable-p filepath)) 438 (if eshell-force-execution
439 (file-readable-p filepath)
440 (file-executable-p filepath)))
435 (setq completions (cons file completions))) 441 (setq completions (cons file completions)))
436 (setq comps-in-path (cdr comps-in-path))) 442 (setq comps-in-path (cdr comps-in-path)))
437 (setq paths (cdr paths))) 443 (setq paths (cdr paths)))
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el
index 0b25b31eff9..91c4f4b6095 100644
--- a/lisp/eshell/esh-ext.el
+++ b/lisp/eshell/esh-ext.el
@@ -60,14 +60,15 @@ loaded into memory, thus beginning a new process."
60 :type '(repeat string) 60 :type '(repeat string)
61 :group 'eshell-ext) 61 :group 'eshell-ext)
62 62
63(defcustom eshell-force-execution nil 63(defcustom eshell-force-execution
64 "If non-nil, try to execute binary files regardless of permissions. 64 (not (null (memq system-type '(windows-nt ms-dos))))
65 "If non-nil, try to execute files regardless of execute permissions.
65This can be useful on systems like Windows, where the operating system 66This can be useful on systems like Windows, where the operating system
66doesn't happen to honor the permission bits in certain cases; or in 67doesn't support the execution bit for shell scripts; or in cases where
67cases where you want to associate an interpreter with a particular 68you want to associate an interpreter with a particular kind of script
68kind of script file, but the language won't let you but a '#!' 69file, but the language won't let you but a '#!' interpreter line in
69interpreter line in the file, and you don't want to make it executable 70the file, and you don't want to make it executable since nothing else
70since nothing else but Eshell will be able to understand 71but Eshell will be able to understand
71`eshell-interpreter-alist'." 72`eshell-interpreter-alist'."
72 :type 'boolean 73 :type 'boolean
73 :group 'eshell-ext) 74 :group 'eshell-ext)
@@ -78,6 +79,8 @@ since nothing else but Eshell will be able to understand
78 name 79 name
79 (let ((list (eshell-parse-colon-path eshell-path-env)) 80 (let ((list (eshell-parse-colon-path eshell-path-env))
80 suffixes n1 n2 file) 81 suffixes n1 n2 file)
82 (if (eshell-under-windows-p)
83 (push "." list))
81 (while list 84 (while list
82 (setq n1 (concat (car list) name)) 85 (setq n1 (concat (car list) name))
83 (setq suffixes eshell-binary-suffixes) 86 (setq suffixes eshell-binary-suffixes)