summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-08-05 12:30:07 -0700
committerFranck Cuny <franck@fcuny.net>2021-08-05 12:30:07 -0700
commita3c9161a8fbb3d0f1eddf5e5716fe0a17c303247 (patch)
tree8a58257e3e63c18a69b2d1022f2ecf63490c5813 /emacs
parentemacs: eshell smart display (diff)
downloademacs.d-a3c9161a8fbb3d0f1eddf5e5716fe0a17c303247.tar.gz
emacs: rename eshell buffer
When creating a new buffer for eshell with `fcuny/eshell-here` rename the buffer using parts of the directory.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/custom/fcuny-eshell.el7
1 files changed, 6 insertions, 1 deletions
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)))