Refactor interactiove bin/doom commands #1220
This commit is contained in:
parent
bb9cbfecc9
commit
ca9a2c8c17
|
@ -7,8 +7,8 @@
|
|||
(doom-auto-accept yes)
|
||||
(buf (get-buffer-create " *bin/doom*"))
|
||||
(wconf (current-window-configuration))
|
||||
(noninteractive t)
|
||||
(ignore-window-parameters t)
|
||||
(noninteractive t)
|
||||
(standard-output
|
||||
(lambda (char)
|
||||
(with-current-buffer buf
|
||||
|
@ -16,19 +16,17 @@
|
|||
(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))))
|
||||
(doom-initialize t)
|
||||
(setq doom-modules (doom-modules))
|
||||
(doom-initialize-modules t)
|
||||
(doom-initialize-packages t)
|
||||
(with-current-buffer (switch-to-buffer buf)
|
||||
(erase-buffer)
|
||||
(require 'package)
|
||||
(redisplay)
|
||||
(doom-dispatch command nil)
|
||||
(print! (green "\nDone!"))))
|
||||
(message (format! (green "Done!"))))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
|
|
|
@ -87,8 +87,5 @@ Can be colored using (color ...) blocks:
|
|||
(print! (green \"Great %s!\") \"success\")
|
||||
|
||||
Uses faces in interactive sessions and ANSI codes otherwise."
|
||||
`(if (not noninteractive)
|
||||
(message (format! ,message ,@args))
|
||||
;; princ prints to stdout, message to stderr
|
||||
(princ (format! ,message ,@args))
|
||||
(terpri)))
|
||||
`(progn (princ (format! ,message ,@args))
|
||||
(terpri)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user