diff options
| author | Noam Postavsky | 2020-05-24 20:17:40 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2020-05-24 20:17:40 -0400 |
| commit | b9b8c5e3fa71aea719934ce422fb22734590a8b3 (patch) | |
| tree | bf0a6540c5771da947eb2b6818e82c2f08d1d69c /lisp/eshell | |
| parent | 3b65fb7658c2717457c033c6704cf3b007804226 (diff) | |
| download | emacs-b9b8c5e3fa71aea719934ce422fb22734590a8b3.tar.gz emacs-b9b8c5e3fa71aea719934ce422fb22734590a8b3.zip | |
Make dedicated keymap and mode for eshell-command (Bug#41370)
Otherwise, we end up permanently modifying eshell-mode-map when
running eshell-command.
* lisp/eshell/eshell.el (eshell-command-mode): New mode, with map to
contain the bindings previously set by eshell-return-exits-minibuffer.
(eshell-return-exits-minibuffer): Make into obsolete alias for
eshell-command-mode.
(eshell-command): Use eshell-command-mode instead of
eshell-return-exits-minibuffer.
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/eshell.el | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el index 2a63882ff09..5ffb159b575 100644 --- a/lisp/eshell/eshell.el +++ b/lisp/eshell/eshell.el | |||
| @@ -265,14 +265,18 @@ information on Eshell, see Info node `(eshell)Top'." | |||
| 265 | (eshell-mode)) | 265 | (eshell-mode)) |
| 266 | buf)) | 266 | buf)) |
| 267 | 267 | ||
| 268 | (defun eshell-return-exits-minibuffer () | 268 | (define-minor-mode eshell-command-mode |
| 269 | ;; This is supposedly run after enabling esh-mode, when eshell-mode-map | 269 | "Minor mode for `eshell-command' input. |
| 270 | ;; already exists. | 270 | \\{eshell-command-mode-map}" |
| 271 | (defvar eshell-mode-map) | 271 | :keymap (let ((map (make-sparse-keymap))) |
| 272 | (define-key eshell-mode-map [(control ?g)] 'abort-recursive-edit) | 272 | (define-key map [(control ?g)] 'abort-recursive-edit) |
| 273 | (define-key eshell-mode-map [(control ?m)] 'exit-minibuffer) | 273 | (define-key map [(control ?m)] 'exit-minibuffer) |
| 274 | (define-key eshell-mode-map [(control ?j)] 'exit-minibuffer) | 274 | (define-key map [(control ?j)] 'exit-minibuffer) |
| 275 | (define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer)) | 275 | (define-key map [(meta control ?m)] 'exit-minibuffer) |
| 276 | map)) | ||
| 277 | |||
| 278 | (define-obsolete-function-alias 'eshell-return-exits-minibuffer | ||
| 279 | #'eshell-command-mode "28.1") | ||
| 276 | 280 | ||
| 277 | (defvar eshell-non-interactive-p nil | 281 | (defvar eshell-non-interactive-p nil |
| 278 | "A variable which is non-nil when Eshell is not running interactively. | 282 | "A variable which is non-nil when Eshell is not running interactively. |
| @@ -292,7 +296,7 @@ With prefix ARG, insert output into the current buffer at point." | |||
| 292 | ;; Enable `eshell-mode' only in this minibuffer. | 296 | ;; Enable `eshell-mode' only in this minibuffer. |
| 293 | (minibuffer-with-setup-hook #'(lambda () | 297 | (minibuffer-with-setup-hook #'(lambda () |
| 294 | (eshell-mode) | 298 | (eshell-mode) |
| 295 | (eshell-return-exits-minibuffer)) | 299 | (eshell-command-mode +1)) |
| 296 | (unless command | 300 | (unless command |
| 297 | (setq command (read-from-minibuffer "Emacs shell command: ")) | 301 | (setq command (read-from-minibuffer "Emacs shell command: ")) |
| 298 | (if (eshell-using-module 'eshell-hist) | 302 | (if (eshell-using-module 'eshell-hist) |