]> git.eshelyaron.com Git - emacs.git/commitdiff
Use defvar-keymap in eshell
authorStefan Kangas <stefan@marxist.se>
Thu, 23 Dec 2021 18:03:53 +0000 (19:03 +0100)
committerStefan Kangas <stefan@marxist.se>
Fri, 24 Dec 2021 14:36:48 +0000 (15:36 +0100)
* lisp/eshell/em-cmpl.el (eshell-cmpl-mode-map):
* lisp/eshell/em-hist.el (eshell-isearch-map, eshell-hist-mode-map):
* lisp/eshell/em-pred.el (eshell-pred-mode-map):
* lisp/eshell/em-prompt.el (eshell-prompt-mode-map):
* lisp/eshell/em-rebind.el (eshell-rebind-mode-map):
* lisp/eshell/esh-arg.el (eshell-arg-mode-map):
* lisp/eshell/esh-mode.el (eshell-mode-map, eshell-command-map):
* lisp/eshell/esh-proc.el (eshell-proc-mode-map):
* lisp/eshell/esh-var.el (eshell-var-mode-map): Use defvar-keymap.

lisp/eshell/em-cmpl.el
lisp/eshell/em-hist.el
lisp/eshell/em-pred.el
lisp/eshell/em-prompt.el
lisp/eshell/em-rebind.el
lisp/eshell/esh-arg.el
lisp/eshell/esh-mode.el
lisp/eshell/esh-proc.el
lisp/eshell/esh-var.el

index 4fd0afbeb8828bdfb0d69fd0ddc79b6cd3532167..8afc57bd75edcef0fb0c8cd7d88ede26ad5fc58e 100644 (file)
@@ -226,19 +226,17 @@ to writing a completion function."
   (let ((completion-at-point-functions '(elisp-completion-at-point)))
     (completion-at-point)))
 
-(defvar eshell-cmpl-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [(control ?i)] #'completion-at-point)
-    ;; jww (1999-10-19): Will this work on anything but X?
-    (define-key map [backtab] #'pcomplete-reverse)
-    (define-key map [(meta ??)] #'completion-help-at-point)
-    (define-key map [(meta control ?i)] #'eshell-complete-lisp-symbol)
-    ;; C-c prefix:
-    (define-key map (kbd "C-c M-h") #'eshell-completion-help)
-    (define-key map (kbd "C-c TAB") #'pcomplete-expand-and-complete)
-    (define-key map (kbd "C-c C-i") #'pcomplete-expand-and-complete)
-    (define-key map (kbd "C-c SPC") #'pcomplete-expand)
-    map))
+(defvar-keymap eshell-cmpl-mode-map
+  "C-i"       #'completion-at-point
+  ;; jww (1999-10-19): Will this work on anything but X?
+  "<backtab>" #'pcomplete-reverse
+  "M-?"       #'completion-help-at-point
+  "C-M-i"     #'eshell-complete-lisp-symbol
+  ;; C-c prefix:
+  "C-c M-h"   #'eshell-completion-help
+  "C-c TAB"   #'pcomplete-expand-and-complete
+  "C-c C-i"   #'pcomplete-expand-and-complete
+  "C-c SPC"   #'pcomplete-expand)
 
 (define-minor-mode eshell-cmpl-mode
   "Minor mode that provides a keymap when `eshell-cmpl' active.
index 4e7cccc0b552aa04df237c49f27b7c9a103010d8..df342df461f5a26ca9c3c369f57e86127a3b1d3e 100644 (file)
@@ -199,31 +199,28 @@ element, regardless of any text on the command line.  In that case,
 (defvar eshell-matching-input-from-input-string "")
 (defvar eshell-save-history-index nil)
 
-(defvar eshell-isearch-map
-  (let ((map (copy-keymap isearch-mode-map)))
-    (define-key map [(control ?m)] 'eshell-isearch-return)
-    (define-key map [(control ?r)] 'eshell-isearch-repeat-backward)
-    (define-key map [(control ?s)] 'eshell-isearch-repeat-forward)
-    (define-key map [(control ?g)] 'eshell-isearch-abort)
-    (define-key map [backspace] 'eshell-isearch-delete-char)
-    (define-key map [delete] 'eshell-isearch-delete-char)
-    (define-key map "\C-c\C-c" 'eshell-isearch-cancel)
-    map)
-  "Keymap used in isearch in Eshell.")
-
-(defvar eshell-hist-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [up] #'eshell-previous-matching-input-from-input)
-    (define-key map [down] #'eshell-next-matching-input-from-input)
-    (define-key map [(control up)] #'eshell-previous-input)
-    (define-key map [(control down)] #'eshell-next-input)
-    (define-key map [(meta ?r)] #'eshell-previous-matching-input)
-    (define-key map [(meta ?s)] #'eshell-next-matching-input)
-    (define-key map (kbd "C-c M-r") #'eshell-previous-matching-input-from-input)
-    (define-key map (kbd "C-c M-s") #'eshell-next-matching-input-from-input)
-    (define-key map (kbd "C-c C-l") #'eshell-list-history)
-    (define-key map (kbd "C-c C-x") #'eshell-get-next-from-history)
-    map))
+(defvar-keymap eshell-isearch-map
+  :doc "Keymap used in isearch in Eshell."
+  :parent isearch-mode-map
+  "C-m"         #'eshell-isearch-return
+  "C-r"         #'eshell-isearch-repeat-backward
+  "C-s"         #'eshell-isearch-repeat-forward
+  "C-g"         #'eshell-isearch-abort
+  "<backspace>" #'eshell-isearch-delete-char
+  "<delete>"    #'eshell-isearch-delete-char
+  "C-c C-c"     #'eshell-isearch-cancel)
+
+(defvar-keymap eshell-hist-mode-map
+  "<up>"     #'eshell-previous-matching-input-from-input
+  "<down>"   #'eshell-next-matching-input-from-input
+  "C-<up>"   #'eshell-previous-input
+  "C-<down>" #'eshell-next-input
+  "M-r"      #'eshell-previous-matching-input
+  "M-s"      #'eshell-next-matching-input
+  "C-c M-r"  #'eshell-previous-matching-input-from-input
+  "C-c M-s"  #'eshell-next-matching-input-from-input
+  "C-c C-l"  #'eshell-list-history
+  "C-c C-x"  #'eshell-get-next-from-history)
 ;; Update `eshell-hist-mode-map' for `eshell-hist-match-partial'.
 (eshell-hist--update-keymap 'eshell-hist-match-partial
                             eshell-hist-match-partial)
index 75a803d3ad464d50c847a7c1660590e722547ed3..fc41bb82980b53b37c4ec05f943f446b6bc11e95 100644 (file)
@@ -225,11 +225,9 @@ FOR LISTS OF ARGUMENTS:
 EXAMPLES:
   *.c(:o)  sorted list of .c files")
 
-(defvar eshell-pred-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-q") #'eshell-display-predicate-help)
-    (define-key map (kbd "C-c M-m") #'eshell-display-modifier-help)
-    map))
+(defvar-keymap eshell-pred-mode-map
+  "C-c M-q" #'eshell-display-predicate-help
+  "C-c M-m" #'eshell-display-modifier-help)
 
 ;;; Functions:
 
index aa96166087acf4f097c635e4191c30ef866c3933..6a4c05d34f8278c973009b177bb6954d55edcb31 100644 (file)
@@ -96,11 +96,9 @@ arriving, or after."
   :options '(eshell-show-maximum-output)
   :group 'eshell-prompt)
 
-(defvar eshell-prompt-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c C-n") #'eshell-next-prompt)
-    (define-key map (kbd "C-c C-p") #'eshell-previous-prompt)
-    map))
+(defvar-keymap eshell-prompt-mode-map
+  "C-c C-n" #'eshell-next-prompt
+  "C-c C-p" #'eshell-previous-prompt)
 
 ;;; Functions:
 
index d70444ea1095455c9e24b65a5fe7cf738d184da2..d24cfb3f429ea03b70ec0869dd91aa788e8a353a 100644 (file)
@@ -136,10 +136,8 @@ This is default behavior of shells like bash."
   :type '(repeat function)
   :group 'eshell-rebind)
 
-(defvar eshell-rebind-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-l") #'eshell-lock-local-map)
-    map))
+(defvar-keymap eshell-rebind-mode-map
+  "C-c M-l" #'eshell-lock-local-map)
 
 ;; Internal Variables:
 
index 1990c0cfa558bbdccb308ebe29267c2dd9189704..907625a554db3393a230006f79a155498c58ab90 100644 (file)
@@ -152,10 +152,8 @@ treated as a literal character."
   :type 'hook
   :group 'eshell-arg)
 
-(defvar eshell-arg-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-b") #'eshell-insert-buffer-name)
-    map))
+(defvar-keymap eshell-arg-mode-map
+  "C-c M-b" #'eshell-insert-buffer-name)
 
 ;;; Functions:
 
index cae5236d89447e11271e49871b52faf2170a7e4b..7d176f4ea07dd9659b2aa1e604a4c09740b70b9e 100644 (file)
@@ -260,31 +260,28 @@ 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))
+(defvar-keymap eshell-mode-map
+  "C-c"   'eshell-command-map
+  "RET"   #'eshell-send-input
+  "M-RET" #'eshell-queue-input
+  "C-M-l" #'eshell-show-output
+  "C-a"   #'eshell-bol)
+
+(defvar-keymap eshell-command-map
+  :prefix 'eshell-command-map
+  "M-o" #'eshell-mark-output
+  "M-d" #'eshell-toggle-direct-send
+  "C-a" #'eshell-bol
+  "C-b" #'eshell-backward-argument
+  "C-e" #'eshell-show-maximum-output
+  "C-f" #'eshell-forward-argument
+  "C-m" #'eshell-copy-old-input
+  "C-o" #'eshell-kill-output
+  "C-r" #'eshell-show-output
+  "C-t" #'eshell-truncate-buffer
+  "C-u" #'eshell-kill-input
+  "C-w" #'backward-kill-word
+  "C-y" #'eshell-repeat-argument)
 
 ;;; User Functions:
 
index 7a0b26a065884390e6b73689f2ba66d21138c0ac..75f3872d755b88ff3fe52d5566e4ae88972b7910 100644 (file)
@@ -101,15 +101,13 @@ information, for example."
 (defvar eshell-process-list nil
   "A list of the current status of subprocesses.")
 
-(defvar eshell-proc-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-i") #'eshell-insert-process)
-    (define-key map (kbd "C-c C-c") #'eshell-interrupt-process)
-    (define-key map (kbd "C-c C-k") #'eshell-kill-process)
-    (define-key map (kbd "C-c C-d") #'eshell-send-eof-to-process)
-    (define-key map (kbd "C-c C-s") #'list-processes)
-    (define-key map (kbd "C-c C-\\") #'eshell-quit-process)
-    map))
+(defvar-keymap eshell-proc-mode-map
+  "C-c M-i"  #'eshell-insert-process
+  "C-c C-c"  #'eshell-interrupt-process
+  "C-c C-k"  #'eshell-kill-process
+  "C-c C-d"  #'eshell-send-eof-to-process
+  "C-c C-s"  #'list-processes
+  "C-c C-\\" #'eshell-quit-process)
 
 ;;; Functions:
 
index fa9853ae00a1befe5362df21106d6bd76a9c190c..9aa50f2bd0f930c5731dcd38a9af5a1421f9b2fe 100644 (file)
@@ -209,10 +209,8 @@ environment of created subprocesses."
 
 (put 'eshell-variable-aliases-list 'risky-local-variable t)
 
-(defvar eshell-var-mode-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "C-c M-v") #'eshell-insert-envvar)
-    map))
+(defvar-keymap eshell-var-mode-map
+  "C-c M-v" #'eshell-insert-envvar)
 
 ;;; Functions: