2019-04-21 19:59:44 -04:00
|
|
|
;;; tools/eval/config.el -*- lexical-binding: t; -*-
|
2017-02-13 16:57:08 -05:00
|
|
|
|
2017-03-04 18:28:51 -05:00
|
|
|
;; remove ellipsis when printing sexps in message buffer
|
|
|
|
(setq eval-expression-print-length nil
|
|
|
|
eval-expression-print-level nil)
|
2017-02-13 16:57:08 -05:00
|
|
|
|
2017-05-07 02:27:54 +02:00
|
|
|
|
2018-05-14 01:22:33 +02:00
|
|
|
;;
|
2018-09-07 19:36:16 -04:00
|
|
|
;; Packages
|
2017-02-13 16:57:08 -05:00
|
|
|
|
2018-10-19 21:58:41 -04:00
|
|
|
(after! quickrun
|
2018-01-08 16:18:16 -05:00
|
|
|
(setq quickrun-focus-p nil)
|
|
|
|
|
2018-06-18 02:26:05 +02:00
|
|
|
(set-popup-rule! "^\\*quickrun" :size 0.3 :ttl 0)
|
2017-02-13 16:57:08 -05:00
|
|
|
|
2017-03-04 18:28:51 -05:00
|
|
|
(defun +eval*quickrun-auto-close (&rest _)
|
2017-02-28 12:12:09 -05:00
|
|
|
"Allows us to silently re-run quickrun from within the quickrun buffer."
|
2017-12-10 14:49:52 -05:00
|
|
|
(when-let* ((win (get-buffer-window quickrun--buffer-name)))
|
2017-03-04 18:28:51 -05:00
|
|
|
(let ((inhibit-message t))
|
|
|
|
(quickrun--kill-running-process)
|
2017-02-13 16:57:08 -05:00
|
|
|
(message ""))
|
2017-03-04 18:28:51 -05:00
|
|
|
(delete-window win)))
|
2017-04-17 02:17:10 -04:00
|
|
|
(advice-add #'quickrun :before #'+eval*quickrun-auto-close)
|
|
|
|
(advice-add #'quickrun-region :before #'+eval*quickrun-auto-close)
|
2017-02-13 16:57:08 -05:00
|
|
|
|
2018-12-06 15:58:35 -05:00
|
|
|
(defun +eval|quickrun-shrink-window ()
|
|
|
|
"Shrink the quickrun output window once code evaluation is complete."
|
2019-05-17 15:59:49 -04:00
|
|
|
(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)))))
|
2018-12-06 15:58:35 -05:00
|
|
|
(add-hook 'quickrun-after-run-hook #'+eval|quickrun-shrink-window)
|
|
|
|
|
|
|
|
(defun +eval|quickrun-scroll-to-bof ()
|
|
|
|
"Ensures window is scrolled to BOF on invocation."
|
2019-05-17 15:59:49 -04:00
|
|
|
(when-let* ((win (get-buffer-window quickrun--buffer-name)))
|
|
|
|
(with-selected-window win
|
|
|
|
(goto-char (point-min)))))
|
2017-04-17 02:17:10 -04:00
|
|
|
(add-hook 'quickrun-after-run-hook #'+eval|quickrun-scroll-to-bof))
|