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:
parent
32f8fa9f46
commit
ec240d0bfa
1 changed files with 7 additions and 6 deletions
|
@ -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))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue