From 309e322037fedeed70f648ce47523d44e04386a0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 8 Jan 2020 22:07:34 -0500 Subject: [PATCH] Add (Recommended) after certain straight prompts When a package's worktree is dirty (or its recipe was changed), straight prompts you with options to deal with it. To make it easier for less git savvy folks, the recommended option has been marked. --- core/core-packages.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/core-packages.el b/core/core-packages.el index b6cdf3105..84e691cbc 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -138,6 +138,11 @@ missing) and shouldn't be deleted.") (y-or-n-p (format! "%s" (or prompt ""))) (funcall orig-fn prompt))) +(defvar doom--straight-recommended-options + '("^Delete remote \"[^\"]+\", re-create it with correct " + "^Reset branch " + "^Abort merge$")) + (defadvice! doom--straight-fallback-to-tty-prompt-a (orig-fn prompt actions) "Modifies straight to prompt on the terminal when in noninteractive sessions." :around #'straight--popup-raw @@ -164,6 +169,9 @@ missing) and shouldn't be deleted.") (cl-destructuring-bind (_key desc func) action (when desc (push func options) + (cl-loop for regexp in doom--straight-recommended-options + if (string-match-p regexp desc) + return (setq desc (concat desc " (Recommended)"))) (print! "%2s) %s" (length options) desc))))) (terpri) (let ((options (nreverse options))