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:
parent
4bd59f5ed9
commit
309e322037
1 changed files with 8 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue