1
0
Fork 0

Fix adding ‘C-c b’ to the eshell keymap

‘eshell-mode-map’ isn’t a keymap until after ‘eshell-mode’ has run. It’s defined
as ‘nil’ in the top-level of the ‘esh-mode’ package. ‘nil’ is not a valid keymap
that new keys can be defined into.
This commit is contained in:
Tom Willemse 2020-11-06 16:40:57 -08:00
parent 27bc014a64
commit db42ad1a17

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.1026.133507
;; Version: 2020.1106.164034
;; Package-Requires: (eshell-fringe-status esh-autosuggest xterm-color eshell-syntax-highlighting)
;; This program is free software; you can redistribute it and/or modify
@ -56,9 +56,10 @@
(setq eshell-output-filter-functions
(remove 'eshell-handle-ansi-color eshell-output-filter-functions)))
(defun oni-eshell--set-eshell-C-d ()
(defun oni-eshell--expand-keymap ()
"Set `C-d' to quit eshell if used at end of prompt."
(define-key eshell-mode-map (kbd "C-d") #'oni-eshell--C-d))
(define-key eshell-mode-map (kbd "C-d") #'oni-eshell--C-d)
(define-key eshell-mode-map (kbd "C-c b") #'oni-eshell-goto-buffer-directory))
(defun oni-eshell--set-xterm-variables ()
"Set xterm-color-preserve-properties to t."
@ -81,7 +82,7 @@
(eshell-reset))
(add-hook 'eshell-before-prompt-hook #'oni-eshell--set-xterm-variables)
(add-hook 'eshell-first-time-mode-hook #'oni-eshell--set-eshell-C-d)
(add-hook 'eshell-first-time-mode-hook #'oni-eshell--expand-keymap)
(add-hook 'eshell-load-hook #'oni-eshell--disable-ansi-color-handling)
(add-hook 'eshell-load-hook #'oni-eshell--enable-truncating-buffers)
(add-hook 'eshell-load-hook #'oni-eshell--enable-xterm-filter)
@ -91,8 +92,6 @@
(add-hook 'esh-autosuggest-mode-hook #'oni-eshell-fix-esh-autosuggest-active-keymap)
(define-key eshell-mode-map (kbd "C-c b") #'oni-eshell-goto-buffer-directory)
(when (display-graphic-p)
(add-hook 'eshell-mode-hook 'eshell-fringe-status-mode))