[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 31d34e4 2/5: Use defvar-keymap in eshell
From: |
Stefan Kangas |
Subject: |
master 31d34e4 2/5: Use defvar-keymap in eshell |
Date: |
Fri, 24 Dec 2021 10:06:52 -0500 (EST) |
branch: master
commit 31d34e43e54c6c45869562c40711cce6c5e48dab
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
Use defvar-keymap in eshell
* 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 | 24 +++++++++++-------------
lisp/eshell/em-hist.el | 47 ++++++++++++++++++++++-------------------------
lisp/eshell/em-pred.el | 8 +++-----
lisp/eshell/em-prompt.el | 8 +++-----
lisp/eshell/em-rebind.el | 6 ++----
lisp/eshell/esh-arg.el | 6 ++----
lisp/eshell/esh-mode.el | 47 ++++++++++++++++++++++-------------------------
lisp/eshell/esh-proc.el | 16 +++++++---------
lisp/eshell/esh-var.el | 6 ++----
9 files changed, 74 insertions(+), 94 deletions(-)
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index 4fd0afb..8afc57b 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -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.
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 4e7cccc..df342df 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -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)
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index 75a803d..fc41bb8 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -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:
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index aa96166..6a4c05d 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -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:
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el
index d70444e..d24cfb3 100644
--- a/lisp/eshell/em-rebind.el
+++ b/lisp/eshell/em-rebind.el
@@ -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:
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index 1990c0c..907625a 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -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:
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index cae5236..7d176f4 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -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:
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 7a0b26a..75f3872 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -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:
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index fa9853a..9aa50f2 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -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: