aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/diff-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/diff-mode.el')
-rw-r--r--lisp/diff-mode.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index 16bdaf152f7..01b3a5949f2 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -1259,6 +1259,7 @@ SWITCHED is non-nil if the patch is already applied."
1259 (t "Hunk %s at offset %d lines")) 1259 (t "Hunk %s at offset %d lines"))
1260 msg line-offset))) 1260 msg line-offset)))
1261 1261
1262(defvar diff-apply-hunk-to-backup-file nil)
1262 1263
1263(defun diff-apply-hunk (&optional reverse) 1264(defun diff-apply-hunk (&optional reverse)
1264 "Apply the current hunk to the source file and go to the next. 1265 "Apply the current hunk to the source file and go to the next.
@@ -1275,6 +1276,17 @@ With a prefix argument, REVERSE the hunk."
1275 (cond 1276 (cond
1276 ((null line-offset) 1277 ((null line-offset)
1277 (error "Can't find the text to patch")) 1278 (error "Can't find the text to patch"))
1279 ((with-current-buffer buf
1280 (and buffer-file-name
1281 (backup-file-name-p buffer-file-name)
1282 (not diff-apply-hunk-to-backup-file)
1283 (not (set (make-local-variable 'diff-apply-hunk-to-backup-file)
1284 (yes-or-no-p (format "Really apply this hunk to %s? "
1285 (file-name-nondirectory
1286 buffer-file-name)))))))
1287 (error (substitute-command-keys
1288 (format "Use %s\\[diff-apply-hunk] to apply it to the other file"
1289 (if (not reverse) "\\[universal-argument] ")))))
1278 ((and switched 1290 ((and switched
1279 ;; A reversed patch was detected, perhaps apply it in reverse. 1291 ;; A reversed patch was detected, perhaps apply it in reverse.
1280 (not (save-window-excursion 1292 (not (save-window-excursion