diff options
| author | Stefan Monnier | 2002-07-16 13:37:15 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2002-07-16 13:37:15 +0000 |
| commit | cb4e817652fe9456d57c4c3d1ba9825e8cf9ab34 (patch) | |
| tree | e2f877d80092bd113dcfa53b0ae1a3f77f0e9486 /lisp/diff-mode.el | |
| parent | caebc99b2a8f70920cf9629f0a2d098fe837c9e6 (diff) | |
| download | emacs-cb4e817652fe9456d57c4c3d1ba9825e8cf9ab34.tar.gz emacs-cb4e817652fe9456d57c4c3d1ba9825e8cf9ab34.zip | |
(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.el | 13 |
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." | |||
| 742 | (delete-char 1) (insert "-") t) | 742 | (delete-char 1) (insert "-") t) |
| 743 | ((?\\ ?#) t) | 743 | ((?\\ ?#) t) |
| 744 | (t (when (and first last (< first last)) | 744 | (t (when (and first last (< first last)) |
| 745 | (let ((str | 745 | (insert (delete-and-extract-region first last))) |
| 746 | (save-excursion | ||
| 747 | (delete-and-extract-region first last)))) | ||
| 748 | (insert str))) | ||
| 749 | (setq first nil last nil) | 746 | (setq first nil last nil) |
| 750 | (equal ?\ c))) | 747 | (equal ?\ c))) |
| 751 | (forward-line 1)))))))))) | 748 | (forward-line 1)))))))))) |
| @@ -819,7 +816,7 @@ See `after-change-functions' for the meaning of BEG, END and LEN." | |||
| 819 | (if diff-unhandled-changes | 816 | (if diff-unhandled-changes |
| 820 | (setq diff-unhandled-changes | 817 | (setq diff-unhandled-changes |
| 821 | (cons (min beg (car diff-unhandled-changes)) | 818 | (cons (min beg (car diff-unhandled-changes)) |
| 822 | (max beg (cdr diff-unhandled-changes)))) | 819 | (max end (cdr diff-unhandled-changes)))) |
| 823 | (setq diff-unhandled-changes (cons beg end))))) | 820 | (setq diff-unhandled-changes (cons beg end))))) |
| 824 | 821 | ||
| 825 | (defun diff-post-command-hook () | 822 | (defun diff-post-command-hook () |
| @@ -828,6 +825,8 @@ See `after-change-functions' for the meaning of BEG, END and LEN." | |||
| 828 | (ignore-errors | 825 | (ignore-errors |
| 829 | (save-excursion | 826 | (save-excursion |
| 830 | (goto-char (car diff-unhandled-changes)) | 827 | (goto-char (car diff-unhandled-changes)) |
| 828 | ;; Maybe we've cut the end of the hunk before point. | ||
| 829 | (if (and (bolp) (not (bobp))) (backward-char 1)) | ||
| 831 | ;; We used to fixup modifs on all the changes, but it turns out | 830 | ;; We used to fixup modifs on all the changes, but it turns out |
| 832 | ;; that it's safer not to do it on big changes, for example | 831 | ;; that it's safer not to do it on big changes, for example |
| 833 | ;; when yanking a big diff, since we might then screw up perfectly | 832 | ;; 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." | |||
| 844 | (diff-beginning-of-hunk) | 843 | (diff-beginning-of-hunk) |
| 845 | (when (save-excursion | 844 | (when (save-excursion |
| 846 | (diff-end-of-hunk) | 845 | (diff-end-of-hunk) |
| 847 | (> (point) (cdr diff-unhandled-changes))) | 846 | (>= (point) (cdr diff-unhandled-changes))) |
| 848 | (diff-fixup-modifs (point) (cdr diff-unhandled-changes))))) | 847 | (diff-fixup-modifs (point) (cdr diff-unhandled-changes))))) |
| 849 | (setq diff-unhandled-changes nil))) | 848 | (setq diff-unhandled-changes nil))) |
| 850 | 849 | ||
| @@ -1183,8 +1182,8 @@ For use in `add-log-current-defun-function'." | |||
| 1183 | (let ((old (if switched dst src))) | 1182 | (let ((old (if switched dst src))) |
| 1184 | (with-temp-buffer | 1183 | (with-temp-buffer |
| 1185 | (insert (car old)) | 1184 | (insert (car old)) |
| 1186 | (goto-char (cdr old)) | ||
| 1187 | (funcall (with-current-buffer buf major-mode)) | 1185 | (funcall (with-current-buffer buf major-mode)) |
| 1186 | (goto-char (+ (point-min) (cdr old))) | ||
| 1188 | (add-log-current-defun)))) | 1187 | (add-log-current-defun)))) |
| 1189 | (with-current-buffer buf | 1188 | (with-current-buffer buf |
| 1190 | (goto-char (+ (car pos) (cdr src))) | 1189 | (goto-char (+ (car pos) (cdr src))) |