From: Stefan Bund Date: Tue, 25 Apr 2017 16:10:15 +0000 (+0200) Subject: implement eshell-switch-directory-current-buffer bound to \C-cE X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=bcb103dbc0aa89057d8d0b549f5d4cdb841a6795;p=emacs-init.git implement eshell-switch-directory-current-buffer bound to \C-cE --- diff --git a/setup/eshell.el b/setup/eshell.el index 66fc6bc..1f836ac 100644 --- a/setup/eshell.el +++ b/setup/eshell.el @@ -9,3 +9,17 @@ (define-key eshell-mode-map (kbd "") 'eshell-bol)) (add-hook 'eshell-mode-hook 'my-setup-eshell) + +(defun eshell-switch-directory-current-buffer () + (interactive) + (let ((dir default-directory) + (eshell-buffer (get-buffer "*eshell*"))) + (if (not eshell-buffer) + (error "no *eshell* buffer found")) + (pop-to-buffer (get-buffer "*eshell*")) + (goto-char (point-max)) + (setq default-directory dir) + (insert "\n") + (eshell-send-input))) + +(global-set-key "\C-cE" 'eshell-switch-directory-current-buffer)