diff options
| author | Stefan Monnier | 2019-04-08 14:28:34 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2019-04-08 14:28:34 -0400 |
| commit | 0d5e83611e5157800fd855fe8e3f60c8eff0af7c (patch) | |
| tree | 647b4c911934746d9cbd866f64a1e8f7579f6e30 /lisp | |
| parent | a20845c160de2ba9f42b3af714d770df502d0577 (diff) | |
| download | emacs-0d5e83611e5157800fd855fe8e3f60c8eff0af7c.tar.gz emacs-0d5e83611e5157800fd855fe8e3f60c8eff0af7c.zip | |
Eshell: Try to untangle the dependencies; move 'provide's to the end
* lisp/eshell/esh-arg.el: Move defsubst and vars before first use.
Don't require `esh-mode but esh-util instead.
* lisp/eshell/esh-cmd.el: Require esh-module and esh-io.
* lisp/eshell/esh-ext.el: Don't require esh-proc nor esh-cmd.
(eshell-external-command): Require esh-proc for
eshell-gather-process-output.
* lisp/eshell/esh-mode.el: Don't require esh-io nor esh-var, but
require esh-arg.
(eshell-directory-name): Move from eshell.el.
* lisp/eshell/esh-module.el: Don't require eshell.
* lisp/eshell/esh-opt.el: Don't require esh-ext at top-level.
(eshell--do-opts, eshell-show-usage): Require it here instead.
* lisp/eshell/esh-proc.el: Don't require esh-cmd, but require esh-io.
(eshell-reset-after-proc, eshell-record-process-object)
(eshell-gather-process-output, eshell-send-eof-to-process):
Require esh-mode and esh-var here.
* lisp/eshell/esh-var.el: Require esh-module, esh-arg, and esh-io.
* lisp/eshell/eshell.el: Require esh-module, esh-proc, esh-io, and esh-cmd.
But don't require esh-mode.
(eshell-directory-name): Move to esh-mode.
(eshell-return-exits-minibuffer): Don't bind 'return' and 'M-return'
since we already bind RET and M-RET.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/eshell/em-hist.el | 20 | ||||
| -rw-r--r-- | lisp/eshell/em-term.el | 2 | ||||
| -rw-r--r-- | lisp/eshell/esh-arg.el | 94 | ||||
| -rw-r--r-- | lisp/eshell/esh-cmd.el | 4 | ||||
| -rw-r--r-- | lisp/eshell/esh-ext.el | 18 | ||||
| -rw-r--r-- | lisp/eshell/esh-io.el | 3 | ||||
| -rw-r--r-- | lisp/eshell/esh-mode.el | 33 | ||||
| -rw-r--r-- | lisp/eshell/esh-module.el | 4 | ||||
| -rw-r--r-- | lisp/eshell/esh-opt.el | 8 | ||||
| -rw-r--r-- | lisp/eshell/esh-proc.el | 59 | ||||
| -rw-r--r-- | lisp/eshell/esh-var.el | 19 | ||||
| -rw-r--r-- | lisp/eshell/eshell.el | 24 |
12 files changed, 154 insertions, 134 deletions
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 05579eed32a..bc0da96c588 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) |
| @@ -220,7 +220,7 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil." | |||
| 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-term.el b/lisp/eshell/em-term.el index 8af783eaf80..9a9f23cddd9 100644 --- a/lisp/eshell/em-term.el +++ b/lisp/eshell/em-term.el | |||
| @@ -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/esh-arg.el b/lisp/eshell/esh-arg.el index 360202b6539..3ba4c935a72 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 () |
| 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..7b05cfbc341 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 |
| @@ -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..ae8bf846249 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 |
| @@ -179,7 +174,7 @@ external version." | |||
| 179 | 174 | ||
| 180 | (defun eshell-ext-initialize () | 175 | (defun eshell-ext-initialize () |
| 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..1a6c71eda03 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 | ||
| @@ -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 0a160b9ab37..1f86dacd96c 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) |
| @@ -414,19 +416,19 @@ and the hook `eshell-exit-hook'." | |||
| 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-goto-input-start) | 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..5b2693283a7 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 |
| @@ -127,6 +124,8 @@ let-bound variable `args'." | |||
| 127 | (defun eshell--do-opts (name options args) | 124 | (defun eshell--do-opts (name options args) |
| 128 | "Helper function for `eshell-eval-using-options'. | 125 | "Helper function for `eshell-eval-using-options'. |
| 129 | This code doesn't really need to be macro expanded everywhere." | 126 | This code doesn't really need to be macro expanded everywhere." |
| 127 | (require 'esh-ext) | ||
| 128 | (declare-function eshell-external-command "esh-ext" (command args)) | ||
| 130 | (let ((ext-command | 129 | (let ((ext-command |
| 131 | (catch 'eshell-ext-command | 130 | (catch 'eshell-ext-command |
| 132 | (let ((usage-msg | 131 | (let ((usage-msg |
| @@ -145,6 +144,8 @@ This code doesn't really need to be macro expanded everywhere." | |||
| 145 | 144 | ||
| 146 | (defun eshell-show-usage (name options) | 145 | (defun eshell-show-usage (name options) |
| 147 | "Display the usage message for NAME, using OPTIONS." | 146 | "Display the usage message for NAME, using OPTIONS." |
| 147 | (require 'esh-ext) | ||
| 148 | (declare-function eshell-search-path "esh-ext" (name)) | ||
| 148 | (let ((usage (format "usage: %s %s\n\n" name | 149 | (let ((usage (format "usage: %s %s\n\n" name |
| 149 | (cadr (memq ':usage options)))) | 150 | (cadr (memq ':usage options)))) |
| 150 | (extcmd (memq ':external options)) | 151 | (extcmd (memq ':external options)) |
| @@ -273,4 +274,5 @@ switch is unrecognized." | |||
| 273 | (setq index (1+ index)))))))) | 274 | (setq index (1+ index)))))))) |
| 274 | (nconc (mapcar #'cdr opt-vals) eshell--args))) | 275 | (nconc (mapcar #'cdr opt-vals) eshell--args))) |
| 275 | 276 | ||
| 277 | (provide 'esh-opt) | ||
| 276 | ;;; esh-opt.el ends here | 278 | ;;; esh-opt.el ends here |
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el index 3432582cf4b..d9a6eef7169 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 () |
| 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-var.el b/lisp/eshell/esh-var.el index d8be72e3596..82e0f7135ba 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) |
| @@ -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 c7ed7103e40..db20f7d9ec5 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el | |||
| @@ -175,10 +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 | ;; Provide eshell before requiring esh-mode, to avoid a recursive load. | 178 | (require 'esh-module) ;For eshell-using-module |
| 179 | ;; (Bug #34954) | 179 | (require 'esh-proc) ;For eshell-wait-for-process |
| 180 | (provide 'eshell) | 180 | (require 'esh-io) ;For eshell-last-command-status |
| 181 | (require 'esh-mode) | 181 | (require 'esh-cmd) |
| 182 | 182 | ||
| 183 | (defgroup eshell nil | 183 | (defgroup eshell nil |
| 184 | "Command shell implemented entirely in Emacs Lisp. | 184 | "Command shell implemented entirely in Emacs Lisp. |
| @@ -220,12 +220,6 @@ shells such as bash, zsh, rc, 4dos." | |||
| 220 | :type 'string | 220 | :type 'string |
| 221 | :group 'eshell) | 221 | :group 'eshell) |
| 222 | 222 | ||
| 223 | (defcustom eshell-directory-name | ||
| 224 | (locate-user-emacs-file "eshell/" ".eshell/") | ||
| 225 | "The directory where Eshell control files should be kept." | ||
| 226 | :type 'directory | ||
| 227 | :group 'eshell) | ||
| 228 | |||
| 229 | ;;;_* Running Eshell | 223 | ;;;_* Running Eshell |
| 230 | ;; | 224 | ;; |
| 231 | ;; 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 |
| @@ -259,11 +253,12 @@ buffer selected (or created)." | |||
| 259 | buf)) | 253 | buf)) |
| 260 | 254 | ||
| 261 | (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) | ||
| 262 | (define-key eshell-mode-map [(control ?g)] 'abort-recursive-edit) | 259 | (define-key eshell-mode-map [(control ?g)] 'abort-recursive-edit) |
| 263 | (define-key eshell-mode-map [return] 'exit-minibuffer) | ||
| 264 | (define-key eshell-mode-map [(control ?m)] 'exit-minibuffer) | 260 | (define-key eshell-mode-map [(control ?m)] 'exit-minibuffer) |
| 265 | (define-key eshell-mode-map [(control ?j)] 'exit-minibuffer) | 261 | (define-key eshell-mode-map [(control ?j)] 'exit-minibuffer) |
| 266 | (define-key eshell-mode-map [(meta return)] 'exit-minibuffer) | ||
| 267 | (define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer)) | 262 | (define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer)) |
| 268 | 263 | ||
| 269 | (defvar eshell-non-interactive-p nil | 264 | (defvar eshell-non-interactive-p nil |
| @@ -278,7 +273,6 @@ non-interactive sessions, such as when using `eshell-command'.") | |||
| 278 | "Execute the Eshell command string COMMAND. | 273 | "Execute the Eshell command string COMMAND. |
| 279 | With prefix ARG, insert output into the current buffer at point." | 274 | With prefix ARG, insert output into the current buffer at point." |
| 280 | (interactive) | 275 | (interactive) |
| 281 | (require 'esh-cmd) | ||
| 282 | (unless arg | 276 | (unless arg |
| 283 | (setq arg current-prefix-arg)) | 277 | (setq arg current-prefix-arg)) |
| 284 | (let ((eshell-non-interactive-p t)) | 278 | (let ((eshell-non-interactive-p t)) |
| @@ -366,7 +360,8 @@ corresponding to a successful execution." | |||
| 366 | (let ((result (eshell-do-eval | 360 | (let ((result (eshell-do-eval |
| 367 | (list 'eshell-commands | 361 | (list 'eshell-commands |
| 368 | (list 'eshell-command-to-value | 362 | (list 'eshell-command-to-value |
| 369 | (eshell-parse-command command))) t))) | 363 | (eshell-parse-command command))) |
| 364 | t))) | ||
| 370 | (cl-assert (eq (car result) 'quote)) | 365 | (cl-assert (eq (car result) 'quote)) |
| 371 | (if (and status-var (symbolp status-var)) | 366 | (if (and status-var (symbolp status-var)) |
| 372 | (set status-var eshell-last-command-status)) | 367 | (set status-var eshell-last-command-status)) |
| @@ -406,4 +401,5 @@ Emacs." | |||
| 406 | 401 | ||
| 407 | (run-hooks 'eshell-load-hook) | 402 | (run-hooks 'eshell-load-hook) |
| 408 | 403 | ||
| 404 | (provide 'eshell) | ||
| 409 | ;;; eshell.el ends here | 405 | ;;; eshell.el ends here |