branch: master commit 6645f73a8850496f17317f3f2d7d5475946fa775 Author: Lars Ingebrigtsen <la...@gnus.org> Commit: Lars Ingebrigtsen <la...@gnus.org>
If there are multiple patches, collect the .rej from all of them --- packages/debbugs/debbugs-gnu.el | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/debbugs/debbugs-gnu.el b/packages/debbugs/debbugs-gnu.el index 4516423..f2179f7 100644 --- a/packages/debbugs/debbugs-gnu.el +++ b/packages/debbugs/debbugs-gnu.el @@ -2421,13 +2421,25 @@ If SELECTIVELY, query the user before applying the patch." (y-or-n-p (format "%s\nApply?" (buffer-substring (point-min) (min 200 (point-max)))))) - (call-process-region (point-min) (point-max) - "patch" nil output-buffer nil - "-r" rej "--no-backup-if-mismatch" - "-l" "-f" - "-d" (expand-file-name - debbugs-gnu-current-directory) - "-p1")))) + (let (old-rej) + (when (file-exists-p rej) + (with-temp-buffer + (insert-file-contents rej) + (setq old-rej (buffer-string))) + (delete-file rej)) + (call-process-region (point-min) (point-max) + "patch" nil output-buffer nil + "-r" rej "--no-backup-if-mismatch" + "-l" "-f" + "-d" (expand-file-name + debbugs-gnu-current-directory) + "-p1") + (when old-rej + (with-temp-buffer + (insert old-rej) + (when (file-exists-p rej) + (insert-file-contents rej)) + (write-region (point-min) (point-max) rej nil 'silent))))))) (set-buffer output-buffer) (when (file-exists-p rej) (goto-char (point-max))