diff options
Diffstat (limited to 'git-email.el')
-rw-r--r-- | git-email.el | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/git-email.el b/git-email.el index cef8340..27b6238 100644 --- a/git-email.el +++ b/git-email.el @@ -175,6 +175,15 @@ HERE *** *\"." :group 'git-email :package-version '(git-email . "0.3.0")) +(defcustom git-email-buffer-p-function + #'git-email-buffer-p + "Function used for determining if a buffer contains an unsent +patch based on the buffer name. The function must take one +argument --- the buffer name." + :type 'function + :group 'git-email + :package-version '(git-email . "0.3.0")) + ;; Remove Compiler warnings (declare-function dired-get-filename "dired.el") (declare-function dired-map-over-marks "dired.el") @@ -465,6 +474,13 @@ default behavior is to delete them after sending the message." (generate-new-buffer-name (concat "*git-email unsent patch to " address " *" ))) +(defun git-email-buffer-p (name) + "Check whether a buffer is contains an unsent patch based on its +NAME." + (if (string-match "git-email-unsent-patch" name) + t + nil)) + ;;;; Operate on emails @@ -480,14 +496,17 @@ default behavior is to delete them after sending the message." (> old new)))) (defun git-email-send-all () - "Send all unsent emails." + "Send all unsent patches." (interactive) ;; Sort the buffers so that [PATCH 0/N] comes first, this prevents ;; the ordering from getting messed up. - (let ((buffers (sort (message-buffers) #'git-email-message-buffer-greaterp))) - (mapc (lambda (b) (switch-to-buffer b) + (let* ((message-buffers (seq-filter #'git-email-buffer-p + (message-buffers)) ) + (sorted-buffers (sort message-buffers #'git-email-message-buffer-greaterp))) + (mapc (lambda (b) + (switch-to-buffer b) (funcall git-email-send-email-function)) - buffers))) + sorted-buffers))) (defun git-email--rewrite-header-in-buffer (buffer header value append) (switch-to-buffer buffer) |