@@ -271,7 +271,7 @@ one from the minibuffer, and move to the next line."
271
271
(" RET" " Show" magit-stgit-show)]
272
272
[(" e" " Edit" magit-stgit-edit)
273
273
(" n" " Rename" magit-stgit-rename)
274
- (" k" " Delete" magit-stgit-delete-popup )]
274
+ (" k" " Delete" magit-stgit-delete)]
275
275
[(" m" " Mail patches" magit-stgit-mail-popup)]])
276
276
277
277
;;;### autoload
@@ -502,37 +502,40 @@ and ask whether to update the remote first."
502
502
(message " Updating remote...done " ))
503
503
(magit-run-stgit " rebase" args (format " remotes/%s /%s " remote branch)))
504
504
505
- (magit-define-popup magit-stgit-delete-popup
506
- " Popup console for StGit delete."
507
- 'magit-stgit-commands
508
- :switches '((?s " Spill patch contents to worktree and index" " --spill" ))
509
- :actions '((?k " Delete" magit-stgit-delete))
510
- :default-action #'magit-stgit-delete )
505
+ (transient-define-prefix magit-stgit-delete ()
506
+ " Delete a set of patches."
507
+ :man-page " stg-delete"
508
+ [" Arguments"
509
+ (" -s" " Spill patch contents to worktree and index" " --spill" )]
510
+ [" Actions"
511
+ (" k" " Delete" magit-stgit--delete)])
511
512
512
513
;;;### autoload
513
- (defun magit-stgit-delete (patches &rest args )
514
- " Delete StGit patches .
515
- Argument PATCHES is a list of patchnames.
516
- Use ARGS to pass additional arguments. "
517
- ( interactive ( list (magit-stgit-read-patches t t t t " Delete patch " )
518
- (magit-stgit-delete-arguments)))
519
- (let ((affected-files
520
- (-mapcat ( lambda ( patch )
521
- ( magit-stgit-lines " files" " --bare" patch) )
522
- patches) ))
523
- ( when (and (called-interactively-p 'any )
524
- (not magit -current-popup )
525
- ( and affected-files ( y-or-n-p " Spill contents? " )))
526
- ( setq args ( append args ( list " --spill " ))) ))
527
- ( let ((spill ( member " --spill" args)) )
528
- ( when spill
529
- ( setq spill ( list " --spill" )))
514
+ (defun magit-stgit-- delete (patches &rest args )
515
+ " Invoke `stg delete ARGS... PATCHES...' .
516
+
517
+ If called interactively, delete the patches around point or read
518
+ one from the minibuffer. Ask whether to spill the contents and
519
+ ask for confirmation before deleting. "
520
+ (interactive ( cons (magit-stgit-read-patches t t t t " Delete patch " )
521
+ (transient-args 'magit-stgit-delete )) )
522
+ ( let* ((non-empty-p (-some (-cut magit-stgit-lines " files" " --bare" < > )
523
+ patches))
524
+ (args ( if (and (called-interactively-p 'any )
525
+ (not transient -current-prefix )
526
+ non-empty-p
527
+ ( y-or-n-p " Spill contents? " ))
528
+ ( cons " --spill" args)
529
+ args))
530
+ (spillp ( member " --spill" args )))
530
531
(when (or (not (called-interactively-p 'any ))
531
- (yes-or-no-p (format " Delete%s patch%s %s ? "
532
- (if spill " and spill" " " )
533
- (if (> (length patches) 1 ) " es" " " )
534
- (mapconcat (lambda (patch ) (format " `%s' " patch)) patches " , " ))))
535
- (magit-run-stgit-and-mark-remove patches " delete" args " --" patches))))
532
+ (yes-or-no-p
533
+ (format " Delete%s patch%s %s ? "
534
+ (if spillp " and spill" " " )
535
+ (if (> (length patches) 1 ) " es" " " )
536
+ (mapconcat (lambda (patch ) (format " `%s' " patch))
537
+ patches " , " ))))
538
+ (magit-run-stgit-and-mark-remove patches " delete" args patches))))
536
539
537
540
(magit-define-popup magit-stgit-goto-popup
538
541
" Popup console for StGit goto."
@@ -694,7 +697,7 @@ the To, Cc, and Bcc fields for all patches."
694
697
:help " Permanently store the base patch into the stack base" ]
695
698
[" Uncommit patch" magit-stgit-uncommit
696
699
:help " Turn a regular commit into an StGit patch" ]
697
- [" Delete patch" magit-stgit-delete-popup
700
+ [" Delete patch" magit-stgit-delete
698
701
:help " Delete an StGit patch" ]
699
702
" ---"
700
703
[" Float patch" magit-stgit-float
@@ -723,7 +726,7 @@ the To, Cc, and Bcc fields for all patches."
723
726
724
727
(defvar magit-stgit-patch-section-map
725
728
(let ((map (make-sparse-keymap )))
726
- (define-key map " k" 'magit-stgit-delete )
729
+ (define-key map " k" # 'magit-stgit- -delete )
727
730
(define-key map " a" 'magit-stgit-goto )
728
731
(define-key map (kbd " RET" ) #'magit-stgit-show )
729
732
(define-key map " #" #'magit-stgit-mark-toggle )
0 commit comments