mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-18 16:06:56 -05:00
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.
This commit is contained in:
@@ -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))
|
||||
|
Reference in New Issue
Block a user