From 4eaa6852c9b55d05daf0a2f3ecc37c05121adf03 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Mon, 2 Oct 2000 06:50:45 +0000 Subject: [PATCH] (diff-test-hunk): Backout previous change. Fix doc string. (diff-apply-hunk): Don't return a value. --- lisp/ChangeLog | 3 ++- lisp/diff-mode.el | 43 +++++++++++++++++-------------------------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ef9147d46fd..addc2f25314 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,9 +2,10 @@ * diff-mode.el (diff-goto-source): Emit a status message. (diff-test-hunk, diff-apply-hunk): Remove unneeded `let'. - (diff-test-hunk): Make the return value agree with the doc string. + (diff-test-hunk): Fix doc string. (diff-apply-hunk): Only advance if `diff-advance-after-apply-hunk'. (diff-advance-after-apply-hunk): New variable. + (diff-apply-hunk): Don't return a value. 2000-10-01 Stefan Monnier diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index a0293d0b3ff..f55536a98a3 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el @@ -4,7 +4,7 @@ ;; Author: Stefan Monnier ;; Keywords: patch diff -;; Revision: $Id: diff-mode.el,v 1.24 2000/09/29 18:05:27 monnier Exp $ +;; Revision: $Id: diff-mode.el,v 1.25 2000/10/02 03:46:26 miles Exp $ ;; This file is part of GNU Emacs. @@ -1019,15 +1019,13 @@ By default, the new source file is patched, but if the variable patched instead (some commands, such as `diff-goto-source' can change the value of this variable when given an appropriate prefix argument). -With a prefix argument, REVERSE the hunk. - -Return value is t if the hunk was sucessfully applied, `reversed' if the -hunk was applied backwards and nil if the hunk wasn't applied." +With a prefix argument, REVERSE the hunk." (interactive "P") (destructuring-bind (buf line-offset pos old new &optional switched) (diff-find-source-location nil reverse) (cond - ((null line-offset) (error "Can't find the text to patch")) + ((null line-offset) + (error "Can't find the text to patch")) ((and switched ;; A reversed patch was detected, perhaps apply it in reverse (not (save-window-excursion @@ -1037,36 +1035,29 @@ hunk was applied backwards and nil if the hunk wasn't applied." (if reverse "Hunk hasn't been applied yet; apply it now? " "Hunk has already been applied; undo it? "))))) - (message "(Nothing done)") - nil) + (message "(Nothing done)")) (t - (let ((reversed (diff-xor switched reverse))) - ;; Apply the hunk - (with-current-buffer buf - (goto-char pos) - (delete-char (length (car old))) - (insert (car new))) - ;; Display BUF in a window - (set-window-point (display-buffer buf) (+ pos (cdr new))) - (diff-hunk-status-msg line-offset reversed nil) - (when diff-advance-after-apply-hunk - (diff-hunk-next)) - (if reversed 'reversed t)))))) + ;; Apply the hunk + (with-current-buffer buf + (goto-char pos) + (delete-char (length (car old))) + (insert (car new))) + ;; Display BUF in a window + (set-window-point (display-buffer buf) (+ pos (cdr new))) + (diff-hunk-status-msg line-offset (diff-xor switched reverse) nil) + (when diff-advance-after-apply-hunk + (diff-hunk-next)))))) (defun diff-test-hunk (&optional reverse) ;; FIXME: is `reverse' ever useful ??? "See whether it's possible to apply the current hunk. -With a prefix argument, try to REVERSE the hunk. -Returns t if the hunk can be applied, `reversed' if it's already -applied and nil if it can't be found." +With a prefix argument, try to REVERSE the hunk." (interactive "P") (destructuring-bind (buf line-offset pos src dst &optional switched) (diff-find-source-location nil reverse) (set-window-point (display-buffer buf) (+ pos (cdr src))) - (let ((reversed (diff-xor switched reverse))) - (diff-hunk-status-msg line-offset (diff-xor reverse switched) t) - (if reversed 'reversed t)))) + (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))) (defun diff-goto-source (&optional other-file) -- 2.39.2