emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/debbugs c8e3100 302/311: If there are multiple patches,


From: Stefan Monnier
Subject: [elpa] externals/debbugs c8e3100 302/311: If there are multiple patches, collect the .rej from all of them
Date: Sun, 29 Nov 2020 18:42:34 -0500 (EST)

branch: externals/debbugs
commit c8e310060c2807d2404430f1547c99a4c1418fb3
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    If there are multiple patches, collect the .rej from all of them
---
 debbugs-gnu.el | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/debbugs-gnu.el b/debbugs-gnu.el
index 4516423..f2179f7 100644
--- a/debbugs-gnu.el
+++ b/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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]