tools/eval: fix window-live-p error on eval-and-replace

Caused because the quickrun window adjustment hooks assume quickrun will
always spawn a results buffer, but in the case of eval-and-replace, it
doesn't.
This commit is contained in:
Henrik Lissner 2019-05-17 15:59:49 -04:00
parent 32f8fa9f46
commit ec240d0bfa
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -25,14 +25,15 @@
(defun +eval|quickrun-shrink-window ()
"Shrink the quickrun output window once code evaluation is complete."
(with-selected-window (get-buffer-window quickrun--buffer-name)
(let ((ignore-window-parameters t))
(shrink-window-if-larger-than-buffer))))
(when-let* ((win (get-buffer-window quickrun--buffer-name)))
(with-selected-window (get-buffer-window quickrun--buffer-name)
(let ((ignore-window-parameters t))
(shrink-window-if-larger-than-buffer)))))
(add-hook 'quickrun-after-run-hook #'+eval|quickrun-shrink-window)
(defun +eval|quickrun-scroll-to-bof ()
"Ensures window is scrolled to BOF on invocation."
(with-selected-window (get-buffer-window quickrun--buffer-name)
(goto-char (point-min))))
(when-let* ((win (get-buffer-window quickrun--buffer-name)))
(with-selected-window win
(goto-char (point-min)))))
(add-hook 'quickrun-after-run-hook #'+eval|quickrun-scroll-to-bof))