From db42ad1a171b00132b0d3228b737e2631c4b6fd9 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 6 Nov 2020 16:40:57 -0800 Subject: [PATCH] =?UTF-8?q?Fix=20adding=20=E2=80=98C-c=20b=E2=80=99=20to?= =?UTF-8?q?=20the=20eshell=20keymap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ‘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. --- oni-eshell.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/oni-eshell.el b/oni-eshell.el index 7f8e9ed..71f1e31 100644 --- a/oni-eshell.el +++ b/oni-eshell.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; 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))