aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoam Postavsky2020-05-24 20:12:30 -0400
committerNoam Postavsky2020-05-24 20:12:30 -0400
commit478638e4706716b74de5b1aa3e85c8fd943f17ba (patch)
treecf5f40cdaec0af986199d3147a480ddca631a3a7
parente7a3ed8a6dddb6e16c83d27a04dfa6ec8160e580 (diff)
downloademacs-478638e4706716b74de5b1aa3e85c8fd943f17ba.tar.gz
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.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/eshell/em-cmpl.el35
-rw-r--r--lisp/eshell/em-hist.el62
-rw-r--r--lisp/eshell/em-pred.el15
-rw-r--r--lisp/eshell/em-prompt.el16
-rw-r--r--lisp/eshell/em-rebind.el13
-rw-r--r--lisp/eshell/esh-arg.el16
-rw-r--r--lisp/eshell/esh-mode.el58
-rw-r--r--lisp/eshell/esh-proc.el28
-rw-r--r--lisp/eshell/esh-var.el16
10 files changed, 100 insertions, 165 deletions
diff --git a/etc/NEWS b/etc/NEWS
index bb275b70e6f..58bd491753a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2054,12 +2054,6 @@ default, and not just the opening element.
2054behave similarly, e.g. Pcomplete's default cycling can be obtained 2054behave similarly, e.g. Pcomplete's default cycling can be obtained
2055with '(setq completion-cycle-threshold 5)'. 2055with '(setq completion-cycle-threshold 5)'.
2056 2056
2057---
2058*** Eshell no longer re-initializes its keymap every call.
2059This allows users to use (define-key eshell-mode-map ...) as usual.
2060Some modules have their own minor mode now to account for these
2061changes.
2062
2063+++ 2057+++
2064*** Expansion of history event designators is disabled by default. 2058*** Expansion of history event designators is disabled by default.
2065To restore the old behavior, use 2059To restore the old behavior, use
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index dcf56af6051..48c99acac33 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -244,26 +244,6 @@ to writing a completion function."
244 (let ((completion-at-point-functions '(elisp-completion-at-point))) 244 (let ((completion-at-point-functions '(elisp-completion-at-point)))
245 (completion-at-point))) 245 (completion-at-point)))
246 246
247(defvar eshell-cmpl-mode-map
248 (let ((map (make-sparse-keymap)))
249 (define-key map [(control ?i)] #'completion-at-point)
250 ;; jww (1999-10-19): Will this work on anything but X?
251 (define-key map [backtab] #'pcomplete-reverse)
252 (define-key map [(meta ??)] #'completion-help-at-point)
253 (define-key map [(meta control ?i)] #'eshell-complete-lisp-symbol)
254 ;; C-c prefix:
255 (define-key map (kbd "C-c M-h") #'eshell-completion-help)
256 (define-key map (kbd "C-c TAB") #'pcomplete-expand-and-complete)
257 (define-key map (kbd "C-c C-i") #'pcomplete-expand-and-complete)
258 (define-key map (kbd "C-c SPC") #'pcomplete-expand)
259 map))
260
261(define-minor-mode eshell-cmpl-mode
262 "Minor mode that provides a keymap when `eshell-cmpl' active.
263
264\\{eshell-cmpl-mode-map}"
265 :keymap eshell-cmpl-mode-map)
266
267(defun eshell-cmpl-initialize () ;Called from `eshell-mode' via intern-soft! 247(defun eshell-cmpl-initialize () ;Called from `eshell-mode' via intern-soft!
268 "Initialize the completions module." 248 "Initialize the completions module."
269 (set (make-local-variable 'pcomplete-command-completion-function) 249 (set (make-local-variable 'pcomplete-command-completion-function)
@@ -311,9 +291,22 @@ to writing a completion function."
311 eshell-special-chars-outside-quoting))) 291 eshell-special-chars-outside-quoting)))
312 nil t) 292 nil t)
313 (add-hook 'pcomplete-quote-arg-hook #'eshell-quote-backslash nil t) 293 (add-hook 'pcomplete-quote-arg-hook #'eshell-quote-backslash nil t)
294 ;;(define-key eshell-mode-map [(meta tab)] 'eshell-complete-lisp-symbol) ; Redundant
295 (define-key eshell-mode-map [(meta control ?i)] 'eshell-complete-lisp-symbol)
296 (define-key eshell-command-map [(meta ?h)] 'eshell-completion-help)
297 (define-key eshell-command-map [tab] 'pcomplete-expand-and-complete)
298 (define-key eshell-command-map [(control ?i)]
299 'pcomplete-expand-and-complete)
300 (define-key eshell-command-map [space] 'pcomplete-expand)
301 (define-key eshell-command-map [? ] 'pcomplete-expand)
302 ;;(define-key eshell-mode-map [tab] 'completion-at-point) ;Redundant!
303 (define-key eshell-mode-map [(control ?i)] 'completion-at-point)
314 (add-hook 'completion-at-point-functions 304 (add-hook 'completion-at-point-functions
315 #'pcomplete-completions-at-point nil t) 305 #'pcomplete-completions-at-point nil t)
316 (eshell-cmpl-mode)) 306 ;; jww (1999-10-19): Will this work on anything but X?
307 (define-key eshell-mode-map
308 (if (featurep 'xemacs) [iso-left-tab] [backtab]) 'pcomplete-reverse)
309 (define-key eshell-mode-map [(meta ??)] 'completion-help-at-point))
317 310
318(defun eshell-completion-command-name () 311(defun eshell-completion-command-name ()
319 "Return the command name, possibly sans globbing." 312 "Return the command name, possibly sans globbing."
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 267936583e1..73742a361da 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -202,32 +202,6 @@ element, regardless of any text on the command line. In that case,
202 map) 202 map)
203 "Keymap used in isearch in Eshell.") 203 "Keymap used in isearch in Eshell.")
204 204
205(defvar eshell-hist-mode-map
206 (let ((map (make-sparse-keymap)))
207 (define-key map [up] #'eshell-previous-matching-input-from-input)
208 (define-key map [down] #'eshell-next-matching-input-from-input)
209 (define-key map [(control up)] #'eshell-previous-input)
210 (define-key map [(control down)] #'eshell-next-input)
211 (define-key map [(meta ?r)] #'eshell-previous-matching-input)
212 (define-key map [(meta ?s)] #'eshell-next-matching-input)
213 (define-key map (kbd "C-c M-r") #'eshell-previous-matching-input-from-input)
214 (define-key map (kbd "C-c M-s") #'eshell-next-matching-input-from-input)
215 ;; FIXME: Relies on `eshell-hist-match-partial' being set _before_
216 ;; em-hist is loaded and won't respect changes.
217 (if eshell-hist-match-partial
218 (progn
219 (define-key map [(meta ?p)] 'eshell-previous-matching-input-from-input)
220 (define-key map [(meta ?n)] 'eshell-next-matching-input-from-input)
221 (define-key map (kbd "C-c M-p") #'eshell-previous-input)
222 (define-key map (kbd "C-c M-n") #'eshell-next-input))
223 (define-key map [(meta ?p)] #'eshell-previous-input)
224 (define-key map [(meta ?n)] #'eshell-next-input)
225 (define-key map (kbd "C-c M-p") #'eshell-previous-matching-input-from-input)
226 (define-key map (kbd "C-c M-n") #'eshell-next-matching-input-from-input))
227 (define-key map (kbd "C-c C-l") #'eshell-list-history)
228 (define-key map (kbd "C-c C-x") #'eshell-get-next-from-history)
229 map))
230
231(defvar eshell-rebind-keys-alist) 205(defvar eshell-rebind-keys-alist)
232 206
233;;; Functions: 207;;; Functions:
@@ -242,12 +216,6 @@ Returns non-nil if INPUT is blank."
242Returns nil if INPUT is prepended by blank space, otherwise non-nil." 216Returns nil if INPUT is prepended by blank space, otherwise non-nil."
243 (not (string-match-p "\\`\\s-+" input))) 217 (not (string-match-p "\\`\\s-+" input)))
244 218
245(define-minor-mode eshell-hist-mode
246 "Minor mode for the eshell-hist module.
247
248\\{eshell-hist-mode-map}"
249 :keymap eshell-hist-mode-map)
250
251(defun eshell-hist-initialize () ;Called from `eshell-mode' via intern-soft! 219(defun eshell-hist-initialize () ;Called from `eshell-mode' via intern-soft!
252 "Initialize the history management code for one Eshell buffer." 220 "Initialize the history management code for one Eshell buffer."
253 (when (eshell-using-module 'eshell-cmpl) 221 (when (eshell-using-module 'eshell-cmpl)
@@ -274,7 +242,30 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
274 (lambda () 242 (lambda ()
275 (setq overriding-terminal-local-map nil))) 243 (setq overriding-terminal-local-map nil)))
276 nil t)) 244 nil t))
277 (eshell-hist-mode)) 245 (define-key eshell-mode-map [up] 'eshell-previous-matching-input-from-input)
246 (define-key eshell-mode-map [down] 'eshell-next-matching-input-from-input)
247 (define-key eshell-mode-map [(control up)] 'eshell-previous-input)
248 (define-key eshell-mode-map [(control down)] 'eshell-next-input)
249 (define-key eshell-mode-map [(meta ?r)] 'eshell-previous-matching-input)
250 (define-key eshell-mode-map [(meta ?s)] 'eshell-next-matching-input)
251 (define-key eshell-command-map [(meta ?r)]
252 'eshell-previous-matching-input-from-input)
253 (define-key eshell-command-map [(meta ?s)]
254 'eshell-next-matching-input-from-input)
255 (if eshell-hist-match-partial
256 (progn
257 (define-key eshell-mode-map [(meta ?p)]
258 'eshell-previous-matching-input-from-input)
259 (define-key eshell-mode-map [(meta ?n)]
260 'eshell-next-matching-input-from-input)
261 (define-key eshell-command-map [(meta ?p)] 'eshell-previous-input)
262 (define-key eshell-command-map [(meta ?n)] 'eshell-next-input))
263 (define-key eshell-mode-map [(meta ?p)] 'eshell-previous-input)
264 (define-key eshell-mode-map [(meta ?n)] 'eshell-next-input)
265 (define-key eshell-command-map [(meta ?p)]
266 'eshell-previous-matching-input-from-input)
267 (define-key eshell-command-map [(meta ?n)]
268 'eshell-next-matching-input-from-input)))
278 269
279 (make-local-variable 'eshell-history-size) 270 (make-local-variable 'eshell-history-size)
280 (or eshell-history-size 271 (or eshell-history-size
@@ -309,7 +300,10 @@ Returns nil if INPUT is prepended by blank space, otherwise non-nil."
309 (add-hook 'kill-emacs-hook #'eshell-save-some-history) 300 (add-hook 'kill-emacs-hook #'eshell-save-some-history)
310 301
311 (make-local-variable 'eshell-input-filter-functions) 302 (make-local-variable 'eshell-input-filter-functions)
312 (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)
304
305 (define-key eshell-command-map [(control ?l)] 'eshell-list-history)
306 (define-key eshell-command-map [(control ?x)] 'eshell-get-next-from-history))
313 307
314(defun eshell-save-some-history () 308(defun eshell-save-some-history ()
315 "Save the history for any open Eshell buffers." 309 "Save the history for any open Eshell buffers."
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 04bf3ff8998..ee4b28fb3ae 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -229,12 +229,6 @@ FOR LISTS OF ARGUMENTS:
229EXAMPLES: 229EXAMPLES:
230 *.c(:o) sorted list of .c files") 230 *.c(:o) sorted list of .c files")
231 231
232(defvar eshell-pred-mode-map
233 (let ((map (make-sparse-keymap)))
234 (define-key map (kbd "C-c M-q") #'eshell-display-predicate-help)
235 (define-key map (kbd "C-c M-m") #'eshell-display-modifier-help)
236 map))
237
238;;; Functions: 232;;; Functions:
239 233
240(defun eshell-display-predicate-help () 234(defun eshell-display-predicate-help ()
@@ -251,17 +245,12 @@ EXAMPLES:
251 (lambda () 245 (lambda ()
252 (insert eshell-modifier-help-string))))) 246 (insert eshell-modifier-help-string)))))
253 247
254(define-minor-mode eshell-pred-mode
255 "Minor mode for the eshell-pred module.
256
257\\{eshell-pred-mode-map}"
258 :keymap eshell-pred-mode-map)
259
260(defun eshell-pred-initialize () ;Called from `eshell-mode' via intern-soft! 248(defun eshell-pred-initialize () ;Called from `eshell-mode' via intern-soft!
261 "Initialize the predicate/modifier code." 249 "Initialize the predicate/modifier code."
262 (add-hook 'eshell-parse-argument-hook 250 (add-hook 'eshell-parse-argument-hook
263 #'eshell-parse-arg-modifier t t) 251 #'eshell-parse-arg-modifier t t)
264 (eshell-pred-mode)) 252 (define-key eshell-command-map [(meta ?q)] 'eshell-display-predicate-help)
253 (define-key eshell-command-map [(meta ?m)] 'eshell-display-modifier-help))
265 254
266(defun eshell-apply-modifiers (lst predicates modifiers) 255(defun eshell-apply-modifiers (lst predicates modifiers)
267 "Apply to LIST a series of PREDICATES and MODIFIERS." 256 "Apply to LIST a series of PREDICATES and MODIFIERS."
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index 9ae5ae12816..bbf3b94ff44 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -97,20 +97,8 @@ arriving, or after."
97 :options '(eshell-show-maximum-output) 97 :options '(eshell-show-maximum-output)
98 :group 'eshell-prompt) 98 :group 'eshell-prompt)
99 99
100(defvar eshell-prompt-mode-map
101 (let ((map (make-sparse-keymap)))
102 (define-key map (kbd "C-c C-n") #'eshell-next-prompt)
103 (define-key map (kbd "C-c C-p") #'eshell-previous-prompt)
104 map))
105
106;;; Functions: 100;;; Functions:
107 101
108(define-minor-mode eshell-prompt-mode
109 "Minor mode for eshell-prompt module.
110
111\\{eshell-prompt-mode-map}"
112 :keymap eshell-prompt-mode-map)
113
114(defun eshell-prompt-initialize () ;Called from `eshell-mode' via intern-soft! 102(defun eshell-prompt-initialize () ;Called from `eshell-mode' via intern-soft!
115 "Initialize the prompting code." 103 "Initialize the prompting code."
116 (unless eshell-non-interactive-p 104 (unless eshell-non-interactive-p
@@ -122,7 +110,9 @@ arriving, or after."
122 110
123 (set (make-local-variable 'eshell-skip-prompt-function) 111 (set (make-local-variable 'eshell-skip-prompt-function)
124 'eshell-skip-prompt) 112 'eshell-skip-prompt)
125 (eshell-prompt-mode))) 113
114 (define-key eshell-command-map [(control ?n)] 'eshell-next-prompt)
115 (define-key eshell-command-map [(control ?p)] 'eshell-previous-prompt)))
126 116
127(defun eshell-emit-prompt () 117(defun eshell-emit-prompt ()
128 "Emit a prompt if eshell is being used interactively." 118 "Emit a prompt if eshell is being used interactively."
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el
index bf5a4bf1afe..85593e45160 100644
--- a/lisp/eshell/em-rebind.el
+++ b/lisp/eshell/em-rebind.el
@@ -137,11 +137,6 @@ This is default behavior of shells like bash."
137 :type '(repeat function) 137 :type '(repeat function)
138 :group 'eshell-rebind) 138 :group 'eshell-rebind)
139 139
140(defvar eshell-rebind-mode-map
141 (let ((map (make-sparse-keymap)))
142 (define-key map (kbd "C-c M-l") #'eshell-lock-local-map)
143 map))
144
145;; Internal Variables: 140;; Internal Variables:
146 141
147(defvar eshell-input-keymap) 142(defvar eshell-input-keymap)
@@ -150,12 +145,6 @@ This is default behavior of shells like bash."
150 145
151;;; Functions: 146;;; Functions:
152 147
153(define-minor-mode eshell-rebind-mode
154 "Minor mode for the eshell-rebind module.
155
156\\{eshell-rebind-mode-map}"
157 :keymap eshell-rebind-mode-map)
158
159(defun eshell-rebind-initialize () ;Called from `eshell-mode' via intern-soft! 148(defun eshell-rebind-initialize () ;Called from `eshell-mode' via intern-soft!
160 "Initialize the inputting code." 149 "Initialize the inputting code."
161 (unless eshell-non-interactive-p 150 (unless eshell-non-interactive-p
@@ -165,7 +154,7 @@ This is default behavior of shells like bash."
165 (make-local-variable 'overriding-local-map) 154 (make-local-variable 'overriding-local-map)
166 (add-hook 'post-command-hook 'eshell-rebind-input-map nil t) 155 (add-hook 'post-command-hook 'eshell-rebind-input-map nil t)
167 (set (make-local-variable 'eshell-lock-keymap) nil) 156 (set (make-local-variable 'eshell-lock-keymap) nil)
168 (eshell-rebind-mode))) 157 (define-key eshell-command-map [(meta ?l)] 'eshell-lock-local-map)))
169 158
170(defun eshell-lock-local-map (&optional arg) 159(defun eshell-lock-local-map (&optional arg)
171 "Lock or unlock the current local keymap. 160 "Lock or unlock the current local keymap.
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index e7b07b4208d..86ceb41ffd2 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -155,22 +155,14 @@ treated as a literal character."
155 :type 'hook 155 :type 'hook
156 :group 'eshell-arg) 156 :group 'eshell-arg)
157 157
158(defvar eshell-arg-mode-map
159 (let ((map (make-sparse-keymap)))
160 (define-key map (kbd "C-c M-b") #'eshell-insert-buffer-name)
161 map))
162
163;;; Functions: 158;;; Functions:
164 159
165(define-minor-mode eshell-arg-mode
166 "Minor mode for the arg eshell module.
167
168\\{eshell-arg-mode-map}"
169 :keymap eshell-arg-mode-map)
170
171(defun eshell-arg-initialize () ;Called from `eshell-mode' via intern-soft! 160(defun eshell-arg-initialize () ;Called from `eshell-mode' via intern-soft!
172 "Initialize the argument parsing code." 161 "Initialize the argument parsing code."
173 (eshell-arg-mode) 162 ;; This is supposedly run after enabling esh-mode, when eshell-mode-map
163 ;; already exists.
164 (defvar eshell-command-map)
165 (define-key eshell-command-map [(meta ?b)] 'eshell-insert-buffer-name)
174 (set (make-local-variable 'eshell-inside-quote-regexp) nil) 166 (set (make-local-variable 'eshell-inside-quote-regexp) nil)
175 (set (make-local-variable 'eshell-outside-quote-regexp) nil)) 167 (set (make-local-variable 'eshell-outside-quote-regexp) nil))
176 168
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'."
213;; these are only set to nil initially for the sake of the 213;; these are only set to nil initially for the sake of the
214;; byte-compiler, when compiling other files which `require' this one 214;; byte-compiler, when compiling other files which `require' this one
215(defvar eshell-mode nil) 215(defvar eshell-mode nil)
216(defvar eshell-mode-map nil)
216(defvar eshell-command-running-string "--") 217(defvar eshell-command-running-string "--")
218(defvar eshell-command-map nil)
219(defvar eshell-command-prefix nil)
217(defvar eshell-last-input-start nil) 220(defvar eshell-last-input-start nil)
218(defvar eshell-last-input-end nil) 221(defvar eshell-last-input-end nil)
219(defvar eshell-last-output-start nil) 222(defvar eshell-last-output-start nil)
@@ -277,32 +280,6 @@ This is used by `eshell-watch-for-password-prompt'."
277 (standard-syntax-table)) 280 (standard-syntax-table))
278 st)) 281 st))
279 282
280(defvar eshell-mode-map
281 (let ((map (make-sparse-keymap)))
282 (define-key map [(control ?c)] 'eshell-command-map)
283 (define-key map "\r" #'eshell-send-input)
284 (define-key map "\M-\r" #'eshell-queue-input)
285 (define-key map [(meta control ?l)] #'eshell-show-output)
286 (define-key map [(control ?a)] #'eshell-bol)
287 map))
288
289(defvar eshell-command-map
290 (let ((map (define-prefix-command 'eshell-command-map)))
291 (define-key map [(meta ?o)] #'eshell-mark-output)
292 (define-key map [(meta ?d)] #'eshell-toggle-direct-send)
293 (define-key map [(control ?a)] #'eshell-bol)
294 (define-key map [(control ?b)] #'eshell-backward-argument)
295 (define-key map [(control ?e)] #'eshell-show-maximum-output)
296 (define-key map [(control ?f)] #'eshell-forward-argument)
297 (define-key map [(control ?m)] #'eshell-copy-old-input)
298 (define-key map [(control ?o)] #'eshell-kill-output)
299 (define-key map [(control ?r)] #'eshell-show-output)
300 (define-key map [(control ?t)] #'eshell-truncate-buffer)
301 (define-key map [(control ?u)] #'eshell-kill-input)
302 (define-key map [(control ?w)] #'backward-kill-word)
303 (define-key map [(control ?y)] #'eshell-repeat-argument)
304 map))
305
306;;; User Functions: 283;;; User Functions:
307 284
308(defun eshell-kill-buffer-function () 285(defun eshell-kill-buffer-function ()
@@ -321,6 +298,10 @@ and the hook `eshell-exit-hook'."
321 "Emacs shell interactive mode." 298 "Emacs shell interactive mode."
322 (setq-local eshell-mode t) 299 (setq-local eshell-mode t)
323 300
301 ;; FIXME: What the hell!?
302 (setq-local eshell-mode-map (make-sparse-keymap))
303 (use-local-map eshell-mode-map)
304
324 (when eshell-status-in-mode-line 305 (when eshell-status-in-mode-line
325 (make-local-variable 'eshell-command-running-string) 306 (make-local-variable 'eshell-command-running-string)
326 (let ((fmt (copy-sequence mode-line-format))) 307 (let ((fmt (copy-sequence mode-line-format)))
@@ -329,6 +310,31 @@ and the hook `eshell-exit-hook'."
329 (if mode-line-elt 310 (if mode-line-elt
330 (setcar mode-line-elt 'eshell-command-running-string)))) 311 (setcar mode-line-elt 'eshell-command-running-string))))
331 312
313 (define-key eshell-mode-map "\r" 'eshell-send-input)
314 (define-key eshell-mode-map "\M-\r" 'eshell-queue-input)
315 (define-key eshell-mode-map [(meta control ?l)] 'eshell-show-output)
316 (define-key eshell-mode-map [(control ?a)] 'eshell-bol)
317
318 (setq-local eshell-command-prefix (make-symbol "eshell-command-prefix"))
319 (fset eshell-command-prefix (make-sparse-keymap))
320 (setq-local eshell-command-map (symbol-function eshell-command-prefix))
321 (define-key eshell-mode-map [(control ?c)] eshell-command-prefix)
322
323 (define-key eshell-command-map [(meta ?o)] 'eshell-mark-output)
324 (define-key eshell-command-map [(meta ?d)] 'eshell-toggle-direct-send)
325
326 (define-key eshell-command-map [(control ?a)] 'eshell-bol)
327 (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument)
328 (define-key eshell-command-map [(control ?e)] 'eshell-show-maximum-output)
329 (define-key eshell-command-map [(control ?f)] 'eshell-forward-argument)
330 (define-key eshell-command-map [(control ?m)] 'eshell-copy-old-input)
331 (define-key eshell-command-map [(control ?o)] 'eshell-kill-output)
332 (define-key eshell-command-map [(control ?r)] 'eshell-show-output)
333 (define-key eshell-command-map [(control ?t)] 'eshell-truncate-buffer)
334 (define-key eshell-command-map [(control ?u)] 'eshell-kill-input)
335 (define-key eshell-command-map [(control ?w)] 'backward-kill-word)
336 (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument)
337
332 (setq local-abbrev-table eshell-mode-abbrev-table) 338 (setq local-abbrev-table eshell-mode-abbrev-table)
333 339
334 (set (make-local-variable 'list-buffers-directory) 340 (set (make-local-variable 'list-buffers-directory)
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index d2c17fe1f77..c3ac3a5b71b 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -109,16 +109,6 @@ information, for example."
109(defvar eshell-process-list nil 109(defvar eshell-process-list nil
110 "A list of the current status of subprocesses.") 110 "A list of the current status of subprocesses.")
111 111
112(defvar eshell-proc-mode-map
113 (let ((map (make-sparse-keymap)))
114 (define-key map (kbd "C-c M-i") #'eshell-insert-process)
115 (define-key map (kbd "C-c C-c") #'eshell-interrupt-process)
116 (define-key map (kbd "C-c C-k") #'eshell-kill-process)
117 (define-key map (kbd "C-c C-d") #'eshell-send-eof-to-process)
118 (define-key map (kbd "C-c C-s") #'list-processes)
119 (define-key map (kbd "C-c C-\\") #'eshell-quit-process)
120 map))
121
122;;; Functions: 112;;; Functions:
123 113
124(defun eshell-kill-process-function (proc status) 114(defun eshell-kill-process-function (proc status)
@@ -131,16 +121,20 @@ PROC and STATUS to functions on the latter."
131 (eshell-reset-after-proc status) 121 (eshell-reset-after-proc status)
132 (run-hook-with-args 'eshell-kill-hook proc status)) 122 (run-hook-with-args 'eshell-kill-hook proc status))
133 123
134(define-minor-mode eshell-proc-mode
135 "Minor mode for the proc eshell module.
136
137\\{eshell-proc-mode-map}"
138 :keymap eshell-proc-mode-map)
139
140(defun eshell-proc-initialize () ;Called from `eshell-mode' via intern-soft! 124(defun eshell-proc-initialize () ;Called from `eshell-mode' via intern-soft!
141 "Initialize the process handling code." 125 "Initialize the process handling code."
142 (make-local-variable 'eshell-process-list) 126 (make-local-variable 'eshell-process-list)
143 (eshell-proc-mode)) 127 ;; This is supposedly run after enabling esh-mode, when eshell-command-map
128 ;; already exists.
129 (defvar eshell-command-map)
130 (define-key eshell-command-map [(meta ?i)] 'eshell-insert-process)
131 (define-key eshell-command-map [(control ?c)] 'eshell-interrupt-process)
132 (define-key eshell-command-map [(control ?k)] 'eshell-kill-process)
133 (define-key eshell-command-map [(control ?d)] 'eshell-send-eof-to-process)
134; (define-key eshell-command-map [(control ?q)] 'eshell-continue-process)
135 (define-key eshell-command-map [(control ?s)] 'list-processes)
136; (define-key eshell-command-map [(control ?z)] 'eshell-stop-process)
137 (define-key eshell-command-map [(control ?\\)] 'eshell-quit-process))
144 138
145(defun eshell-reset-after-proc (status) 139(defun eshell-reset-after-proc (status)
146 "Reset the command input location after a process terminates. 140 "Reset the command input location after a process terminates.
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 327a1def469..75ccf5b8353 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -197,19 +197,8 @@ function), and the arguments passed to this function would be the list
197 197
198(put 'eshell-variable-aliases-list 'risky-local-variable t) 198(put 'eshell-variable-aliases-list 'risky-local-variable t)
199 199
200(defvar eshell-var-mode-map
201 (let ((map (make-sparse-keymap)))
202 (define-key map (kbd "C-c M-v") #'eshell-insert-envvar)
203 map))
204
205;;; Functions: 200;;; Functions:
206 201
207(define-minor-mode eshell-var-mode
208 "Minor mode for the esh-var module.
209
210\\{eshell-var-mode-map}"
211 :keymap eshell-var-mode-map)
212
213(defun eshell-var-initialize () ;Called from `eshell-mode' via intern-soft! 202(defun eshell-var-initialize () ;Called from `eshell-mode' via intern-soft!
214 "Initialize the variable handle code." 203 "Initialize the variable handle code."
215 ;; Break the association with our parent's environment. Otherwise, 204 ;; Break the association with our parent's environment. Otherwise,
@@ -218,6 +207,11 @@ function), and the arguments passed to this function would be the list
218 (set (make-local-variable 'process-environment) 207 (set (make-local-variable 'process-environment)
219 (eshell-copy-environment))) 208 (eshell-copy-environment)))
220 209
210 ;; This is supposedly run after enabling esh-mode, when eshell-command-map
211 ;; already exists.
212 (defvar eshell-command-map)
213 (define-key eshell-command-map [(meta ?v)] 'eshell-insert-envvar)
214
221 (set (make-local-variable 'eshell-special-chars-inside-quoting) 215 (set (make-local-variable 'eshell-special-chars-inside-quoting)
222 (append eshell-special-chars-inside-quoting '(?$))) 216 (append eshell-special-chars-inside-quoting '(?$)))
223 (set (make-local-variable 'eshell-special-chars-outside-quoting) 217 (set (make-local-variable 'eshell-special-chars-outside-quoting)