;; `same-window-buffer-names', which is done when Eshell is loaded
(assert (and buf (buffer-live-p buf)))
(pop-to-buffer buf)
- (unless (fboundp 'eshell-mode)
+ (if (fboundp 'eshell-mode)
+ (unless (eq major-mode 'eshell-mode)
+ (eshell-mode))
(error "`eshell-auto' must be loaded before Eshell can be used"))
- (unless (eq major-mode 'eshell-mode)
- (eshell-mode))
- (assert (eq major-mode 'eshell-mode))
buf))
(defun eshell-return-exits-minibuffer ()