diff options
| author | Stephen Leake | 2019-04-11 14:00:02 -0700 |
|---|---|---|
| committer | Stephen Leake | 2019-04-11 14:00:02 -0700 |
| commit | 7ba7def5caf7ec9d9bebffff489f0a658229fbda (patch) | |
| tree | e0cfcb59937ca0528fb81769d7d48a904a91f5dc /lisp/eshell | |
| parent | 7768581172e11be52b1fcd8224f4594e126bbdb7 (diff) | |
| parent | de238b39e335c6814283faa171b35145f124edf2 (diff) | |
| download | emacs-7ba7def5caf7ec9d9bebffff489f0a658229fbda.tar.gz emacs-7ba7def5caf7ec9d9bebffff489f0a658229fbda.zip | |
Merge commit 'de238b39e335c6814283faa171b35145f124edf2'
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/em-alias.el | 8 | ||||
| -rw-r--r-- | lisp/eshell/em-banner.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/em-cmpl.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/em-dirs.el | 5 | ||||
| -rw-r--r-- | lisp/eshell/em-glob.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/em-hist.el | 22 | ||||
| -rw-r--r-- | lisp/eshell/em-ls.el | 3 | ||||
| -rw-r--r-- | lisp/eshell/em-pred.el | 8 | ||||
| -rw-r--r-- | lisp/eshell/em-prompt.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/em-rebind.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/em-script.el | 10 | ||||
| -rw-r--r-- | lisp/eshell/em-smart.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/em-term.el | 4 | ||||
| -rw-r--r-- | lisp/eshell/em-tramp.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/em-unix.el | 5 | ||||
| -rw-r--r-- | lisp/eshell/esh-arg.el | 96 | ||||
| -rw-r--r-- | lisp/eshell/esh-cmd.el | 6 | ||||
| -rw-r--r-- | lisp/eshell/esh-ext.el | 20 | ||||
| -rw-r--r-- | lisp/eshell/esh-io.el | 5 | ||||
| -rw-r--r-- | lisp/eshell/esh-mode.el | 35 | ||||
| -rw-r--r-- | lisp/eshell/esh-module.el | 4 | ||||
| -rw-r--r-- | lisp/eshell/esh-opt.el | 12 | ||||
| -rw-r--r-- | lisp/eshell/esh-proc.el | 61 | ||||
| -rw-r--r-- | lisp/eshell/esh-util.el | 18 | ||||
| -rw-r--r-- | lisp/eshell/esh-var.el | 21 | ||||
| -rw-r--r-- | lisp/eshell/eshell.el | 21 |
26 files changed, 200 insertions, 178 deletions
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el index dbffd52aa76..c465d464d6a 100644 --- a/lisp/eshell/em-alias.el +++ b/lisp/eshell/em-alias.el | |||
| @@ -90,7 +90,7 @@ | |||
| 90 | 90 | ||
| 91 | ;;; Code: | 91 | ;;; Code: |
| 92 | 92 | ||
| 93 | (require 'eshell) | 93 | (require 'esh-mode) |
| 94 | 94 | ||
| 95 | ;;;###autoload | 95 | ;;;###autoload |
| 96 | (progn | 96 | (progn |
| @@ -141,12 +141,12 @@ file named by `eshell-aliases-file'.") | |||
| 141 | (defvar eshell-failed-commands-alist nil | 141 | (defvar eshell-failed-commands-alist nil |
| 142 | "An alist of command name failures.") | 142 | "An alist of command name failures.") |
| 143 | 143 | ||
| 144 | (defun eshell-alias-initialize () | 144 | (defun eshell-alias-initialize () ;Called from `eshell-mode' via intern-soft! |
| 145 | "Initialize the alias handling code." | 145 | "Initialize the alias handling code." |
| 146 | (make-local-variable 'eshell-failed-commands-alist) | 146 | (make-local-variable 'eshell-failed-commands-alist) |
| 147 | (add-hook 'eshell-alternate-command-hook 'eshell-fix-bad-commands t t) | 147 | (add-hook 'eshell-alternate-command-hook #'eshell-fix-bad-commands t t) |
| 148 | (eshell-read-aliases-list) | 148 | (eshell-read-aliases-list) |
| 149 | (add-hook 'eshell-named-command-hook 'eshell-maybe-replace-by-alias t t) | 149 | (add-hook 'eshell-named-command-hook #'eshell-maybe-replace-by-alias t t) |
| 150 | (make-local-variable 'eshell-complex-commands) | 150 | (make-local-variable 'eshell-complex-commands) |
| 151 | (add-to-list 'eshell-complex-commands 'eshell-command-aliased-p)) | 151 | (add-to-list 'eshell-complex-commands 'eshell-command-aliased-p)) |
| 152 | 152 | ||
diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el index 4a0b265ae0e..c284c1bd70d 100644 --- a/lisp/eshell/em-banner.el +++ b/lisp/eshell/em-banner.el | |||
| @@ -71,7 +71,7 @@ This can be any sexp, and should end with at least two newlines." | |||
| 71 | :type 'hook | 71 | :type 'hook |
| 72 | :group 'eshell-banner) | 72 | :group 'eshell-banner) |
| 73 | 73 | ||
| 74 | (defun eshell-banner-initialize () | 74 | (defun eshell-banner-initialize () ;Called from `eshell-mode' via intern-soft! |
| 75 | "Output a welcome banner on initialization." | 75 | "Output a welcome banner on initialization." |
| 76 | ;; it's important to use `eshell-interactive-print' rather than | 76 | ;; it's important to use `eshell-interactive-print' rather than |
| 77 | ;; `insert', because `insert' doesn't know how to interact with the | 77 | ;; `insert', because `insert' doesn't know how to interact with the |
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el index 25a6e88c8e6..e3bfd8d9d48 100644 --- a/lisp/eshell/em-cmpl.el +++ b/lisp/eshell/em-cmpl.el | |||
| @@ -244,7 +244,7 @@ to writing a completion function." | |||
| 244 | (let ((completion-at-point-functions '(lisp-completion-at-point))) | 244 | (let ((completion-at-point-functions '(lisp-completion-at-point))) |
| 245 | (completion-at-point))) | 245 | (completion-at-point))) |
| 246 | 246 | ||
| 247 | (defun eshell-cmpl-initialize () | 247 | (defun eshell-cmpl-initialize () ;Called from `eshell-mode' via intern-soft! |
| 248 | "Initialize the completions module." | 248 | "Initialize the completions module." |
| 249 | (set (make-local-variable 'pcomplete-command-completion-function) | 249 | (set (make-local-variable 'pcomplete-command-completion-function) |
| 250 | eshell-command-completion-function) | 250 | eshell-command-completion-function) |
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el index 937bc981c53..c28fd72f45c 100644 --- a/lisp/eshell/em-dirs.el +++ b/lisp/eshell/em-dirs.el | |||
| @@ -42,7 +42,8 @@ | |||
| 42 | 42 | ||
| 43 | ;;; Code: | 43 | ;;; Code: |
| 44 | 44 | ||
| 45 | (require 'eshell) | 45 | (require 'esh-mode) ;For eshell-directory-name |
| 46 | (require 'esh-var) ;For eshell-variable-aliases-list | ||
| 46 | (require 'ring) | 47 | (require 'ring) |
| 47 | (require 'esh-opt) | 48 | (require 'esh-opt) |
| 48 | 49 | ||
| @@ -169,7 +170,7 @@ Thus, this does not include the current directory.") | |||
| 169 | 170 | ||
| 170 | ;;; Functions: | 171 | ;;; Functions: |
| 171 | 172 | ||
| 172 | (defun eshell-dirs-initialize () | 173 | (defun eshell-dirs-initialize () ;Called from `eshell-mode' via intern-soft! |
| 173 | "Initialize the builtin functions for Eshell." | 174 | "Initialize the builtin functions for Eshell." |
| 174 | (make-local-variable 'eshell-variable-aliases-list) | 175 | (make-local-variable 'eshell-variable-aliases-list) |
| 175 | (setq eshell-variable-aliases-list | 176 | (setq eshell-variable-aliases-list |
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el index f03243a6af4..99c52ea0d30 100644 --- a/lisp/eshell/em-glob.el +++ b/lisp/eshell/em-glob.el | |||
| @@ -125,7 +125,7 @@ This option slows down recursive glob processing by quite a bit." | |||
| 125 | 125 | ||
| 126 | ;;; Functions: | 126 | ;;; Functions: |
| 127 | 127 | ||
| 128 | (defun eshell-glob-initialize () | 128 | (defun eshell-glob-initialize () ;Called from `eshell-mode' via intern-soft! |
| 129 | "Initialize the extended globbing code." | 129 | "Initialize the extended globbing code." |
| 130 | ;; it's important that `eshell-glob-chars-list' come first | 130 | ;; it's important that `eshell-glob-chars-list' come first |
| 131 | (when (boundp 'eshell-special-chars-outside-quoting) | 131 | (when (boundp 'eshell-special-chars-outside-quoting) |
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 05579eed32a..614faaa131e 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | 59 | ||
| 60 | (require 'ring) | 60 | (require 'ring) |
| 61 | (require 'esh-opt) | 61 | (require 'esh-opt) |
| 62 | (require 'esh-mode) | ||
| 62 | (require 'em-pred) | 63 | (require 'em-pred) |
| 63 | (require 'eshell) | 64 | (require 'eshell) |
| 64 | 65 | ||
| @@ -192,7 +193,6 @@ element, regardless of any text on the command line. In that case, | |||
| 192 | (defvar eshell-isearch-map | 193 | (defvar eshell-isearch-map |
| 193 | (let ((map (copy-keymap isearch-mode-map))) | 194 | (let ((map (copy-keymap isearch-mode-map))) |
| 194 | (define-key map [(control ?m)] 'eshell-isearch-return) | 195 | (define-key map [(control ?m)] 'eshell-isearch-return) |
| 195 | (define-key map [return] 'eshell-isearch-return) | ||
| 196 | (define-key map [(control ?r)] 'eshell-isearch-repeat-backward) | 196 | (define-key map [(control ?r)] 'eshell-isearch-repeat-backward) |
| 197 | (define-key map [(control ?s)] 'eshell-isearch-repeat-forward) | 197 | (define-key map [(control ?s)] 'eshell-isearch-repeat-forward) |
| 198 | (define-key map [(control ?g)] 'eshell-isearch-abort) | 198 | (define-key map [(control ?g)] 'eshell-isearch-abort) |
| @@ -216,11 +216,11 @@ Returns non-nil if INPUT is blank." | |||
| 216 | Returns nil if INPUT is prepended by blank space, otherwise non-nil." | 216 | Returns nil if INPUT is prepended by blank space, otherwise non-nil." |
| 217 | (not (string-match-p "\\`\\s-+" input))) | 217 | (not (string-match-p "\\`\\s-+" input))) |
| 218 | 218 | ||
| 219 | (defun eshell-hist-initialize () | 219 | (defun eshell-hist-initialize () ;Called from `eshell-mode' via intern-soft! |
| 220 | "Initialize the history management code for one Eshell buffer." | 220 | "Initialize the history management code for one Eshell buffer." |
| 221 | (when (eshell-using-module 'eshell-cmpl) | 221 | (when (eshell-using-module 'eshell-cmpl) |
| 222 | (add-hook 'pcomplete-try-first-hook | 222 | (add-hook 'pcomplete-try-first-hook |
| 223 | 'eshell-complete-history-reference nil t)) | 223 | #'eshell-complete-history-reference nil t)) |
| 224 | 224 | ||
| 225 | (if (and (eshell-using-module 'eshell-rebind) | 225 | (if (and (eshell-using-module 'eshell-rebind) |
| 226 | (not eshell-non-interactive-p)) | 226 | (not eshell-non-interactive-p)) |
| @@ -235,11 +235,13 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil." | |||
| 235 | (lambda () | 235 | (lambda () |
| 236 | (if (>= (point) eshell-last-output-end) | 236 | (if (>= (point) eshell-last-output-end) |
| 237 | (setq overriding-terminal-local-map | 237 | (setq overriding-terminal-local-map |
| 238 | eshell-isearch-map)))) nil t) | 238 | eshell-isearch-map)))) |
| 239 | nil t) | ||
| 239 | (add-hook 'isearch-mode-end-hook | 240 | (add-hook 'isearch-mode-end-hook |
| 240 | (function | 241 | (function |
| 241 | (lambda () | 242 | (lambda () |
| 242 | (setq overriding-terminal-local-map nil))) nil t)) | 243 | (setq overriding-terminal-local-map nil))) |
| 244 | nil t)) | ||
| 243 | (define-key eshell-mode-map [up] 'eshell-previous-matching-input-from-input) | 245 | (define-key eshell-mode-map [up] 'eshell-previous-matching-input-from-input) |
| 244 | (define-key eshell-mode-map [down] 'eshell-next-matching-input-from-input) | 246 | (define-key eshell-mode-map [down] 'eshell-next-matching-input-from-input) |
| 245 | (define-key eshell-mode-map [(control up)] 'eshell-previous-input) | 247 | (define-key eshell-mode-map [(control up)] 'eshell-previous-input) |
| @@ -288,17 +290,17 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil." | |||
| 288 | (if eshell-history-file-name | 290 | (if eshell-history-file-name |
| 289 | (eshell-read-history nil t)) | 291 | (eshell-read-history nil t)) |
| 290 | 292 | ||
| 291 | (add-hook 'eshell-exit-hook 'eshell-write-history nil t)) | 293 | (add-hook 'eshell-exit-hook #'eshell-write-history nil t)) |
| 292 | 294 | ||
| 293 | (unless eshell-history-ring | 295 | (unless eshell-history-ring |
| 294 | (setq eshell-history-ring (make-ring eshell-history-size))) | 296 | (setq eshell-history-ring (make-ring eshell-history-size))) |
| 295 | 297 | ||
| 296 | (add-hook 'eshell-exit-hook 'eshell-write-history nil t) | 298 | (add-hook 'eshell-exit-hook #'eshell-write-history nil t) |
| 297 | 299 | ||
| 298 | (add-hook 'kill-emacs-hook 'eshell-save-some-history) | 300 | (add-hook 'kill-emacs-hook #'eshell-save-some-history) |
| 299 | 301 | ||
| 300 | (make-local-variable 'eshell-input-filter-functions) | 302 | (make-local-variable 'eshell-input-filter-functions) |
| 301 | (add-hook 'eshell-input-filter-functions 'eshell-add-to-history nil t) | 303 | (add-hook 'eshell-input-filter-functions #'eshell-add-to-history nil t) |
| 302 | 304 | ||
| 303 | (define-key eshell-command-map [(control ?l)] 'eshell-list-history) | 305 | (define-key eshell-command-map [(control ?l)] 'eshell-list-history) |
| 304 | (define-key eshell-command-map [(control ?x)] 'eshell-get-next-from-history)) | 306 | (define-key eshell-command-map [(control ?x)] 'eshell-get-next-from-history)) |
| @@ -754,7 +756,7 @@ matched." | |||
| 754 | (setq nth (eshell-hist-word-reference nth))) | 756 | (setq nth (eshell-hist-word-reference nth))) |
| 755 | (unless (numberp mth) | 757 | (unless (numberp mth) |
| 756 | (setq mth (eshell-hist-word-reference mth))) | 758 | (setq mth (eshell-hist-word-reference mth))) |
| 757 | (cons (mapconcat 'identity (eshell-sublist textargs nth mth) " ") | 759 | (cons (mapconcat #'identity (eshell-sublist textargs nth mth) " ") |
| 758 | end)))) | 760 | end)))) |
| 759 | 761 | ||
| 760 | (defun eshell-hist-parse-modifier (hist reference) | 762 | (defun eshell-hist-parse-modifier (hist reference) |
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el index 5e4bbdc87ef..89969d32582 100644 --- a/lisp/eshell/em-ls.el +++ b/lisp/eshell/em-ls.el | |||
| @@ -29,7 +29,8 @@ | |||
| 29 | (require 'cl-lib) | 29 | (require 'cl-lib) |
| 30 | (require 'esh-util) | 30 | (require 'esh-util) |
| 31 | (require 'esh-opt) | 31 | (require 'esh-opt) |
| 32 | (eval-when-compile (require 'eshell)) | 32 | (require 'esh-proc) |
| 33 | (require 'esh-cmd) | ||
| 33 | 34 | ||
| 34 | ;;;###autoload | 35 | ;;;###autoload |
| 35 | (progn | 36 | (progn |
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index dd3351b14d3..9bc856a2966 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el | |||
| @@ -46,9 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | ;;; Code: | 47 | ;;; Code: |
| 48 | 48 | ||
| 49 | (require 'esh-util) | 49 | (require 'esh-mode) |
| 50 | (require 'esh-arg) | ||
| 51 | (eval-when-compile (require 'eshell)) | ||
| 52 | 50 | ||
| 53 | ;;;###autoload | 51 | ;;;###autoload |
| 54 | (progn | 52 | (progn |
| @@ -247,10 +245,10 @@ EXAMPLES: | |||
| 247 | (lambda () | 245 | (lambda () |
| 248 | (insert eshell-modifier-help-string))))) | 246 | (insert eshell-modifier-help-string))))) |
| 249 | 247 | ||
| 250 | (defun eshell-pred-initialize () | 248 | (defun eshell-pred-initialize () ;Called from `eshell-mode' via intern-soft! |
| 251 | "Initialize the predicate/modifier code." | 249 | "Initialize the predicate/modifier code." |
| 252 | (add-hook 'eshell-parse-argument-hook | 250 | (add-hook 'eshell-parse-argument-hook |
| 253 | 'eshell-parse-arg-modifier t t) | 251 | #'eshell-parse-arg-modifier t t) |
| 254 | (define-key eshell-command-map [(meta ?q)] 'eshell-display-predicate-help) | 252 | (define-key eshell-command-map [(meta ?q)] 'eshell-display-predicate-help) |
| 255 | (define-key eshell-command-map [(meta ?m)] 'eshell-display-modifier-help)) | 253 | (define-key eshell-command-map [(meta ?m)] 'eshell-display-modifier-help)) |
| 256 | 254 | ||
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index a3035205adb..adc68b6c856 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el | |||
| @@ -99,7 +99,7 @@ arriving, or after." | |||
| 99 | 99 | ||
| 100 | ;;; Functions: | 100 | ;;; Functions: |
| 101 | 101 | ||
| 102 | (defun eshell-prompt-initialize () | 102 | (defun eshell-prompt-initialize () ;Called from `eshell-mode' via intern-soft! |
| 103 | "Initialize the prompting code." | 103 | "Initialize the prompting code." |
| 104 | (unless eshell-non-interactive-p | 104 | (unless eshell-non-interactive-p |
| 105 | (add-hook 'eshell-post-command-hook 'eshell-emit-prompt nil t) | 105 | (add-hook 'eshell-post-command-hook 'eshell-emit-prompt nil t) |
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el index 9cb16174f20..a817edbcc99 100644 --- a/lisp/eshell/em-rebind.el +++ b/lisp/eshell/em-rebind.el | |||
| @@ -145,7 +145,7 @@ This is default behavior of shells like bash." | |||
| 145 | 145 | ||
| 146 | ;;; Functions: | 146 | ;;; Functions: |
| 147 | 147 | ||
| 148 | (defun eshell-rebind-initialize () | 148 | (defun eshell-rebind-initialize () ;Called from `eshell-mode' via intern-soft! |
| 149 | "Initialize the inputting code." | 149 | "Initialize the inputting code." |
| 150 | (unless eshell-non-interactive-p | 150 | (unless eshell-non-interactive-p |
| 151 | (add-hook 'eshell-mode-hook 'eshell-setup-input-keymap nil t) | 151 | (add-hook 'eshell-mode-hook 'eshell-setup-input-keymap nil t) |
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el index bab26222baf..4a3b84e10e3 100644 --- a/lisp/eshell/em-script.el +++ b/lisp/eshell/em-script.el | |||
| @@ -23,8 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (require 'eshell) | 26 | (require 'esh-mode) |
| 27 | (require 'esh-opt) | ||
| 28 | 27 | ||
| 29 | ;;;###autoload | 28 | ;;;###autoload |
| 30 | (progn | 29 | (progn |
| @@ -57,7 +56,7 @@ This includes when running `eshell-command'." | |||
| 57 | 56 | ||
| 58 | ;;; Functions: | 57 | ;;; Functions: |
| 59 | 58 | ||
| 60 | (defun eshell-script-initialize () | 59 | (defun eshell-script-initialize () ;Called from `eshell-mode' via intern-soft! |
| 61 | "Initialize the script parsing code." | 60 | "Initialize the script parsing code." |
| 62 | (make-local-variable 'eshell-interpreter-alist) | 61 | (make-local-variable 'eshell-interpreter-alist) |
| 63 | (setq eshell-interpreter-alist | 62 | (setq eshell-interpreter-alist |
| @@ -73,13 +72,14 @@ This includes when running `eshell-command'." | |||
| 73 | ;; to ruin it for other modules | 72 | ;; to ruin it for other modules |
| 74 | (let (eshell-inside-quote-regexp | 73 | (let (eshell-inside-quote-regexp |
| 75 | eshell-outside-quote-regexp) | 74 | eshell-outside-quote-regexp) |
| 76 | (and (not eshell-non-interactive-p) | 75 | (and (not (bound-and-true-p eshell-non-interactive-p)) |
| 77 | eshell-login-script | 76 | eshell-login-script |
| 78 | (file-readable-p eshell-login-script) | 77 | (file-readable-p eshell-login-script) |
| 79 | (eshell-do-eval | 78 | (eshell-do-eval |
| 80 | (list 'eshell-commands | 79 | (list 'eshell-commands |
| 81 | (catch 'eshell-replace-command | 80 | (catch 'eshell-replace-command |
| 82 | (eshell-source-file eshell-login-script))) t)) | 81 | (eshell-source-file eshell-login-script))) |
| 82 | t)) | ||
| 83 | (and eshell-rc-script | 83 | (and eshell-rc-script |
| 84 | (file-readable-p eshell-rc-script) | 84 | (file-readable-p eshell-rc-script) |
| 85 | (eshell-do-eval | 85 | (eshell-do-eval |
diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el index 420f8850504..c7965b4187c 100644 --- a/lisp/eshell/em-smart.el +++ b/lisp/eshell/em-smart.el | |||
| @@ -166,7 +166,7 @@ The options are `begin', `after' or `end'." | |||
| 166 | 166 | ||
| 167 | ;;; Functions: | 167 | ;;; Functions: |
| 168 | 168 | ||
| 169 | (defun eshell-smart-initialize () | 169 | (defun eshell-smart-initialize () ;Called from `eshell-mode' via intern-soft! |
| 170 | "Setup Eshell smart display." | 170 | "Setup Eshell smart display." |
| 171 | (unless eshell-non-interactive-p | 171 | (unless eshell-non-interactive-p |
| 172 | ;; override a few variables, since they would interfere with the | 172 | ;; override a few variables, since they would interfere with the |
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el index 8af783eaf80..dea90405ad7 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el | |||
| @@ -147,7 +147,7 @@ behavior for short-lived processes, see bug#18108." | |||
| 147 | 147 | ||
| 148 | ;;; Functions: | 148 | ;;; Functions: |
| 149 | 149 | ||
| 150 | (defun eshell-term-initialize () | 150 | (defun eshell-term-initialize () ;Called from `eshell-mode' via intern-soft! |
| 151 | "Initialize the `term' interface code." | 151 | "Initialize the `term' interface code." |
| 152 | (make-local-variable 'eshell-interpreter-alist) | 152 | (make-local-variable 'eshell-interpreter-alist) |
| 153 | (setq eshell-interpreter-alist | 153 | (setq eshell-interpreter-alist |
| @@ -191,7 +191,7 @@ allowed." | |||
| 191 | (term-exec term-buf program program nil args) | 191 | (term-exec term-buf program program nil args) |
| 192 | (let ((proc (get-buffer-process term-buf))) | 192 | (let ((proc (get-buffer-process term-buf))) |
| 193 | (if (and proc (eq 'run (process-status proc))) | 193 | (if (and proc (eq 'run (process-status proc))) |
| 194 | (set-process-sentinel proc 'eshell-term-sentinel) | 194 | (set-process-sentinel proc #'eshell-term-sentinel) |
| 195 | (error "Failed to invoke visual command"))) | 195 | (error "Failed to invoke visual command"))) |
| 196 | (term-char-mode) | 196 | (term-char-mode) |
| 197 | (if eshell-escape-control-x | 197 | (if eshell-escape-control-x |
diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el index 603b7627d5d..c7916360ee6 100644 --- a/lisp/eshell/em-tramp.el +++ b/lisp/eshell/em-tramp.el | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | :tag "TRAMP Eshell features" | 46 | :tag "TRAMP Eshell features" |
| 47 | :group 'eshell-module)) | 47 | :group 'eshell-module)) |
| 48 | 48 | ||
| 49 | (defun eshell-tramp-initialize () | 49 | (defun eshell-tramp-initialize () ;Called from `eshell-mode' via intern-soft! |
| 50 | "Initialize the TRAMP-using commands code." | 50 | "Initialize the TRAMP-using commands code." |
| 51 | (when (eshell-using-module 'eshell-cmpl) | 51 | (when (eshell-using-module 'eshell-cmpl) |
| 52 | (add-hook 'pcomplete-try-first-hook | 52 | (add-hook 'pcomplete-try-first-hook |
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index e4c4265d702..25221817218 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el | |||
| @@ -35,8 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | ;;; Code: | 36 | ;;; Code: |
| 37 | 37 | ||
| 38 | (require 'eshell) | 38 | (require 'esh-mode) |
| 39 | (require 'esh-opt) | ||
| 40 | (require 'pcomplete) | 39 | (require 'pcomplete) |
| 41 | 40 | ||
| 42 | ;;;###autoload | 41 | ;;;###autoload |
| @@ -140,7 +139,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on the remote machine." | |||
| 140 | 139 | ||
| 141 | ;;; Functions: | 140 | ;;; Functions: |
| 142 | 141 | ||
| 143 | (defun eshell-unix-initialize () | 142 | (defun eshell-unix-initialize () ;Called from `eshell-mode' via intern-soft! |
| 144 | "Initialize the UNIX support/emulation code." | 143 | "Initialize the UNIX support/emulation code." |
| 145 | (when (eshell-using-module 'eshell-cmpl) | 144 | (when (eshell-using-module 'eshell-cmpl) |
| 146 | (add-hook 'pcomplete-try-first-hook | 145 | (add-hook 'pcomplete-try-first-hook |
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el index 360202b6539..026edc59808 100644 --- a/lisp/eshell/esh-arg.el +++ b/lisp/eshell/esh-arg.el | |||
| @@ -25,9 +25,9 @@ | |||
| 25 | ;; hook `eshell-parse-argument-hook'. For a good example of this, see | 25 | ;; hook `eshell-parse-argument-hook'. For a good example of this, see |
| 26 | ;; `eshell-parse-drive-letter', defined in eshell-dirs.el. | 26 | ;; `eshell-parse-drive-letter', defined in eshell-dirs.el. |
| 27 | 27 | ||
| 28 | (provide 'esh-arg) | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | (require 'esh-mode) | 30 | (require 'esh-util) |
| 31 | 31 | ||
| 32 | (defgroup eshell-arg nil | 32 | (defgroup eshell-arg nil |
| 33 | "Argument parsing involves transforming the arguments passed on the | 33 | "Argument parsing involves transforming the arguments passed on the |
| @@ -36,6 +36,48 @@ yield the values intended." | |||
| 36 | :tag "Argument parsing" | 36 | :tag "Argument parsing" |
| 37 | :group 'eshell) | 37 | :group 'eshell) |
| 38 | 38 | ||
| 39 | ;;; Internal Variables: | ||
| 40 | |||
| 41 | (defvar eshell-current-argument nil) | ||
| 42 | (defvar eshell-current-modifiers nil) | ||
| 43 | (defvar eshell-arg-listified nil) | ||
| 44 | (defvar eshell-nested-argument nil) | ||
| 45 | (defvar eshell-current-quoted nil) | ||
| 46 | (defvar eshell-inside-quote-regexp nil) | ||
| 47 | (defvar eshell-outside-quote-regexp nil) | ||
| 48 | |||
| 49 | ;;; User Variables: | ||
| 50 | |||
| 51 | (defcustom eshell-arg-load-hook nil | ||
| 52 | "A hook that gets run when `eshell-arg' is loaded." | ||
| 53 | :version "24.1" ; removed eshell-arg-initialize | ||
| 54 | :type 'hook | ||
| 55 | :group 'eshell-arg) | ||
| 56 | |||
| 57 | (defcustom eshell-delimiter-argument-list '(?\; ?& ?\| ?\> ?\s ?\t ?\n) | ||
| 58 | "List of characters to recognize as argument separators." | ||
| 59 | :type '(repeat character) | ||
| 60 | :group 'eshell-arg) | ||
| 61 | |||
| 62 | (defcustom eshell-special-chars-inside-quoting '(?\\ ?\") | ||
| 63 | "Characters which are still special inside double quotes." | ||
| 64 | :type '(repeat character) | ||
| 65 | :group 'eshell-arg) | ||
| 66 | |||
| 67 | (defcustom eshell-special-chars-outside-quoting | ||
| 68 | (append eshell-delimiter-argument-list '(?# ?! ?\\ ?\" ?\')) | ||
| 69 | "Characters that require escaping outside of double quotes. | ||
| 70 | Without escaping them, they will introduce a change in the argument." | ||
| 71 | :type '(repeat character) | ||
| 72 | :group 'eshell-arg) | ||
| 73 | |||
| 74 | (defsubst eshell-arg-delimiter (&optional pos) | ||
| 75 | "Return non-nil if POS is an argument delimiter. | ||
| 76 | If POS is nil, the location of point is checked." | ||
| 77 | (let ((pos (or pos (point)))) | ||
| 78 | (or (= pos (point-max)) | ||
| 79 | (memq (char-after pos) eshell-delimiter-argument-list)))) | ||
| 80 | |||
| 39 | (defcustom eshell-parse-argument-hook | 81 | (defcustom eshell-parse-argument-hook |
| 40 | (list | 82 | (list |
| 41 | ;; a term such as #<buffer NAME>, or #<process NAME> is a buffer | 83 | ;; a term such as #<buffer NAME>, or #<process NAME> is a buffer |
| @@ -113,47 +155,13 @@ treated as a literal character." | |||
| 113 | :type 'hook | 155 | :type 'hook |
| 114 | :group 'eshell-arg) | 156 | :group 'eshell-arg) |
| 115 | 157 | ||
| 116 | ;;; Code: | ||
| 117 | |||
| 118 | ;;; User Variables: | ||
| 119 | |||
| 120 | (defcustom eshell-arg-load-hook nil | ||
| 121 | "A hook that gets run when `eshell-arg' is loaded." | ||
| 122 | :version "24.1" ; removed eshell-arg-initialize | ||
| 123 | :type 'hook | ||
| 124 | :group 'eshell-arg) | ||
| 125 | |||
| 126 | (defcustom eshell-delimiter-argument-list '(?\; ?& ?\| ?\> ?\s ?\t ?\n) | ||
| 127 | "List of characters to recognize as argument separators." | ||
| 128 | :type '(repeat character) | ||
| 129 | :group 'eshell-arg) | ||
| 130 | |||
| 131 | (defcustom eshell-special-chars-inside-quoting '(?\\ ?\") | ||
| 132 | "Characters which are still special inside double quotes." | ||
| 133 | :type '(repeat character) | ||
| 134 | :group 'eshell-arg) | ||
| 135 | |||
| 136 | (defcustom eshell-special-chars-outside-quoting | ||
| 137 | (append eshell-delimiter-argument-list '(?# ?! ?\\ ?\" ?\')) | ||
| 138 | "Characters that require escaping outside of double quotes. | ||
| 139 | Without escaping them, they will introduce a change in the argument." | ||
| 140 | :type '(repeat character) | ||
| 141 | :group 'eshell-arg) | ||
| 142 | |||
| 143 | ;;; Internal Variables: | ||
| 144 | |||
| 145 | (defvar eshell-current-argument nil) | ||
| 146 | (defvar eshell-current-modifiers nil) | ||
| 147 | (defvar eshell-arg-listified nil) | ||
| 148 | (defvar eshell-nested-argument nil) | ||
| 149 | (defvar eshell-current-quoted nil) | ||
| 150 | (defvar eshell-inside-quote-regexp nil) | ||
| 151 | (defvar eshell-outside-quote-regexp nil) | ||
| 152 | |||
| 153 | ;;; Functions: | 158 | ;;; Functions: |
| 154 | 159 | ||
| 155 | (defun eshell-arg-initialize () | 160 | (defun eshell-arg-initialize () ;Called from `eshell-mode' via intern-soft! |
| 156 | "Initialize the argument parsing code." | 161 | "Initialize the argument parsing code." |
| 162 | ;; This is supposedly run after enabling esh-mode, when eshell-mode-map | ||
| 163 | ;; already exists. | ||
| 164 | (defvar eshell-command-map) | ||
| 157 | (define-key eshell-command-map [(meta ?b)] 'eshell-insert-buffer-name) | 165 | (define-key eshell-command-map [(meta ?b)] 'eshell-insert-buffer-name) |
| 158 | (set (make-local-variable 'eshell-inside-quote-regexp) nil) | 166 | (set (make-local-variable 'eshell-inside-quote-regexp) nil) |
| 159 | (set (make-local-variable 'eshell-outside-quote-regexp) nil)) | 167 | (set (make-local-variable 'eshell-outside-quote-regexp) nil)) |
| @@ -195,13 +203,6 @@ Without escaping them, they will introduce a change in the argument." | |||
| 195 | (setq eshell-current-argument argument)) | 203 | (setq eshell-current-argument argument)) |
| 196 | (throw 'eshell-arg-done t)) | 204 | (throw 'eshell-arg-done t)) |
| 197 | 205 | ||
| 198 | (defsubst eshell-arg-delimiter (&optional pos) | ||
| 199 | "Return non-nil if POS is an argument delimiter. | ||
| 200 | If POS is nil, the location of point is checked." | ||
| 201 | (let ((pos (or pos (point)))) | ||
| 202 | (or (= pos (point-max)) | ||
| 203 | (memq (char-after pos) eshell-delimiter-argument-list)))) | ||
| 204 | |||
| 205 | (defun eshell-quote-argument (string) | 206 | (defun eshell-quote-argument (string) |
| 206 | "Return STRING with magic characters quoted. | 207 | "Return STRING with magic characters quoted. |
| 207 | Magic characters are those in `eshell-special-chars-outside-quoting'." | 208 | Magic characters are those in `eshell-special-chars-outside-quoting'." |
| @@ -405,4 +406,5 @@ If the form has no `type', the syntax is parsed as if `type' were | |||
| 405 | (char-to-string (char-after))))) | 406 | (char-to-string (char-after))))) |
| 406 | (goto-char end))))))) | 407 | (goto-char end))))))) |
| 407 | 408 | ||
| 409 | (provide 'esh-arg) | ||
| 408 | ;;; esh-arg.el ends here | 410 | ;;; esh-arg.el ends here |
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 1ed5d5d7018..6e03bda22b7 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el | |||
| @@ -105,6 +105,8 @@ | |||
| 105 | (require 'eldoc)) | 105 | (require 'eldoc)) |
| 106 | (require 'esh-arg) | 106 | (require 'esh-arg) |
| 107 | (require 'esh-proc) | 107 | (require 'esh-proc) |
| 108 | (require 'esh-module) | ||
| 109 | (require 'esh-io) | ||
| 108 | (require 'esh-ext) | 110 | (require 'esh-ext) |
| 109 | 111 | ||
| 110 | (eval-when-compile | 112 | (eval-when-compile |
| @@ -285,7 +287,7 @@ otherwise t.") | |||
| 285 | "Return currently running command process, if non-Lisp." | 287 | "Return currently running command process, if non-Lisp." |
| 286 | eshell-last-async-proc) | 288 | eshell-last-async-proc) |
| 287 | 289 | ||
| 288 | (defun eshell-cmd-initialize () | 290 | (defun eshell-cmd-initialize () ;Called from `eshell-mode' via intern-soft! |
| 289 | "Initialize the Eshell command processing module." | 291 | "Initialize the Eshell command processing module." |
| 290 | (set (make-local-variable 'eshell-current-command) nil) | 292 | (set (make-local-variable 'eshell-current-command) nil) |
| 291 | (set (make-local-variable 'eshell-command-name) nil) | 293 | (set (make-local-variable 'eshell-command-name) nil) |
| @@ -1337,7 +1339,7 @@ messages, and errors." | |||
| 1337 | (eshell-print "\n")) | 1339 | (eshell-print "\n")) |
| 1338 | (eshell-close-handles 0 (list 'quote result))))) | 1340 | (eshell-close-handles 0 (list 'quote result))))) |
| 1339 | 1341 | ||
| 1340 | (defalias 'eshell-lisp-command* 'eshell-lisp-command) | 1342 | (defalias 'eshell-lisp-command* #'eshell-lisp-command) |
| 1341 | 1343 | ||
| 1342 | (provide 'esh-cmd) | 1344 | (provide 'esh-cmd) |
| 1343 | 1345 | ||
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 35ebd36b291..978fc55c4de 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el | |||
| @@ -31,17 +31,12 @@ | |||
| 31 | 31 | ||
| 32 | ;;; Code: | 32 | ;;; Code: |
| 33 | 33 | ||
| 34 | (provide 'esh-ext) | ||
| 35 | |||
| 36 | (require 'esh-util) | 34 | (require 'esh-util) |
| 37 | 35 | ||
| 38 | (eval-when-compile | 36 | (eval-when-compile (require 'cl-lib)) |
| 39 | (require 'cl-lib) | ||
| 40 | (require 'esh-cmd)) | ||
| 41 | (require 'esh-io) | 37 | (require 'esh-io) |
| 42 | (require 'esh-arg) | 38 | (require 'esh-arg) |
| 43 | (require 'esh-opt) | 39 | (require 'esh-opt) |
| 44 | (require 'esh-proc) | ||
| 45 | 40 | ||
| 46 | (defgroup eshell-ext nil | 41 | (defgroup eshell-ext nil |
| 47 | "External commands are invoked when operating system executables are | 42 | "External commands are invoked when operating system executables are |
| @@ -177,9 +172,9 @@ external version." | |||
| 177 | 172 | ||
| 178 | ;;; Functions: | 173 | ;;; Functions: |
| 179 | 174 | ||
| 180 | (defun eshell-ext-initialize () | 175 | (defun eshell-ext-initialize () ;Called from `eshell-mode' via intern-soft! |
| 181 | "Initialize the external command handling code." | 176 | "Initialize the external command handling code." |
| 182 | (add-hook 'eshell-named-command-hook 'eshell-explicit-command nil t)) | 177 | (add-hook 'eshell-named-command-hook #'eshell-explicit-command nil t)) |
| 183 | 178 | ||
| 184 | (defun eshell-explicit-command (command args) | 179 | (defun eshell-explicit-command (command args) |
| 185 | "If a command name begins with `*', call it externally always. | 180 | "If a command name begins with `*', call it externally always. |
| @@ -193,8 +188,6 @@ This bypasses all Lisp functions and aliases." | |||
| 193 | (error "%s: external command not found" | 188 | (error "%s: external command not found" |
| 194 | (substring command 1)))))) | 189 | (substring command 1)))))) |
| 195 | 190 | ||
| 196 | (autoload 'eshell-close-handles "esh-io") | ||
| 197 | |||
| 198 | (defun eshell-remote-command (command args) | 191 | (defun eshell-remote-command (command args) |
| 199 | "Insert output from a remote COMMAND, using ARGS. | 192 | "Insert output from a remote COMMAND, using ARGS. |
| 200 | A remote command is something that executes on a different machine. | 193 | A remote command is something that executes on a different machine. |
| @@ -211,7 +204,7 @@ causing the user to wonder if anything's really going on..." | |||
| 211 | (progn | 204 | (progn |
| 212 | (setq exitcode | 205 | (setq exitcode |
| 213 | (shell-command | 206 | (shell-command |
| 214 | (mapconcat 'shell-quote-argument | 207 | (mapconcat #'shell-quote-argument |
| 215 | (append (list command) args) " ") | 208 | (append (list command) args) " ") |
| 216 | outbuf errbuf)) | 209 | outbuf errbuf)) |
| 217 | (eshell-print (with-current-buffer outbuf (buffer-string))) | 210 | (eshell-print (with-current-buffer outbuf (buffer-string))) |
| @@ -235,6 +228,8 @@ causing the user to wonder if anything's really going on..." | |||
| 235 | (cl-assert interp) | 228 | (cl-assert interp) |
| 236 | (if (functionp (car interp)) | 229 | (if (functionp (car interp)) |
| 237 | (apply (car interp) (append (cdr interp) args)) | 230 | (apply (car interp) (append (cdr interp) args)) |
| 231 | (require 'esh-proc) | ||
| 232 | (declare-function eshell-gather-process-output "esh-proc" (command args)) | ||
| 238 | (eshell-gather-process-output | 233 | (eshell-gather-process-output |
| 239 | (car interp) (append (cdr interp) args))))) | 234 | (car interp) (append (cdr interp) args))))) |
| 240 | 235 | ||
| @@ -249,7 +244,7 @@ Adds the given PATH to $PATH.") | |||
| 249 | (if args | 244 | (if args |
| 250 | (progn | 245 | (progn |
| 251 | (setq eshell-path-env (getenv "PATH") | 246 | (setq eshell-path-env (getenv "PATH") |
| 252 | args (mapconcat 'identity args path-separator) | 247 | args (mapconcat #'identity args path-separator) |
| 253 | eshell-path-env | 248 | eshell-path-env |
| 254 | (if prepend | 249 | (if prepend |
| 255 | (concat args path-separator eshell-path-env) | 250 | (concat args path-separator eshell-path-env) |
| @@ -336,4 +331,5 @@ line of the form #!<interp>." | |||
| 336 | (cdr interp))))) | 331 | (cdr interp))))) |
| 337 | (or interp (list fullname))))))) | 332 | (or interp (list fullname))))))) |
| 338 | 333 | ||
| 334 | (provide 'esh-ext) | ||
| 339 | ;;; esh-ext.el ends here | 335 | ;;; esh-ext.el ends here |
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index c33e7325a82..ce1d021384d 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el | |||
| @@ -68,8 +68,6 @@ | |||
| 68 | 68 | ||
| 69 | ;;; Code: | 69 | ;;; Code: |
| 70 | 70 | ||
| 71 | (provide 'esh-io) | ||
| 72 | |||
| 73 | (require 'esh-arg) | 71 | (require 'esh-arg) |
| 74 | (require 'esh-util) | 72 | (require 'esh-util) |
| 75 | 73 | ||
| @@ -171,7 +169,7 @@ not be added to this variable." | |||
| 171 | 169 | ||
| 172 | ;;; Functions: | 170 | ;;; Functions: |
| 173 | 171 | ||
| 174 | (defun eshell-io-initialize () | 172 | (defun eshell-io-initialize () ;Called from `eshell-mode' via intern-soft! |
| 175 | "Initialize the I/O subsystem code." | 173 | "Initialize the I/O subsystem code." |
| 176 | (add-hook 'eshell-parse-argument-hook | 174 | (add-hook 'eshell-parse-argument-hook |
| 177 | 'eshell-parse-redirection nil t) | 175 | 'eshell-parse-redirection nil t) |
| @@ -511,4 +509,5 @@ Returns what was actually sent, or nil if nothing was sent." | |||
| 511 | (eshell-output-object-to-target object (car target)) | 509 | (eshell-output-object-to-target object (car target)) |
| 512 | (setq target (cdr target)))))) | 510 | (setq target (cdr target)))))) |
| 513 | 511 | ||
| 512 | (provide 'esh-io) | ||
| 514 | ;;; esh-io.el ends here | 513 | ;;; esh-io.el ends here |
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 30298763a53..cff29bed1b6 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el | |||
| @@ -58,13 +58,10 @@ | |||
| 58 | 58 | ||
| 59 | ;;; Code: | 59 | ;;; Code: |
| 60 | 60 | ||
| 61 | (provide 'esh-mode) | ||
| 62 | |||
| 63 | (require 'esh-util) | 61 | (require 'esh-util) |
| 64 | (require 'esh-module) | 62 | (require 'esh-module) |
| 65 | (require 'esh-cmd) | 63 | (require 'esh-cmd) |
| 66 | (require 'esh-io) | 64 | (require 'esh-arg) ;For eshell-parse-arguments |
| 67 | (require 'esh-var) | ||
| 68 | 65 | ||
| 69 | (defgroup eshell-mode nil | 66 | (defgroup eshell-mode nil |
| 70 | "This module contains code for handling input from the user." | 67 | "This module contains code for handling input from the user." |
| @@ -202,6 +199,12 @@ This is used by `eshell-watch-for-password-prompt'." | |||
| 202 | :type 'boolean | 199 | :type 'boolean |
| 203 | :group 'eshell-mode) | 200 | :group 'eshell-mode) |
| 204 | 201 | ||
| 202 | (defcustom eshell-directory-name | ||
| 203 | (locate-user-emacs-file "eshell/" ".eshell/") | ||
| 204 | "The directory where Eshell control files should be kept." | ||
| 205 | :type 'directory | ||
| 206 | :group 'eshell) | ||
| 207 | |||
| 205 | (defvar eshell-first-time-p t | 208 | (defvar eshell-first-time-p t |
| 206 | "A variable which is non-nil the first time Eshell is loaded.") | 209 | "A variable which is non-nil the first time Eshell is loaded.") |
| 207 | 210 | ||
| @@ -292,7 +295,7 @@ and the hook `eshell-exit-hook'." | |||
| 292 | ;; It's fine to run this unconditionally since it can be customized | 295 | ;; It's fine to run this unconditionally since it can be customized |
| 293 | ;; via the `eshell-kill-processes-on-exit' variable. | 296 | ;; via the `eshell-kill-processes-on-exit' variable. |
| 294 | (and (fboundp 'eshell-query-kill-processes) | 297 | (and (fboundp 'eshell-query-kill-processes) |
| 295 | (not (memq 'eshell-query-kill-processes eshell-exit-hook)) | 298 | (not (memq #'eshell-query-kill-processes eshell-exit-hook)) |
| 296 | (eshell-query-kill-processes)) | 299 | (eshell-query-kill-processes)) |
| 297 | (run-hooks 'eshell-exit-hook)) | 300 | (run-hooks 'eshell-exit-hook)) |
| 298 | 301 | ||
| @@ -334,7 +337,6 @@ and the hook `eshell-exit-hook'." | |||
| 334 | (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument) | 337 | (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument) |
| 335 | (define-key eshell-command-map [(control ?e)] 'eshell-show-maximum-output) | 338 | (define-key eshell-command-map [(control ?e)] 'eshell-show-maximum-output) |
| 336 | (define-key eshell-command-map [(control ?f)] 'eshell-forward-argument) | 339 | (define-key eshell-command-map [(control ?f)] 'eshell-forward-argument) |
| 337 | (define-key eshell-command-map [return] 'eshell-copy-old-input) | ||
| 338 | (define-key eshell-command-map [(control ?m)] 'eshell-copy-old-input) | 340 | (define-key eshell-command-map [(control ?m)] 'eshell-copy-old-input) |
| 339 | (define-key eshell-command-map [(control ?o)] 'eshell-kill-output) | 341 | (define-key eshell-command-map [(control ?o)] 'eshell-kill-output) |
| 340 | (define-key eshell-command-map [(control ?r)] 'eshell-show-output) | 342 | (define-key eshell-command-map [(control ?r)] 'eshell-show-output) |
| @@ -410,23 +412,23 @@ and the hook `eshell-exit-hook'." | |||
| 410 | (when (and load-hook (boundp load-hook)) | 412 | (when (and load-hook (boundp load-hook)) |
| 411 | (if (memq initfunc (symbol-value load-hook)) (setq initfunc nil)) | 413 | (if (memq initfunc (symbol-value load-hook)) (setq initfunc nil)) |
| 412 | (run-hooks load-hook)) | 414 | (run-hooks load-hook)) |
| 413 | ;; So we don't need the -initialize functions on the hooks (b#5375). | 415 | ;; So we don't need the -initialize functions on the hooks (bug#5375). |
| 414 | (and initfunc (fboundp initfunc) (funcall initfunc)))) | 416 | (and initfunc (fboundp initfunc) (funcall initfunc)))) |
| 415 | 417 | ||
| 416 | (if eshell-send-direct-to-subprocesses | 418 | (if eshell-send-direct-to-subprocesses |
| 417 | (add-hook 'pre-command-hook 'eshell-intercept-commands t t)) | 419 | (add-hook 'pre-command-hook #'eshell-intercept-commands t t)) |
| 418 | 420 | ||
| 419 | (if eshell-scroll-to-bottom-on-input | 421 | (if eshell-scroll-to-bottom-on-input |
| 420 | (add-hook 'pre-command-hook 'eshell-preinput-scroll-to-bottom t t)) | 422 | (add-hook 'pre-command-hook #'eshell-preinput-scroll-to-bottom t t)) |
| 421 | 423 | ||
| 422 | (when eshell-scroll-show-maximum-output | 424 | (when eshell-scroll-show-maximum-output |
| 423 | (set (make-local-variable 'scroll-conservatively) 1000)) | 425 | (set (make-local-variable 'scroll-conservatively) 1000)) |
| 424 | 426 | ||
| 425 | (when eshell-status-in-mode-line | 427 | (when eshell-status-in-mode-line |
| 426 | (add-hook 'eshell-pre-command-hook 'eshell-command-started nil t) | 428 | (add-hook 'eshell-pre-command-hook #'eshell-command-started nil t) |
| 427 | (add-hook 'eshell-post-command-hook 'eshell-command-finished nil t)) | 429 | (add-hook 'eshell-post-command-hook #'eshell-command-finished nil t)) |
| 428 | 430 | ||
| 429 | (add-hook 'kill-buffer-hook 'eshell-kill-buffer-function t t) | 431 | (add-hook 'kill-buffer-hook #'eshell-kill-buffer-function t t) |
| 430 | 432 | ||
| 431 | (if eshell-first-time-p | 433 | (if eshell-first-time-p |
| 432 | (run-hooks 'eshell-first-time-mode-hook)) | 434 | (run-hooks 'eshell-first-time-mode-hook)) |
| @@ -451,10 +453,10 @@ and the hook `eshell-exit-hook'." | |||
| 451 | (if eshell-send-direct-to-subprocesses | 453 | (if eshell-send-direct-to-subprocesses |
| 452 | (progn | 454 | (progn |
| 453 | (setq eshell-send-direct-to-subprocesses nil) | 455 | (setq eshell-send-direct-to-subprocesses nil) |
| 454 | (remove-hook 'pre-command-hook 'eshell-intercept-commands t) | 456 | (remove-hook 'pre-command-hook #'eshell-intercept-commands t) |
| 455 | (message "Sending subprocess input on RET")) | 457 | (message "Sending subprocess input on RET")) |
| 456 | (setq eshell-send-direct-to-subprocesses t) | 458 | (setq eshell-send-direct-to-subprocesses t) |
| 457 | (add-hook 'pre-command-hook 'eshell-intercept-commands t t) | 459 | (add-hook 'pre-command-hook #'eshell-intercept-commands t t) |
| 458 | (message "Sending subprocess input directly"))) | 460 | (message "Sending subprocess input directly"))) |
| 459 | 461 | ||
| 460 | (defun eshell-self-insert-command () | 462 | (defun eshell-self-insert-command () |
| @@ -543,7 +545,7 @@ and the hook `eshell-exit-hook'." | |||
| 543 | "Push a mark at the end of the last input text." | 545 | "Push a mark at the end of the last input text." |
| 544 | (push-mark (1- eshell-last-input-end) t)) | 546 | (push-mark (1- eshell-last-input-end) t)) |
| 545 | 547 | ||
| 546 | (custom-add-option 'eshell-pre-command-hook 'eshell-push-command-mark) | 548 | (custom-add-option 'eshell-pre-command-hook #'eshell-push-command-mark) |
| 547 | 549 | ||
| 548 | (defsubst eshell-goto-input-start () | 550 | (defsubst eshell-goto-input-start () |
| 549 | "Goto the start of the last command input. | 551 | "Goto the start of the last command input. |
| @@ -551,7 +553,7 @@ Putting this function on `eshell-pre-command-hook' will mimic Plan 9's | |||
| 551 | 9term behavior." | 553 | 9term behavior." |
| 552 | (goto-char eshell-last-input-start)) | 554 | (goto-char eshell-last-input-start)) |
| 553 | 555 | ||
| 554 | (custom-add-option 'eshell-pre-command-hook 'eshell-push-command-mark) | 556 | (custom-add-option 'eshell-pre-command-hook #'eshell-goto-input-start) |
| 555 | 557 | ||
| 556 | (defsubst eshell-interactive-print (string) | 558 | (defsubst eshell-interactive-print (string) |
| 557 | "Print STRING to the eshell display buffer." | 559 | "Print STRING to the eshell display buffer." |
| @@ -1021,4 +1023,5 @@ This function could be in the list `eshell-output-filter-functions'." | |||
| 1021 | (custom-add-option 'eshell-output-filter-functions | 1023 | (custom-add-option 'eshell-output-filter-functions |
| 1022 | 'eshell-handle-ansi-color) | 1024 | 'eshell-handle-ansi-color) |
| 1023 | 1025 | ||
| 1026 | (provide 'esh-mode) | ||
| 1024 | ;;; esh-mode.el ends here | 1027 | ;;; esh-mode.el ends here |
diff --git a/lisp/eshell/esh-module.el b/lisp/eshell/esh-module.el index 2583044a446..1911a49a3a4 100644 --- a/lisp/eshell/esh-module.el +++ b/lisp/eshell/esh-module.el | |||
| @@ -22,9 +22,6 @@ | |||
| 22 | 22 | ||
| 23 | ;;; Code: | 23 | ;;; Code: |
| 24 | 24 | ||
| 25 | (provide 'esh-module) | ||
| 26 | |||
| 27 | (require 'eshell) | ||
| 28 | (require 'esh-util) | 25 | (require 'esh-util) |
| 29 | 26 | ||
| 30 | (defgroup eshell-module nil | 27 | (defgroup eshell-module nil |
| @@ -101,4 +98,5 @@ customization group. Example: `eshell-cmpl' for that module." | |||
| 101 | (unload-feature module) | 98 | (unload-feature module) |
| 102 | (message "Unloading %s...done" (symbol-name module)))))) | 99 | (message "Unloading %s...done" (symbol-name module)))))) |
| 103 | 100 | ||
| 101 | (provide 'esh-module) | ||
| 104 | ;;; esh-module.el ends here | 102 | ;;; esh-module.el ends here |
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index a023a3c5d2e..3ea5873cafd 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el | |||
| @@ -23,9 +23,6 @@ | |||
| 23 | 23 | ||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (provide 'esh-opt) | ||
| 27 | |||
| 28 | (require 'esh-ext) | ||
| 29 | 26 | ||
| 30 | ;; Unused. | 27 | ;; Unused. |
| 31 | ;; (defgroup eshell-opt nil | 28 | ;; (defgroup eshell-opt nil |
| @@ -36,6 +33,10 @@ | |||
| 36 | 33 | ||
| 37 | ;;; User Functions: | 34 | ;;; User Functions: |
| 38 | 35 | ||
| 36 | ;; Macro expansion of eshell-eval-using-options refers to eshell-stringify-list | ||
| 37 | ;; defined in esh-util. | ||
| 38 | (require 'esh-util) | ||
| 39 | |||
| 39 | (defmacro eshell-eval-using-options (name macro-args options &rest body-forms) | 40 | (defmacro eshell-eval-using-options (name macro-args options &rest body-forms) |
| 40 | "Process NAME's MACRO-ARGS using a set of command line OPTIONS. | 41 | "Process NAME's MACRO-ARGS using a set of command line OPTIONS. |
| 41 | After doing so, stores settings in local symbols as declared by OPTIONS; | 42 | After doing so, stores settings in local symbols as declared by OPTIONS; |
| @@ -127,6 +128,8 @@ let-bound variable `args'." | |||
| 127 | (defun eshell--do-opts (name options args) | 128 | (defun eshell--do-opts (name options args) |
| 128 | "Helper function for `eshell-eval-using-options'. | 129 | "Helper function for `eshell-eval-using-options'. |
| 129 | This code doesn't really need to be macro expanded everywhere." | 130 | This code doesn't really need to be macro expanded everywhere." |
| 131 | (require 'esh-ext) | ||
| 132 | (declare-function eshell-external-command "esh-ext" (command args)) | ||
| 130 | (let ((ext-command | 133 | (let ((ext-command |
| 131 | (catch 'eshell-ext-command | 134 | (catch 'eshell-ext-command |
| 132 | (let ((usage-msg | 135 | (let ((usage-msg |
| @@ -145,6 +148,8 @@ This code doesn't really need to be macro expanded everywhere." | |||
| 145 | 148 | ||
| 146 | (defun eshell-show-usage (name options) | 149 | (defun eshell-show-usage (name options) |
| 147 | "Display the usage message for NAME, using OPTIONS." | 150 | "Display the usage message for NAME, using OPTIONS." |
| 151 | (require 'esh-ext) | ||
| 152 | (declare-function eshell-search-path "esh-ext" (name)) | ||
| 148 | (let ((usage (format "usage: %s %s\n\n" name | 153 | (let ((usage (format "usage: %s %s\n\n" name |
| 149 | (cadr (memq ':usage options)))) | 154 | (cadr (memq ':usage options)))) |
| 150 | (extcmd (memq ':external options)) | 155 | (extcmd (memq ':external options)) |
| @@ -273,4 +278,5 @@ switch is unrecognized." | |||
| 273 | (setq index (1+ index)))))))) | 278 | (setq index (1+ index)))))))) |
| 274 | (nconc (mapcar #'cdr opt-vals) eshell--args))) | 279 | (nconc (mapcar #'cdr opt-vals) eshell--args))) |
| 275 | 280 | ||
| 281 | (provide 'esh-opt) | ||
| 276 | ;;; esh-opt.el ends here | 282 | ;;; esh-opt.el ends here |
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 3432582cf4b..d538ae32b37 100644 --- a/lisp/eshell/esh-proc.el +++ b/lisp/eshell/esh-proc.el | |||
| @@ -23,9 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (provide 'esh-proc) | 26 | (require 'esh-io) |
| 27 | |||
| 28 | (require 'esh-cmd) | ||
| 29 | 27 | ||
| 30 | (defgroup eshell-proc nil | 28 | (defgroup eshell-proc nil |
| 31 | "When Eshell invokes external commands, it always does so | 29 | "When Eshell invokes external commands, it always does so |
| @@ -118,14 +116,17 @@ information, for example." | |||
| 118 | Runs `eshell-reset-after-proc' and `eshell-kill-hook', passing arguments | 116 | Runs `eshell-reset-after-proc' and `eshell-kill-hook', passing arguments |
| 119 | PROC and STATUS to functions on the latter." | 117 | PROC and STATUS to functions on the latter." |
| 120 | ;; Was there till 24.1, but it is not optional. | 118 | ;; Was there till 24.1, but it is not optional. |
| 121 | (if (memq 'eshell-reset-after-proc eshell-kill-hook) | 119 | (if (memq #'eshell-reset-after-proc eshell-kill-hook) |
| 122 | (setq eshell-kill-hook (delq 'eshell-reset-after-proc eshell-kill-hook))) | 120 | (setq eshell-kill-hook (delq #'eshell-reset-after-proc eshell-kill-hook))) |
| 123 | (eshell-reset-after-proc status) | 121 | (eshell-reset-after-proc status) |
| 124 | (run-hook-with-args 'eshell-kill-hook proc status)) | 122 | (run-hook-with-args 'eshell-kill-hook proc status)) |
| 125 | 123 | ||
| 126 | (defun eshell-proc-initialize () | 124 | (defun eshell-proc-initialize () ;Called from `eshell-mode' via intern-soft! |
| 127 | "Initialize the process handling code." | 125 | "Initialize the process handling code." |
| 128 | (make-local-variable 'eshell-process-list) | 126 | (make-local-variable 'eshell-process-list) |
| 127 | ;; This is supposedly run after enabling esh-mode, when eshell-command-map | ||
| 128 | ;; already exists. | ||
| 129 | (defvar eshell-command-map) | ||
| 129 | (define-key eshell-command-map [(meta ?i)] 'eshell-insert-process) | 130 | (define-key eshell-command-map [(meta ?i)] 'eshell-insert-process) |
| 130 | (define-key eshell-command-map [(control ?c)] 'eshell-interrupt-process) | 131 | (define-key eshell-command-map [(control ?c)] 'eshell-interrupt-process) |
| 131 | (define-key eshell-command-map [(control ?k)] 'eshell-kill-process) | 132 | (define-key eshell-command-map [(control ?k)] 'eshell-kill-process) |
| @@ -139,9 +140,11 @@ PROC and STATUS to functions on the latter." | |||
| 139 | "Reset the command input location after a process terminates. | 140 | "Reset the command input location after a process terminates. |
| 140 | The signals which will cause this to happen are matched by | 141 | The signals which will cause this to happen are matched by |
| 141 | `eshell-reset-signals'." | 142 | `eshell-reset-signals'." |
| 142 | (if (and (stringp status) | 143 | (when (and (stringp status) |
| 143 | (string-match eshell-reset-signals status)) | 144 | (string-match eshell-reset-signals status)) |
| 144 | (eshell-reset))) | 145 | (require 'esh-mode) |
| 146 | (declare-function eshell-reset "esh-mode" (&optional no-hooks)) | ||
| 147 | (eshell-reset))) | ||
| 145 | 148 | ||
| 146 | (defun eshell-wait-for-process (&rest procs) | 149 | (defun eshell-wait-for-process (&rest procs) |
| 147 | "Wait until PROC has successfully completed." | 150 | "Wait until PROC has successfully completed." |
| @@ -209,7 +212,8 @@ The prompt will be set to PROMPT." | |||
| 209 | (function | 212 | (function |
| 210 | (lambda (proc) | 213 | (lambda (proc) |
| 211 | (cons (process-name proc) t))) | 214 | (cons (process-name proc) t))) |
| 212 | (process-list)) nil t)) | 215 | (process-list)) |
| 216 | nil t)) | ||
| 213 | 217 | ||
| 214 | (defun eshell-insert-process (process) | 218 | (defun eshell-insert-process (process) |
| 215 | "Insert the name of PROCESS into the current buffer at point." | 219 | "Insert the name of PROCESS into the current buffer at point." |
| @@ -220,10 +224,12 @@ The prompt will be set to PROMPT." | |||
| 220 | 224 | ||
| 221 | (defsubst eshell-record-process-object (object) | 225 | (defsubst eshell-record-process-object (object) |
| 222 | "Record OBJECT as now running." | 226 | "Record OBJECT as now running." |
| 223 | (if (and (eshell-processp object) | 227 | (when (and (eshell-processp object) |
| 224 | eshell-current-subjob-p) | 228 | eshell-current-subjob-p) |
| 225 | (eshell-interactive-print | 229 | (require 'esh-mode) |
| 226 | (format "[%s] %d\n" (process-name object) (process-id object)))) | 230 | (declare-function eshell-interactive-print "esh-mode" (string)) |
| 231 | (eshell-interactive-print | ||
| 232 | (format "[%s] %d\n" (process-name object) (process-id object)))) | ||
| 227 | (setq eshell-process-list | 233 | (setq eshell-process-list |
| 228 | (cons (list object eshell-current-handles | 234 | (cons (list object eshell-current-handles |
| 229 | eshell-current-subjob-p nil nil) | 235 | eshell-current-subjob-p nil nil) |
| @@ -254,7 +260,7 @@ the full name of a command, otherwise just the nondirectory part must match.") | |||
| 254 | (defun eshell-needs-pipe-p (command) | 260 | (defun eshell-needs-pipe-p (command) |
| 255 | "Return non-nil if COMMAND needs `process-connection-type' to be nil. | 261 | "Return non-nil if COMMAND needs `process-connection-type' to be nil. |
| 256 | See `eshell-needs-pipe'." | 262 | See `eshell-needs-pipe'." |
| 257 | (and eshell-in-pipeline-p | 263 | (and (bound-and-true-p eshell-in-pipeline-p) |
| 258 | (not (eq eshell-in-pipeline-p 'first)) | 264 | (not (eq eshell-in-pipeline-p 'first)) |
| 259 | ;; FIXME should this return non-nil for anything that is | 265 | ;; FIXME should this return non-nil for anything that is |
| 260 | ;; neither 'first nor 'last? See bug#1388 discussion. | 266 | ;; neither 'first nor 'last? See bug#1388 discussion. |
| @@ -267,6 +273,8 @@ See `eshell-needs-pipe'." | |||
| 267 | 273 | ||
| 268 | (defun eshell-gather-process-output (command args) | 274 | (defun eshell-gather-process-output (command args) |
| 269 | "Gather the output from COMMAND + ARGS." | 275 | "Gather the output from COMMAND + ARGS." |
| 276 | (require 'esh-var) | ||
| 277 | (declare-function eshell-environment-variables "esh-var" ()) | ||
| 270 | (unless (and (file-executable-p command) | 278 | (unless (and (file-executable-p command) |
| 271 | (file-regular-p (file-truename command))) | 279 | (file-regular-p (file-truename command))) |
| 272 | (error "%s: not an executable file" command)) | 280 | (error "%s: not an executable file" command)) |
| @@ -283,14 +291,14 @@ See `eshell-needs-pipe'." | |||
| 283 | (unless (eshell-needs-pipe-p command) | 291 | (unless (eshell-needs-pipe-p command) |
| 284 | process-connection-type)) | 292 | process-connection-type)) |
| 285 | (command (file-local-name (expand-file-name command)))) | 293 | (command (file-local-name (expand-file-name command)))) |
| 286 | (apply 'start-file-process | 294 | (apply #'start-file-process |
| 287 | (file-name-nondirectory command) nil command args))) | 295 | (file-name-nondirectory command) nil command args))) |
| 288 | (eshell-record-process-object proc) | 296 | (eshell-record-process-object proc) |
| 289 | (set-process-buffer proc (current-buffer)) | 297 | (set-process-buffer proc (current-buffer)) |
| 290 | (if (eshell-interactive-output-p) | 298 | (set-process-filter proc (if (eshell-interactive-output-p) |
| 291 | (set-process-filter proc 'eshell-output-filter) | 299 | #'eshell-output-filter |
| 292 | (set-process-filter proc 'eshell-insertion-filter)) | 300 | #'eshell-insertion-filter)) |
| 293 | (set-process-sentinel proc 'eshell-sentinel) | 301 | (set-process-sentinel proc #'eshell-sentinel) |
| 294 | (run-hook-with-args 'eshell-exec-hook proc) | 302 | (run-hook-with-args 'eshell-exec-hook proc) |
| 295 | (when (fboundp 'process-coding-system) | 303 | (when (fboundp 'process-coding-system) |
| 296 | (let ((coding-systems (process-coding-system proc))) | 304 | (let ((coding-systems (process-coding-system proc))) |
| @@ -325,14 +333,14 @@ See `eshell-needs-pipe'." | |||
| 325 | (set-buffer oldbuf) | 333 | (set-buffer oldbuf) |
| 326 | (run-hook-with-args 'eshell-exec-hook command) | 334 | (run-hook-with-args 'eshell-exec-hook command) |
| 327 | (setq exit-status | 335 | (setq exit-status |
| 328 | (apply 'call-process-region | 336 | (apply #'call-process-region |
| 329 | (append (list eshell-last-sync-output-start (point) | 337 | (append (list eshell-last-sync-output-start (point) |
| 330 | command t | 338 | command t |
| 331 | eshell-scratch-buffer nil) | 339 | eshell-scratch-buffer nil) |
| 332 | args))) | 340 | args))) |
| 333 | ;; When in a pipeline, record the place where the output of | 341 | ;; When in a pipeline, record the place where the output of |
| 334 | ;; this process will begin. | 342 | ;; this process will begin. |
| 335 | (and eshell-in-pipeline-p | 343 | (and (bound-and-true-p eshell-in-pipeline-p) |
| 336 | (set-marker eshell-last-sync-output-start (point))) | 344 | (set-marker eshell-last-sync-output-start (point))) |
| 337 | ;; Simulate the effect of the process filter. | 345 | ;; Simulate the effect of the process filter. |
| 338 | (when (numberp exit-status) | 346 | (when (numberp exit-status) |
| @@ -349,11 +357,14 @@ See `eshell-needs-pipe'." | |||
| 349 | (setq lbeg lend) | 357 | (setq lbeg lend) |
| 350 | (set-buffer proc-buf)) | 358 | (set-buffer proc-buf)) |
| 351 | (set-buffer oldbuf)) | 359 | (set-buffer oldbuf)) |
| 360 | (require 'esh-mode) | ||
| 361 | (declare-function eshell-update-markers "esh-mode" (pmark)) | ||
| 362 | (defvar eshell-last-output-end) ;Defined in esh-mode.el. | ||
| 352 | (eshell-update-markers eshell-last-output-end) | 363 | (eshell-update-markers eshell-last-output-end) |
| 353 | ;; Simulate the effect of eshell-sentinel. | 364 | ;; Simulate the effect of eshell-sentinel. |
| 354 | (eshell-close-handles (if (numberp exit-status) exit-status -1)) | 365 | (eshell-close-handles (if (numberp exit-status) exit-status -1)) |
| 355 | (eshell-kill-process-function command exit-status) | 366 | (eshell-kill-process-function command exit-status) |
| 356 | (or eshell-in-pipeline-p | 367 | (or (bound-and-true-p eshell-in-pipeline-p) |
| 357 | (setq eshell-last-sync-output-start nil)) | 368 | (setq eshell-last-sync-output-start nil)) |
| 358 | (if (not (numberp exit-status)) | 369 | (if (not (numberp exit-status)) |
| 359 | (error "%s: external command failed: %s" command exit-status)) | 370 | (error "%s: external command failed: %s" command exit-status)) |
| @@ -540,7 +551,11 @@ See the variable `eshell-kill-processes-on-exit'." | |||
| 540 | (defun eshell-send-eof-to-process () | 551 | (defun eshell-send-eof-to-process () |
| 541 | "Send EOF to process." | 552 | "Send EOF to process." |
| 542 | (interactive) | 553 | (interactive) |
| 554 | (require 'esh-mode) | ||
| 555 | (declare-function eshell-send-input "esh-mode" | ||
| 556 | (&optional use-region queue-p no-newline)) | ||
| 543 | (eshell-send-input nil nil t) | 557 | (eshell-send-input nil nil t) |
| 544 | (eshell-process-interact 'process-send-eof)) | 558 | (eshell-process-interact 'process-send-eof)) |
| 545 | 559 | ||
| 560 | (provide 'esh-proc) | ||
| 546 | ;;; esh-proc.el ends here | 561 | ;;; esh-proc.el ends here |
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el index 118978e77d0..6f355c70a42 100644 --- a/lisp/eshell/esh-util.el +++ b/lisp/eshell/esh-util.el | |||
| @@ -478,24 +478,22 @@ list." | |||
| 478 | (insert-file-contents (or filename eshell-hosts-file)) | 478 | (insert-file-contents (or filename eshell-hosts-file)) |
| 479 | (goto-char (point-min)) | 479 | (goto-char (point-min)) |
| 480 | (while (re-search-forward | 480 | (while (re-search-forward |
| 481 | "^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t) | 481 | ;; "^ \t\\([^# \t\n]+\\)[ \t]+\\([^ \t\n]+\\)\\([ \t]*\\([^ \t\n]+\\)\\)?" |
| 482 | (if (match-string 1) | 482 | "^[ \t]*\\([^# \t\n]+\\)[ \t]+\\([^ \t\n].+\\)" nil t) |
| 483 | (cl-pushnew (match-string 1) hosts :test #'equal)) | 483 | (push (cons (match-string 1) |
| 484 | (if (match-string 2) | 484 | (split-string (match-string 2))) |
| 485 | (cl-pushnew (match-string 2) hosts :test #'equal)) | 485 | hosts))) |
| 486 | (if (match-string 4) | 486 | (nreverse hosts))) |
| 487 | (cl-pushnew (match-string 4) hosts :test #'equal)))) | ||
| 488 | (sort hosts #'string-lessp))) | ||
| 489 | 487 | ||
| 490 | (defun eshell-read-hosts (file result-var timestamp-var) | 488 | (defun eshell-read-hosts (file result-var timestamp-var) |
| 491 | "Read the contents of /etc/passwd for user names." | 489 | "Read the contents of /etc/hosts for host names." |
| 492 | (if (or (not (symbol-value result-var)) | 490 | (if (or (not (symbol-value result-var)) |
| 493 | (not (symbol-value timestamp-var)) | 491 | (not (symbol-value timestamp-var)) |
| 494 | (time-less-p | 492 | (time-less-p |
| 495 | (symbol-value timestamp-var) | 493 | (symbol-value timestamp-var) |
| 496 | (file-attribute-modification-time (file-attributes file)))) | 494 | (file-attribute-modification-time (file-attributes file)))) |
| 497 | (progn | 495 | (progn |
| 498 | (set result-var (eshell-read-hosts-file file)) | 496 | (set result-var (apply #'nconc (eshell-read-hosts-file file))) |
| 499 | (set timestamp-var (current-time)))) | 497 | (set timestamp-var (current-time)))) |
| 500 | (symbol-value result-var)) | 498 | (symbol-value result-var)) |
| 501 | 499 | ||
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index d8be72e3596..b08a5d242fe 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el | |||
| @@ -105,11 +105,12 @@ | |||
| 105 | 105 | ||
| 106 | ;;; Code: | 106 | ;;; Code: |
| 107 | 107 | ||
| 108 | (provide 'esh-var) | ||
| 109 | |||
| 110 | (require 'esh-util) | 108 | (require 'esh-util) |
| 111 | (require 'esh-cmd) | 109 | (require 'esh-cmd) |
| 112 | (require 'esh-opt) | 110 | (require 'esh-opt) |
| 111 | (require 'esh-module) | ||
| 112 | (require 'esh-arg) | ||
| 113 | (require 'esh-io) | ||
| 113 | 114 | ||
| 114 | (require 'pcomplete) | 115 | (require 'pcomplete) |
| 115 | (require 'env) | 116 | (require 'env) |
| @@ -198,7 +199,7 @@ function), and the arguments passed to this function would be the list | |||
| 198 | 199 | ||
| 199 | ;;; Functions: | 200 | ;;; Functions: |
| 200 | 201 | ||
| 201 | (defun eshell-var-initialize () | 202 | (defun eshell-var-initialize () ;Called from `eshell-mode' via intern-soft! |
| 202 | "Initialize the variable handle code." | 203 | "Initialize the variable handle code." |
| 203 | ;; Break the association with our parent's environment. Otherwise, | 204 | ;; Break the association with our parent's environment. Otherwise, |
| 204 | ;; changing a variable will affect all of Emacs. | 205 | ;; changing a variable will affect all of Emacs. |
| @@ -206,6 +207,9 @@ function), and the arguments passed to this function would be the list | |||
| 206 | (set (make-local-variable 'process-environment) | 207 | (set (make-local-variable 'process-environment) |
| 207 | (eshell-copy-environment))) | 208 | (eshell-copy-environment))) |
| 208 | 209 | ||
| 210 | ;; This is supposedly run after enabling esh-mode, when eshell-command-map | ||
| 211 | ;; already exists. | ||
| 212 | (defvar eshell-command-map) | ||
| 209 | (define-key eshell-command-map [(meta ?v)] 'eshell-insert-envvar) | 213 | (define-key eshell-command-map [(meta ?v)] 'eshell-insert-envvar) |
| 210 | 214 | ||
| 211 | (set (make-local-variable 'eshell-special-chars-inside-quoting) | 215 | (set (make-local-variable 'eshell-special-chars-inside-quoting) |
| @@ -213,16 +217,16 @@ function), and the arguments passed to this function would be the list | |||
| 213 | (set (make-local-variable 'eshell-special-chars-outside-quoting) | 217 | (set (make-local-variable 'eshell-special-chars-outside-quoting) |
| 214 | (append eshell-special-chars-outside-quoting '(?$))) | 218 | (append eshell-special-chars-outside-quoting '(?$))) |
| 215 | 219 | ||
| 216 | (add-hook 'eshell-parse-argument-hook 'eshell-interpolate-variable t t) | 220 | (add-hook 'eshell-parse-argument-hook #'eshell-interpolate-variable t t) |
| 217 | 221 | ||
| 218 | (add-hook 'eshell-prepare-command-hook | 222 | (add-hook 'eshell-prepare-command-hook |
| 219 | 'eshell-handle-local-variables nil t) | 223 | #'eshell-handle-local-variables nil t) |
| 220 | 224 | ||
| 221 | (when (eshell-using-module 'eshell-cmpl) | 225 | (when (eshell-using-module 'eshell-cmpl) |
| 222 | (add-hook 'pcomplete-try-first-hook | 226 | (add-hook 'pcomplete-try-first-hook |
| 223 | 'eshell-complete-variable-reference nil t) | 227 | #'eshell-complete-variable-reference nil t) |
| 224 | (add-hook 'pcomplete-try-first-hook | 228 | (add-hook 'pcomplete-try-first-hook |
| 225 | 'eshell-complete-variable-assignment nil t))) | 229 | #'eshell-complete-variable-assignment nil t))) |
| 226 | 230 | ||
| 227 | (defun eshell-handle-local-variables () | 231 | (defun eshell-handle-local-variables () |
| 228 | "Allow for the syntax `VAR=val <command> <args>'." | 232 | "Allow for the syntax `VAR=val <command> <args>'." |
| @@ -532,7 +536,7 @@ For example, to retrieve the second element of a user's record in | |||
| 532 | (setq separator (caar indices) | 536 | (setq separator (caar indices) |
| 533 | refs (cdr refs))) | 537 | refs (cdr refs))) |
| 534 | (setq value | 538 | (setq value |
| 535 | (mapcar 'eshell-convert | 539 | (mapcar #'eshell-convert |
| 536 | (split-string value separator))))) | 540 | (split-string value separator))))) |
| 537 | (cond | 541 | (cond |
| 538 | ((< (length refs) 0) | 542 | ((< (length refs) 0) |
| @@ -618,4 +622,5 @@ For example, to retrieve the second element of a user's record in | |||
| 618 | (setq pcomplete-stub (substring arg pos)) | 622 | (setq pcomplete-stub (substring arg pos)) |
| 619 | (throw 'pcomplete-completions (pcomplete-entries))))) | 623 | (throw 'pcomplete-completions (pcomplete-entries))))) |
| 620 | 624 | ||
| 625 | (provide 'esh-var) | ||
| 621 | ;;; esh-var.el ends here | 626 | ;;; esh-var.el ends here |
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 45168007565..db20f7d9ec5 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el | |||
| @@ -175,7 +175,10 @@ | |||
| 175 | (eval-when-compile | 175 | (eval-when-compile |
| 176 | (require 'cl-lib)) | 176 | (require 'cl-lib)) |
| 177 | (require 'esh-util) | 177 | (require 'esh-util) |
| 178 | (require 'esh-mode) | 178 | (require 'esh-module) ;For eshell-using-module |
| 179 | (require 'esh-proc) ;For eshell-wait-for-process | ||
| 180 | (require 'esh-io) ;For eshell-last-command-status | ||
| 181 | (require 'esh-cmd) | ||
| 179 | 182 | ||
| 180 | (defgroup eshell nil | 183 | (defgroup eshell nil |
| 181 | "Command shell implemented entirely in Emacs Lisp. | 184 | "Command shell implemented entirely in Emacs Lisp. |
| @@ -217,12 +220,6 @@ shells such as bash, zsh, rc, 4dos." | |||
| 217 | :type 'string | 220 | :type 'string |
| 218 | :group 'eshell) | 221 | :group 'eshell) |
| 219 | 222 | ||
| 220 | (defcustom eshell-directory-name | ||
| 221 | (locate-user-emacs-file "eshell/" ".eshell/") | ||
| 222 | "The directory where Eshell control files should be kept." | ||
| 223 | :type 'directory | ||
| 224 | :group 'eshell) | ||
| 225 | |||
| 226 | ;;;_* Running Eshell | 223 | ;;;_* Running Eshell |
| 227 | ;; | 224 | ;; |
| 228 | ;; There are only three commands used to invoke Eshell. The first two | 225 | ;; There are only three commands used to invoke Eshell. The first two |
| @@ -256,11 +253,12 @@ buffer selected (or created)." | |||
| 256 | buf)) | 253 | buf)) |
| 257 | 254 | ||
| 258 | (defun eshell-return-exits-minibuffer () | 255 | (defun eshell-return-exits-minibuffer () |
| 256 | ;; This is supposedly run after enabling esh-mode, when eshell-mode-map | ||
| 257 | ;; already exists. | ||
| 258 | (defvar eshell-mode-map) | ||
| 259 | (define-key eshell-mode-map [(control ?g)] 'abort-recursive-edit) | 259 | (define-key eshell-mode-map [(control ?g)] 'abort-recursive-edit) |
| 260 | (define-key eshell-mode-map [return] 'exit-minibuffer) | ||
| 261 | (define-key eshell-mode-map [(control ?m)] 'exit-minibuffer) | 260 | (define-key eshell-mode-map [(control ?m)] 'exit-minibuffer) |
| 262 | (define-key eshell-mode-map [(control ?j)] 'exit-minibuffer) | 261 | (define-key eshell-mode-map [(control ?j)] 'exit-minibuffer) |
| 263 | (define-key eshell-mode-map [(meta return)] 'exit-minibuffer) | ||
| 264 | (define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer)) | 262 | (define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer)) |
| 265 | 263 | ||
| 266 | (defvar eshell-non-interactive-p nil | 264 | (defvar eshell-non-interactive-p nil |
| @@ -275,7 +273,6 @@ non-interactive sessions, such as when using `eshell-command'.") | |||
| 275 | "Execute the Eshell command string COMMAND. | 273 | "Execute the Eshell command string COMMAND. |
| 276 | With prefix ARG, insert output into the current buffer at point." | 274 | With prefix ARG, insert output into the current buffer at point." |
| 277 | (interactive) | 275 | (interactive) |
| 278 | (require 'esh-cmd) | ||
| 279 | (unless arg | 276 | (unless arg |
| 280 | (setq arg current-prefix-arg)) | 277 | (setq arg current-prefix-arg)) |
| 281 | (let ((eshell-non-interactive-p t)) | 278 | (let ((eshell-non-interactive-p t)) |
| @@ -363,7 +360,8 @@ corresponding to a successful execution." | |||
| 363 | (let ((result (eshell-do-eval | 360 | (let ((result (eshell-do-eval |
| 364 | (list 'eshell-commands | 361 | (list 'eshell-commands |
| 365 | (list 'eshell-command-to-value | 362 | (list 'eshell-command-to-value |
| 366 | (eshell-parse-command command))) t))) | 363 | (eshell-parse-command command))) |
| 364 | t))) | ||
| 367 | (cl-assert (eq (car result) 'quote)) | 365 | (cl-assert (eq (car result) 'quote)) |
| 368 | (if (and status-var (symbolp status-var)) | 366 | (if (and status-var (symbolp status-var)) |
| 369 | (set status-var eshell-last-command-status)) | 367 | (set status-var eshell-last-command-status)) |
| @@ -404,5 +402,4 @@ Emacs." | |||
| 404 | (run-hooks 'eshell-load-hook) | 402 | (run-hooks 'eshell-load-hook) |
| 405 | 403 | ||
| 406 | (provide 'eshell) | 404 | (provide 'eshell) |
| 407 | |||
| 408 | ;;; eshell.el ends here | 405 | ;;; eshell.el ends here |