aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-04-05 19:43:26 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-04-05 19:43:26 +0100
commit86fdf93e34b52872c7ce1d733b972d0736850891 (patch)
treeaa7ccf4625a0a81ae66d76f55ff3098add484ea3
parent242bcaf64c3ec052855ca88b370421aa882a1a0f (diff)
downloaddotfiles-86fdf93e34b52872c7ce1d733b972d0736850891.tar.gz
dotfiles-86fdf93e34b52872c7ce1d733b972d0736850891.tar.bz2
dotfiles-86fdf93e34b52872c7ce1d733b972d0736850891.zip
Fix some bugs with +eshell/open
-rw-r--r--Emacs/.config/emacs/elisp/eshell-additions.el21
1 files changed, 16 insertions, 5 deletions
diff --git a/Emacs/.config/emacs/elisp/eshell-additions.el b/Emacs/.config/emacs/elisp/eshell-additions.el
index 5e637c2..a9362db 100644
--- a/Emacs/.config/emacs/elisp/eshell-additions.el
+++ b/Emacs/.config/emacs/elisp/eshell-additions.el
@@ -80,24 +80,35 @@ Otherwise, create an instance with the name given.
If `arg' is non nil, then always prompt user to select an instance."
(interactive "P")
- (let ((current-instances (+eshell/--current-instances)))
+ (let ((current-instances (+eshell/--current-instances))
+ (buffer nil))
(cond
((and (null current-instances)
(null arg))
- (eshell))
+ (setq buffer (eshell)))
((and (= (length current-instances) 1)
(null arg))
+ (setq buffer (cdar current-instances))
(switch-to-buffer (cdar current-instances)))
(t
(let* ((answer (completing-read "Enter name: " (mapcar #'car current-instances)))
(result (assoc answer current-instances)))
(cond
- (result (switch-to-buffer (cdr result)))
+ (result (switch-to-buffer (cdr result))
+ (setq buffer (cdr result)))
((not (string= answer ""))
(let ((eshell-buffer-name (format "*%s-eshell*" answer)))
- (eshell nil)))
+ (setq buffer (eshell nil))))
(t
- (eshell))))))))
+ (setq buffer (eshell)))))))
+ (if (and (consp arg) (> (car arg) 4))
+ (with-current-buffer buffer
+ (thread-last (read-file-name "Enter directory: ")
+ file-name-directory
+ list
+ eshell/cd)
+ (eshell-send-input)))
+ buffer))
(provide 'eshell-additions)
;;; eshell-additions.el ends here