diff options
| author | Jim Porter | 2023-03-10 19:02:26 -0800 |
|---|---|---|
| committer | Jim Porter | 2024-05-29 12:09:05 -0700 |
| commit | 6c2f21e4a6ff65cc1697cb8a6ba0e1ef1a52ae1c (patch) | |
| tree | 45e81f3bd365ef76fcf7f08ae00e5bfab9173af3 /test | |
| parent | 98149ad31ea2cfd5a82f95443affd665c9da667b (diff) | |
| download | emacs-6c2f21e4a6ff65cc1697cb8a6ba0e1ef1a52ae1c.tar.gz emacs-6c2f21e4a6ff65cc1697cb8a6ba0e1ef1a52ae1c.zip | |
Consolidate Eshell module loading/unloading code
This also adds the ability to suppress module loading/unloading
messages, which will be necessary to support running Eshell scripts as
batch scripts.
* lisp/eshell/esh-mode.el (eshell-mode): Move module
loading/initialization to...
* lisp/eshell/esh-module.el (eshell-load-modules)
(eshell-initialize-modules): ... here.
(eshell-module-loading-messages): New option.
(eshell-module--feature-name): Improve docstring.
(eshell-unload-modules): Display a real warning if unable to unload a
module.
* test/lisp/eshell/eshell-tests-helpers.el (with-temp-eshell)
(eshell-command-result-equal):
* test/lisp/eshell/eshell-tests-unload.el (load-eshell): Silence Eshell
loading messages.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/eshell/eshell-tests-helpers.el | 10 | ||||
| -rw-r--r-- | test/lisp/eshell/eshell-tests-unload.el | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/test/lisp/eshell/eshell-tests-helpers.el b/test/lisp/eshell/eshell-tests-helpers.el index 652146fefcc..3f1c55f420d 100644 --- a/test/lisp/eshell/eshell-tests-helpers.el +++ b/test/lisp/eshell/eshell-tests-helpers.el | |||
| @@ -63,6 +63,7 @@ beginning of the test file." | |||
| 63 | (eshell-debug-command (cons 'process eshell-debug-command)) | 63 | (eshell-debug-command (cons 'process eshell-debug-command)) |
| 64 | (eshell-history-file-name nil) | 64 | (eshell-history-file-name nil) |
| 65 | (eshell-last-dir-ring-file-name nil) | 65 | (eshell-last-dir-ring-file-name nil) |
| 66 | (eshell-module-loading-messages nil) | ||
| 66 | (eshell-buffer (eshell t))) | 67 | (eshell-buffer (eshell t))) |
| 67 | (unwind-protect | 68 | (unwind-protect |
| 68 | (with-current-buffer eshell-buffer | 69 | (with-current-buffer eshell-buffer |
| @@ -183,10 +184,11 @@ inserting the command." | |||
| 183 | (defun eshell-command-result-equal (command result) | 184 | (defun eshell-command-result-equal (command result) |
| 184 | "Execute COMMAND non-interactively and compare it to RESULT." | 185 | "Execute COMMAND non-interactively and compare it to RESULT." |
| 185 | (ert-info (#'eshell-get-debug-logs :prefix "Command logs: ") | 186 | (ert-info (#'eshell-get-debug-logs :prefix "Command logs: ") |
| 186 | (should (eshell-command-result--equal | 187 | (let ((eshell-module-loading-messages nil)) |
| 187 | command | 188 | (should (eshell-command-result--equal |
| 188 | (eshell-test-command-result command) | 189 | command |
| 189 | result)))) | 190 | (eshell-test-command-result command) |
| 191 | result))))) | ||
| 190 | 192 | ||
| 191 | (provide 'eshell-tests-helpers) | 193 | (provide 'eshell-tests-helpers) |
| 192 | 194 | ||
diff --git a/test/lisp/eshell/eshell-tests-unload.el b/test/lisp/eshell/eshell-tests-unload.el index bf8291ba47a..479090e8f8c 100644 --- a/test/lisp/eshell/eshell-tests-unload.el +++ b/test/lisp/eshell/eshell-tests-unload.el | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | (defvar eshell-history-file-name) | 33 | (defvar eshell-history-file-name) |
| 34 | (defvar eshell-last-dir-ring-file-name) | 34 | (defvar eshell-last-dir-ring-file-name) |
| 35 | (defvar eshell-modules-list) | 35 | (defvar eshell-modules-list) |
| 36 | (defvar eshell-module-loading-messages) | ||
| 36 | 37 | ||
| 37 | (declare-function eshell-module--feature-name "esh-module" | 38 | (declare-function eshell-module--feature-name "esh-module" |
| 38 | (module &optional kind)) | 39 | (module &optional kind)) |
| @@ -51,6 +52,7 @@ See `unload-eshell'.") | |||
| 51 | (process-environment (cons "HISTFILE" process-environment)) | 52 | (process-environment (cons "HISTFILE" process-environment)) |
| 52 | (eshell-history-file-name nil) | 53 | (eshell-history-file-name nil) |
| 53 | (eshell-last-dir-ring-file-name nil) | 54 | (eshell-last-dir-ring-file-name nil) |
| 55 | (eshell-module-loading-messages nil) | ||
| 54 | (eshell-buffer (eshell t))) | 56 | (eshell-buffer (eshell t))) |
| 55 | (let (kill-buffer-query-functions) | 57 | (let (kill-buffer-query-functions) |
| 56 | (kill-buffer eshell-buffer)))))) | 58 | (kill-buffer eshell-buffer)))))) |