1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-30 09:00:31 -08:00

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.
This commit is contained in:
Stefan Kangas 2021-12-23 19:03:53 +01:00
parent 1668a9b91e
commit 31d34e43e5
9 changed files with 72 additions and 92 deletions

View 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)
(defvar-keymap eshell-cmpl-mode-map
"C-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)
"<backtab>" #'pcomplete-reverse
"M-?" #'completion-help-at-point
"C-M-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))
"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.

View 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-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 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-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)

View 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:

View 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:

View 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:

View 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:

View 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-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 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-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:

View 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:

View 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: