From a3c9161a8fbb3d0f1eddf5e5716fe0a17c303247 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 5 Aug 2021 12:30:07 -0700 Subject: emacs: rename eshell buffer When creating a new buffer for eshell with `fcuny/eshell-here` rename the buffer using parts of the directory. --- emacs/custom/fcuny-eshell.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'emacs') diff --git a/emacs/custom/fcuny-eshell.el b/emacs/custom/fcuny-eshell.el index 6af78af..4b39d6f 100644 --- a/emacs/custom/fcuny-eshell.el +++ b/emacs/custom/fcuny-eshell.el @@ -17,10 +17,15 @@ buffer's file. The eshell is renamed to match that directory to make multiple eshell windows easier." (interactive) - (let* ((height (/ (window-total-height) 3))) + (let* ((parent (if (buffer-file-name) + (file-name-directory (buffer-file-name)) + default-directory)) + (height (/ (window-total-height) 3)) + (name (car (last (split-string parent "/" t))))) (split-window-vertically (- height)) (other-window 1) (eshell "new") + (rename-buffer (concat "*eshell: " name "*")) (insert (concat "ls")) (eshell-send-input))) -- cgit 1.4.1