From c622bddbc254a6f788275e3a3c036e2322410b17 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Sun, 18 Jun 2017 21:25:56 +0100 Subject: [PATCH] Emacs: Eshell: Document the conflict between eshell/alias and evil-define-key --- .emacs.d/lisp/init-eshell.el | 3 +++ .emacs.d/lisp/init-evil.el | 21 ++------------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/.emacs.d/lisp/init-eshell.el b/.emacs.d/lisp/init-eshell.el index aecdd0d8..7483dedc 100644 --- a/.emacs.d/lisp/init-eshell.el +++ b/.emacs.d/lisp/init-eshell.el @@ -58,6 +58,9 @@ ;;; `eshell/alias' is too slow as it reads and write the file on each definition. ;;; Let's write manually instead. (with-eval-after-load 'em-alias + ;;; TODO: This conflicts with `evil-define-key' during the initialization of + ;;; the first eshell session: the map in insert-mode will not take the changes + ;;; into account. Going to normal mode and back to insert mode works. (eshell-read-aliases-list) (dolist (alias diff --git a/.emacs.d/lisp/init-evil.el b/.emacs.d/lisp/init-evil.el index 1ee69e02..d08c304f 100644 --- a/.emacs.d/lisp/init-evil.el +++ b/.emacs.d/lisp/init-evil.el @@ -218,24 +218,10 @@ See `eshell' for the numeric prefix arg." ;; TODO: Make Evil commands react more dynamically with read-only text. ;; Add support for I, C, D, S, s, c*, d*, R, r. -;; See https://github.com/emacs-evil/evil/issues/852 -(defun evil/eshell-delete-whole-line () - (interactive) - (if (not (get-text-property (line-beginning-position) 'read-only)) - (evil-delete-whole-line (line-beginning-position) (line-end-position)) - (eshell-return-to-prompt) ; Difference with eshell-bol? - (evil-delete-line (point) (line-end-position)))) -;; (evil-define-key 'normal eshell-mode-map "dd" 'evil/eshell-delete-whole-line) -(defun evil/eshell-change-whole-line () - (interactive) - (if (not (get-text-property (line-beginning-position) 'read-only)) - (evil-change-whole-line (line-beginning-position) (line-end-position)) - (eshell-return-to-prompt) ; Difference with eshell-bol? - (evil-change-line (point) (line-end-position)))) -;; (evil-define-key 'normal eshell-mode-map "cc" 'evil/eshell-change-whole-line) +;; See https://github.com/emacs-evil/evil/issues/852. ;; Go-to-definition. -;; From https://emacs.stackexchange.com/questions/608/evil-map-keybindings-the-vim-way +;; From https://emacs.stackexchange.com/questions/608/evil-map-keybindings-the-vim-way. (evil-global-set-key 'normal "gd" (lambda () (interactive) @@ -249,9 +235,6 @@ See `eshell' for the numeric prefix arg." (when (require 'evil-mc nil t) (global-evil-mc-mode 1) (define-key evil-mc-key-map (kbd "C-") 'evil-mc-toggle-cursor-on-click) - ;; Don't shadow evil's standard keys. TODO: Is \C-t ever needed? Evil's normal binding is `pop-tag-mark'. - ;; (evil-define-key '(normal visual) evil-mc-key-map "\C-t" nil) - (set-face-attribute 'evil-mc-cursor-default-face nil :inherit nil :inverse-video nil :box "white") (when (require 'evil-mc-extras nil t) (global-evil-mc-extras-mode 1)))