From 08976dafdd1599441fb180164a606baeda374c65 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 28 Mar 2018 17:32:35 -0400 Subject: [PATCH] tools/eshell: fix +eshell/switch --- modules/tools/eshell/autoload/eshell.el | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/tools/eshell/autoload/eshell.el b/modules/tools/eshell/autoload/eshell.el index 9e12ca993..71e40319b 100644 --- a/modules/tools/eshell/autoload/eshell.el +++ b/modules/tools/eshell/autoload/eshell.el @@ -201,12 +201,13 @@ delete." (defun +eshell/switch (buffer) "Interactively switch to another eshell buffer." (interactive - (if (ring-empty-p +eshell-buffers) - (user-error "No eshell buffers are available") - (list (completing-read - "Eshell buffers" - (mapc #'buffer-name (delete (current-buffer) (ring-elements +eshell-buffers))) - #'get-buffer - 'require-match - nil nil (buffer-name (current-buffer)))))) + (let ((buffers (delete (current-buffer) (ring-elements +eshell-buffers)))) + (if buffers + (user-error "No eshell buffers are available") + (list (completing-read + "Eshell buffers" + (mapcar #'buffer-name buffers) + #'get-buffer + 'require-match + nil nil (buffer-name (current-buffer))))))) (switch-to-buffer buffer))