diff options
Diffstat (limited to 'lisp/eshell/em-script.el')
| -rw-r--r-- | lisp/eshell/em-script.el | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el index 03d9a88e32e..f426afb5d28 100644 --- a/lisp/eshell/em-script.el +++ b/lisp/eshell/em-script.el | |||
| @@ -68,22 +68,24 @@ This includes when running `eshell-command'." | |||
| 68 | 'eshell/source) | 68 | 'eshell/source) |
| 69 | eshell-interpreter-alist)) | 69 | eshell-interpreter-alist)) |
| 70 | (setq-local eshell-complex-commands | 70 | (setq-local eshell-complex-commands |
| 71 | (append '("source" ".") eshell-complex-commands)) | 71 | (append '("source" ".") eshell-complex-commands)) |
| 72 | ;; these two variables are changed through usage, but we don't want | 72 | ;; Run our startup scripts once this Eshell session has finished |
| 73 | ;; to ruin it for other modules | 73 | ;; initialization. |
| 74 | (let (eshell-inside-quote-regexp | 74 | (add-hook 'eshell-after-initialize-hook #'eshell-run-startup-scripts 90 t)) |
| 75 | eshell-outside-quote-regexp) | 75 | |
| 76 | (and (not (bound-and-true-p eshell-non-interactive-p)) | 76 | (defun eshell-run-startup-scripts () |
| 77 | eshell-login-script | 77 | "Run any necessary startup scripts for the current Eshell session." |
| 78 | (file-readable-p eshell-login-script) | 78 | (when (and (not (bound-and-true-p eshell-non-interactive-p)) |
| 79 | (eshell-do-eval | 79 | eshell-login-script |
| 80 | `(eshell-commands ,(eshell--source-file eshell-login-script)) | 80 | (file-readable-p eshell-login-script)) |
| 81 | t)) | 81 | (eshell-do-eval |
| 82 | (and eshell-rc-script | 82 | `(eshell-commands ,(eshell--source-file eshell-login-script)) |
| 83 | (file-readable-p eshell-rc-script) | 83 | t)) |
| 84 | (eshell-do-eval | 84 | (when (and eshell-rc-script |
| 85 | `(eshell-commands ,(eshell--source-file eshell-rc-script)) | 85 | (file-readable-p eshell-rc-script)) |
| 86 | t)))) | 86 | (eshell-do-eval |
| 87 | `(eshell-commands ,(eshell--source-file eshell-rc-script)) | ||
| 88 | t))) | ||
| 87 | 89 | ||
| 88 | (defun eshell--source-file (file &optional args subcommand-p) | 90 | (defun eshell--source-file (file &optional args subcommand-p) |
| 89 | "Return a Lisp form for executing the Eshell commands in FILE, passing ARGS. | 91 | "Return a Lisp form for executing the Eshell commands in FILE, passing ARGS. |