summaryrefslogtreecommitdiff
path: root/lisp/diff-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2002-07-16 13:37:15 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2002-07-16 13:37:15 +0000
commitcb4e817652fe9456d57c4c3d1ba9825e8cf9ab34 (patch)
treee2f877d80092bd113dcfa53b0ae1a3f77f0e9486 /lisp/diff-mode.el
parentcaebc99b2a8f70920cf9629f0a2d098fe837c9e6 (diff)
downloademacs-cb4e817652fe9456d57c4c3d1ba9825e8cf9ab34.tar.gz
(diff-reverse-direction): Simplify.
(diff-after-change-function): Fix typo. (diff-post-command-hook): Take care of edge cases. (diff-current-defun): Do `goto-char' after setting the mode.
Diffstat (limited to 'lisp/diff-mode.el')
-rw-r--r--lisp/diff-mode.el13
1 files changed, 6 insertions, 7 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index a2ed76436aa..69621a64259 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -742,10 +742,7 @@ else cover the whole bufer."
(delete-char 1) (insert "-") t)
((?\\ ?#) t)
(t (when (and first last (< first last))
- (let ((str
- (save-excursion
- (delete-and-extract-region first last))))
- (insert str)))
+ (insert (delete-and-extract-region first last)))
(setq first nil last nil)
(equal ?\ c)))
(forward-line 1))))))))))
@@ -819,7 +816,7 @@ See `after-change-functions' for the meaning of BEG, END and LEN."
(if diff-unhandled-changes
(setq diff-unhandled-changes
(cons (min beg (car diff-unhandled-changes))
- (max beg (cdr diff-unhandled-changes))))
+ (max end (cdr diff-unhandled-changes))))
(setq diff-unhandled-changes (cons beg end)))))
(defun diff-post-command-hook ()
@@ -828,6 +825,8 @@ See `after-change-functions' for the meaning of BEG, END and LEN."
(ignore-errors
(save-excursion
(goto-char (car diff-unhandled-changes))
+ ;; Maybe we've cut the end of the hunk before point.
+ (if (and (bolp) (not (bobp))) (backward-char 1))
;; We used to fixup modifs on all the changes, but it turns out
;; that it's safer not to do it on big changes, for example
;; when yanking a big diff, since we might then screw up perfectly
@@ -844,7 +843,7 @@ See `after-change-functions' for the meaning of BEG, END and LEN."
(diff-beginning-of-hunk)
(when (save-excursion
(diff-end-of-hunk)
- (> (point) (cdr diff-unhandled-changes)))
+ (>= (point) (cdr diff-unhandled-changes)))
(diff-fixup-modifs (point) (cdr diff-unhandled-changes)))))
(setq diff-unhandled-changes nil)))
@@ -1183,8 +1182,8 @@ For use in `add-log-current-defun-function'."
(let ((old (if switched dst src)))
(with-temp-buffer
(insert (car old))
- (goto-char (cdr old))
(funcall (with-current-buffer buf major-mode))
+ (goto-char (+ (point-min) (cdr old)))
(add-log-current-defun))))
(with-current-buffer buf
(goto-char (+ (car pos) (cdr src)))