Improve interactive bin/doom commands #1220
Now prints to a buffer rather than in echo-area. Still experimental however.
This commit is contained in:
parent
66d75936fc
commit
bb9cbfecc9
1 changed files with 32 additions and 9 deletions
|
@ -3,17 +3,40 @@
|
||||||
(require 'core-cli)
|
(require 'core-cli)
|
||||||
|
|
||||||
(defun doom--run (command &optional yes)
|
(defun doom--run (command &optional yes)
|
||||||
(let ((default-directory doom-emacs-dir)
|
(let* ((default-directory doom-emacs-dir)
|
||||||
(doom-auto-accept yes))
|
(doom-auto-accept yes)
|
||||||
(let ((compilation-buffer-name-function (lambda (_) "*bin/doom*")))
|
(buf (get-buffer-create " *bin/doom*"))
|
||||||
(compile (format "bin/doom %s" command) t))
|
(wconf (current-window-configuration))
|
||||||
(while compilation-in-progress
|
(noninteractive t)
|
||||||
(sit-for 1))
|
(ignore-window-parameters t)
|
||||||
(when (y-or-n-p "Reload Doom config?")
|
(standard-output
|
||||||
(doom/reload))
|
(lambda (char)
|
||||||
(message "Done")))
|
(with-current-buffer buf
|
||||||
|
(insert char)
|
||||||
|
(when (memq char '(?\n ?\r))
|
||||||
|
(ansi-color-apply-on-region (line-beginning-position -1) (line-end-position))
|
||||||
|
(redisplay))))))
|
||||||
|
(delete-other-windows)
|
||||||
|
(switch-to-buffer buf)
|
||||||
|
(redisplay)
|
||||||
|
(cl-letf (((symbol-function 'message)
|
||||||
|
(lambda (message &rest args)
|
||||||
|
(princ (apply #'format message args))
|
||||||
|
(terpri))))
|
||||||
|
(doom-dispatch command nil))
|
||||||
|
(print! (green "Done!"))
|
||||||
|
(redisplay)
|
||||||
|
(when (y-or-n-p "Return to your work?")
|
||||||
|
(set-window-configuration wconf)
|
||||||
|
(kill-buffer buf))))
|
||||||
|
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun doom//autoloads (&optional yes)
|
||||||
|
"TODO"
|
||||||
|
(interactive "P")
|
||||||
|
(doom--run "autoloads" yes))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom//update (&optional yes)
|
(defun doom//update (&optional yes)
|
||||||
"TODO"
|
"TODO"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue