Prompt to run setup.sh when non-empty
This commit is contained in:
parent
7d86f39ec6
commit
fb73d85162
27
config.org
27
config.org
|
@ -1422,6 +1422,33 @@ alias m='e --eval "(progn (magit-status) (delete-other-windows))"'
|
|||
alias mt="m -t"
|
||||
alias et="e -t"
|
||||
#+end_src
|
||||
*** Prompt to run setup script
|
||||
|
||||
At various points in this config, content is conditionally tangled to
|
||||
=./setup.sh=. It's no good just putting content there if it isn't run though.
|
||||
To help remind me to run it when needed, let's add a little prompt when there's
|
||||
anything to be run.
|
||||
|
||||
#+name: run-setup
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(if (string-empty-p (string-trim (with-temp-buffer (insert-file-contents "setup.sh") (buffer-string)) "#!/bin/bash"))
|
||||
(message ";; Setup script is empty")
|
||||
(message ";; Detected content in the setup script")
|
||||
(pp-to-string
|
||||
`(unless noninteractive
|
||||
(defun +config-run-setup ()
|
||||
(when (yes-or-no-p (format "%s The setup script has content. Check and run the script?"
|
||||
(propertize "Warning!" 'face '(bold warning))))
|
||||
(find-file (expand-file-name "setup.sh" doom-private-dir))
|
||||
(when (yes-or-no-p "Would you like to run this script?")
|
||||
(async-shell-command "./setup.sh"))))
|
||||
(add-hook! 'doom-init-ui-hook
|
||||
(run-at-time nil nil #'+config-run-setup)))))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp :noweb no-export
|
||||
<<run-setup()>>
|
||||
#+end_src
|
||||
|
||||
* Packages
|
||||
** Loading instructions
|
||||
|
|
Loading…
Reference in New Issue