]> git.eshelyaron.com Git - emacs.git/commitdiff
Make ediff offer to create files it's inferring
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 9 Dec 2020 12:50:06 +0000 (13:50 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 9 Dec 2020 13:52:53 +0000 (14:52 +0100)
* lisp/vc/ediff-ptch.el (ediff-fixup-patch-map): Offer to create
the inferred file name (if it doesn't exist) (bug#8009).  This allows
applying a patch that creates a file.

lisp/vc/ediff-ptch.el

index 08640fcece9c8bbeee4e80d98d9d5e039e57696d..580d48880bd7006faf837a75db99d63212369cde 100644 (file)
@@ -465,6 +465,9 @@ are two possible targets for this %spatch.  However, these files do not exist."
                                     file1 file2 (if multi-patch-p "multi-" ""))))
                    (princ "
 \nPlease enter an alternative patch target ...\n"))
+                  (when (and (string= file1 file2)
+                             (y-or-n-p (format "Create %s?" file1)))
+                    (write-region (point-min) (point-min) file1))
                  (let ((directory t)
                        target)
                    (while directory