From: Miles Bader Date: Mon, 2 Oct 2000 03:48:38 +0000 (+0000) Subject: (diff-goto-source): Emit a status message. X-Git-Tag: emacs-pretest-21.0.90~1229 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=00df919edec1fc3617ce8e92625a19c9a57d52e2;p=emacs.git (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-apply-hunk): Only advance if `diff-advance-after-apply-hunk'. (diff-advance-after-apply-hunk): New variable. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a2be1fe69f9..ef9147d46fd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2000-10-02 Miles Bader + + * 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-apply-hunk): Only advance if `diff-advance-after-apply-hunk'. + (diff-advance-after-apply-hunk): New variable. + 2000-10-01 Stefan Monnier * vc.el (vc-editable-p): Minor optimization. diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index a7a45eb0768..a0293d0b3ff 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.23 2000/09/29 02:25:32 monnier Exp $ +;; Revision: $Id: diff-mode.el,v 1.24 2000/09/29 18:05:27 monnier Exp $ ;; This file is part of GNU Emacs. @@ -83,6 +83,12 @@ when editing big diffs)." :group 'diff-mode :type '(boolean)) +(defcustom diff-advance-after-apply-hunk t + "*Non-nil means `diff-apply-hunk' will move to the next hunk after applying." + :group 'diff-mode + :type 'boolean) + + (defvar diff-mode-hook nil "Run after setting up the `diff-mode' major mode.") @@ -1041,10 +1047,10 @@ hunk was applied backwards and nil if the hunk wasn't applied." (delete-char (length (car old))) (insert (car new))) ;; Display BUF in a window - (let ((win (display-buffer buf))) - (set-window-point win (+ pos (cdr new)))) + (set-window-point (display-buffer buf) (+ pos (cdr new))) (diff-hunk-status-msg line-offset reversed nil) - (diff-hunk-next) + (when diff-advance-after-apply-hunk + (diff-hunk-next)) (if reversed 'reversed t)))))) @@ -1057,9 +1063,10 @@ applied and nil if it can't be found." (interactive "P") (destructuring-bind (buf line-offset pos src dst &optional switched) (diff-find-source-location nil reverse) - (let ((win (display-buffer buf))) - (set-window-point win (+ pos (cdr src)))) - (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))) + (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)))) (defun diff-goto-source (&optional other-file) @@ -1075,7 +1082,9 @@ If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[u (diff-find-source-location other-file t) (pop-to-buffer buf) (goto-char (+ pos (cdr src))) - (unless line-offset (message "Hunk text not found")))) + (if line-offset + (diff-hunk-status-msg line-offset (not switched) t) + (message "Hunk text not found")))) (defun diff-current-defun ()