From d67c6e2984e8221f7392ed62a1e3dfb479bff4f0 Mon Sep 17 00:00:00 2001 From: Benson Chu Date: Mon, 27 Feb 2023 21:15:23 -0600 Subject: [PATCH] No interactive prompts in noninteractive mode --- lisp/emacs-custom-load-or-ask.el | 13 ++++++++++--- prompts/default.el | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 prompts/default.el diff --git a/lisp/emacs-custom-load-or-ask.el b/lisp/emacs-custom-load-or-ask.el index 5a73c06..7f2faeb 100644 --- a/lisp/emacs-custom-load-or-ask.el +++ b/lisp/emacs-custom-load-or-ask.el @@ -43,9 +43,16 @@ ec/my-variables-list)) (add-to-list 'ec/my-variables-list (list ',type ,@args)) - (if (or override (not (boundp ,(car args)))) - ,@body - (eval ,(car args))))) + (if (not noninteractive) + (if (or override (not (boundp ,(car args)))) + ,@body + (eval ,(car args))) + (when (not (featurep 'default-prompts)) + (load (expand-file-name "prompts/default.el" + user-emacs-directory)) + (message (format "%s: %s" + ,@(last args) + ,(car args))))))) (defun-prompt ec/load-or-ask-pred predicate (sym prompt) (customize-save-variable sym (y-or-n-p prompt))) diff --git a/prompts/default.el b/prompts/default.el new file mode 100644 index 0000000..715067c --- /dev/null +++ b/prompts/default.el @@ -0,0 +1,18 @@ +(custom-set-variables + '(my-ec/add-info-dir nil t) + '(my-ec/at-ti nil t) + '(my-ec/enable-exwm t t) + '(my-ec/is-wsl nil t) + '(my-ec/load-full-config t t) + '(my-ec/load-org-config t t) + '(my/is-plaintext-mega-folder t t) + '(my/keymap-key "\24" t) + '(my/keymap-key-key 20 t) + '(my/light-default nil t) + '(my/plaintext-mega-folder "/home/benson/MEGA/plaintext/" t) + '(my/plaintext-migration-folder "~/plaintext/" t) + '(my/puppet-p nil t) + '(org-agenda-files + '("/home/benson/plaintext/org/agenda/plan.org" "/home/benson/plaintext/org/agenda/refile.org" "/home/benson/plaintext/org/agenda/sandbox.org" "/home/benson/plaintext/org/agenda/dev.org" "/home/benson/plaintext/org/agenda/prod.org"))) + +(provide 'default-prompts)