summaryrefslogtreecommitdiff
path: root/lisp/eshell/esh-mode.el
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2020-05-24 20:12:30 -0400
committerNoam Postavsky <npostavs@gmail.com>2020-05-24 20:12:30 -0400
commit478638e4706716b74de5b1aa3e85c8fd943f17ba (patch)
treecf5f40cdaec0af986199d3147a480ddca631a3a7 /lisp/eshell/esh-mode.el
parente7a3ed8a6dddb6e16c83d27a04dfa6ec8160e580 (diff)
downloademacs-478638e4706716b74de5b1aa3e85c8fd943f17ba.tar.gz
emacs-478638e4706716b74de5b1aa3e85c8fd943f17ba.tar.bz2
emacs-478638e4706716b74de5b1aa3e85c8fd943f17ba.zip
Revert "Fix eshell-mode-map initialization"
It makes eshell-return-exits-minibuffer permanently affect the eshell-mode-map (Bug#41370). Do not merge to master, we will fix it properly there.
Diffstat (limited to 'lisp/eshell/esh-mode.el')
-rw-r--r--lisp/eshell/esh-mode.el58
1 files changed, 32 insertions, 26 deletions
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index d0147b345aa..db5fddb2aaf 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -213,7 +213,10 @@ This is used by `eshell-watch-for-password-prompt'."
;; these are only set to nil initially for the sake of the
;; byte-compiler, when compiling other files which `require' this one
(defvar eshell-mode nil)
+(defvar eshell-mode-map nil)
(defvar eshell-command-running-string "--")
+(defvar eshell-command-map nil)
+(defvar eshell-command-prefix nil)
(defvar eshell-last-input-start nil)
(defvar eshell-last-input-end nil)
(defvar eshell-last-output-start nil)
@@ -277,32 +280,6 @@ This is used by `eshell-watch-for-password-prompt'."
(standard-syntax-table))
st))
-(defvar eshell-mode-map
- (let ((map (make-sparse-keymap)))
- (define-key map [(control ?c)] 'eshell-command-map)
- (define-key map "\r" #'eshell-send-input)
- (define-key map "\M-\r" #'eshell-queue-input)
- (define-key map [(meta control ?l)] #'eshell-show-output)
- (define-key map [(control ?a)] #'eshell-bol)
- map))
-
-(defvar eshell-command-map
- (let ((map (define-prefix-command 'eshell-command-map)))
- (define-key map [(meta ?o)] #'eshell-mark-output)
- (define-key map [(meta ?d)] #'eshell-toggle-direct-send)
- (define-key map [(control ?a)] #'eshell-bol)
- (define-key map [(control ?b)] #'eshell-backward-argument)
- (define-key map [(control ?e)] #'eshell-show-maximum-output)
- (define-key map [(control ?f)] #'eshell-forward-argument)
- (define-key map [(control ?m)] #'eshell-copy-old-input)
- (define-key map [(control ?o)] #'eshell-kill-output)
- (define-key map [(control ?r)] #'eshell-show-output)
- (define-key map [(control ?t)] #'eshell-truncate-buffer)
- (define-key map [(control ?u)] #'eshell-kill-input)
- (define-key map [(control ?w)] #'backward-kill-word)
- (define-key map [(control ?y)] #'eshell-repeat-argument)
- map))
-
;;; User Functions:
(defun eshell-kill-buffer-function ()
@@ -321,6 +298,10 @@ and the hook `eshell-exit-hook'."
"Emacs shell interactive mode."
(setq-local eshell-mode t)
+ ;; FIXME: What the hell!?
+ (setq-local eshell-mode-map (make-sparse-keymap))
+ (use-local-map eshell-mode-map)
+
(when eshell-status-in-mode-line
(make-local-variable 'eshell-command-running-string)
(let ((fmt (copy-sequence mode-line-format)))
@@ -329,6 +310,31 @@ and the hook `eshell-exit-hook'."
(if mode-line-elt
(setcar mode-line-elt 'eshell-command-running-string))))
+ (define-key eshell-mode-map "\r" 'eshell-send-input)
+ (define-key eshell-mode-map "\M-\r" 'eshell-queue-input)
+ (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output)
+ (define-key eshell-mode-map [(control ?a)] 'eshell-bol)
+
+ (setq-local eshell-command-prefix (make-symbol "eshell-command-prefix"))
+ (fset eshell-command-prefix (make-sparse-keymap))
+ (setq-local eshell-command-map (symbol-function eshell-command-prefix))
+ (define-key eshell-mode-map [(control ?c)] eshell-command-prefix)
+
+ (define-key eshell-command-map [(meta ?o)] 'eshell-mark-output)
+ (define-key eshell-command-map [(meta ?d)] 'eshell-toggle-direct-send)
+
+ (define-key eshell-command-map [(control ?a)] 'eshell-bol)
+ (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument)
+ (define-key eshell-command-map [(control ?e)] 'eshell-show-maximum-output)
+ (define-key eshell-command-map [(control ?f)] 'eshell-forward-argument)
+ (define-key eshell-command-map [(control ?m)] 'eshell-copy-old-input)
+ (define-key eshell-command-map [(control ?o)] 'eshell-kill-output)
+ (define-key eshell-command-map [(control ?r)] 'eshell-show-output)
+ (define-key eshell-command-map [(control ?t)] 'eshell-truncate-buffer)
+ (define-key eshell-command-map [(control ?u)] 'eshell-kill-input)
+ (define-key eshell-command-map [(control ?w)] 'backward-kill-word)
+ (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument)
+
(setq local-abbrev-table eshell-mode-abbrev-table)
(set (make-local-variable 'list-buffers-directory)