feat(emacs-lisp): default ielm working buffer to selected

When invoking `+emacs-lisp/open-repl`, if no working buffer is set in
the resulting ielm buffer, it will default to the selected buffer prior
to opening the repl.
This commit is contained in:
Henrik Lissner
2025-04-13 04:25:23 -04:00
parent d209e519af
commit e096e7d79e

View File

@ -149,14 +149,20 @@ if it's callable, `apropos' otherwise."
;;;###autoload
(defun +emacs-lisp/open-repl ()
"Open the Emacs Lisp REPL (`ielm')."
"Open the Emacs Lisp REPL (`ielm').
If the repl isn't already open, sets ielm's working buffer to the buffer
selected before this command was invoked."
(interactive)
(pop-to-buffer
(or (get-buffer "*ielm*")
(progn (ielm)
(let ((buf (get-buffer "*ielm*")))
(bury-buffer buf)
buf)))))
(let ((original-buffer (current-buffer)))
(ielm)
(when (buffer-live-p original-buffer)
(ielm-change-working-buffer original-buffer))
(let ((buf (get-buffer "*ielm*")))
(bury-buffer buf)
buf)))))
;;;###autoload
(defun +emacs-lisp/buttercup-run-file ()