I'm creating a window at the bottom of the frame with
display-buffer-in-side-window and it displays a given buffer, I would like to have another buffer created but re-use that exact same window.
How do I do that? I'm keeping track of the value yield by
(defvar tortuga-first-open-window nil "Track the window of the first shell opened.") (defun tortuga-shell () "Open the first terminal at the bottom of the frame." (interactive) (if tortuga-first-open-window (set-window-buffer tortuga-first-open-window (tortuga-shell--create-new)) (select-window (display-buffer-in-side-window (save-window-excursion (tortuga-shell--create-new)) `((side . bottom) (window-height . ,tortuga-first-open-window-height))))) (setq tortuga-first-open-window (get-buffer-window (current-buffer)))) (defun tortuga-shell--create-new () "Create a new eshell." (interactive) (let* ((count (+ 1 (length tortuga-shell-buffer-list))) (new-eshell-buffer (get-buffer-create (format "%s<%d>" eshell-buffer-name count)))) (tortuga-shell-setup new-eshell-buffer) (add-to-list 'tortuga-shell-buffer-list new-eshell-buffer) new-eshell-buffer)) (defun tortuga-shell-setup (buffer) "Setup new buffer BUFFER as eshell buffer." (with-current-buffer buffer (eshell-mode) (add-hook 'kill-buffer-hook #'tortuga-after-kill-buffer nil :local) (local-set-key (kbd tortuga-hydra-start-key) 'tortuga-hydra/body)))