Skip to content

Commit b1452ca

Browse files
author
Lluís Vilanova
committed
magit-run-stgit-async: Refactor asynchronous execution with editor
1 parent 30422dd commit b1452ca

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

magit-stgit.el

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,15 @@
139139
Any list in ARGS is flattened."
140140
(magit-run-stgit-callback (lambda ()) args))
141141

142+
(defun magit-run-stgit-async (&rest args)
143+
"Asynchronously run StGit command with given arguments.
144+
Any list in ARGS is flattened."
145+
(with-editor "GIT_EDITOR"
146+
(let ((magit-process-popup-time -1))
147+
(message "Running %s %s" magit-stgit-executable
148+
(mapconcat 'identity (-flatten args) " "))
149+
(apply #'magit-start-process magit-stgit-executable nil (-flatten args)))))
150+
142151
(defun magit-run-stgit-and-mark-remove (patches &rest args)
143152
"Run `magit-run-stgit' and `magit-stgit-mark-remove'.
144153
Argument PATCHES sets the marks to remove, and ARGS the arguments to StGit."
@@ -295,12 +304,7 @@ Else, asks the user for a patch name."
295304
"Create a new StGit patch.
296305
Use ARGS to pass additional arguments."
297306
(interactive (magit-stgit-new-arguments))
298-
(with-editor "GIT_EDITOR"
299-
(let ((magit-process-popup-time -1))
300-
(message "Running %s %s" magit-git-executable
301-
(mapconcat 'identity (-flatten (list "new" args)) " "))
302-
(apply #'magit-start-process magit-stgit-executable nil
303-
"new" args))))
307+
(magit-run-stgit-async "new" args))
304308

305309
(magit-define-popup magit-stgit-float-popup
306310
"Popup console for StGit float."

0 commit comments

Comments
 (0)