From be907350e42bfaaf6e37101edb351c77e5d4c7ec Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 13 Jun 2019 17:52:52 +0200 Subject: [PATCH] Fix +eshell/toggle with arguments Fixes: - Wrong-type-argument error when failing to display eshell buffer with pop-to-buffer, because it was killed (when prefix arg is non-nil). - Passes non-existent variable `buf` to +eshell-run-command. --- modules/term/eshell/autoload/eshell.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/term/eshell/autoload/eshell.el b/modules/term/eshell/autoload/eshell.el index 0fc939a37..cc0f34641 100644 --- a/modules/term/eshell/autoload/eshell.el +++ b/modules/term/eshell/autoload/eshell.el @@ -92,7 +92,9 @@ project (or if prefix ARG was present)." (when-let (win (get-buffer-window eshell-buffer)) (delete-window win)) (when (buffer-live-p eshell-buffer) - (kill-buffer eshell-buffer))) + (with-current-buffer eshell-buffer + (fundamental-mode) + (erase-buffer)))) (if-let (win (get-buffer-window eshell-buffer)) (if (eq (selected-window) win) (let (confirm-kill-processes) @@ -117,7 +119,7 @@ project (or if prefix ARG was present)." (delete-region (match-end 0) (point-max))) (eshell-send-input)))) (when command - (+eshell-run-command command buf)))))) + (+eshell-run-command command eshell-buffer)))))) ;;;###autoload (defun +eshell/here (arg &optional command)