diff options
| author | Stefan Monnier | 2000-10-03 18:36:36 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2000-10-03 18:36:36 +0000 |
| commit | a63733401412f0f4c30d1889d51db10186b4dab9 (patch) | |
| tree | e66d1e28d03bb147f401d3fbdb2b0abde0bede3b | |
| parent | 003dd6351758732bf0096e8c19b045aac713c810 (diff) | |
| download | emacs-a63733401412f0f4c30d1889d51db10186b4dab9.tar.gz emacs-a63733401412f0f4c30d1889d51db10186b4dab9.zip | |
(diff-font-lock-keywords): Minor regex fix.
(diff-goto-source): Be smarter when choosing REVERSE or not.
| -rw-r--r-- | lisp/diff-mode.el | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index f55536a98a3..6b2d8e66faa 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Stefan Monnier <monnier@cs.yale.edu> | 5 | ;; Author: Stefan Monnier <monnier@cs.yale.edu> |
| 6 | ;; Keywords: patch diff | 6 | ;; Keywords: patch diff |
| 7 | ;; Revision: $Id: diff-mode.el,v 1.25 2000/10/02 03:46:26 miles Exp $ | 7 | ;; Revision: $Id: diff-mode.el,v 1.26 2000/10/02 06:49:21 miles Exp $ |
| 8 | 8 | ||
| 9 | ;; This file is part of GNU Emacs. | 9 | ;; This file is part of GNU Emacs. |
| 10 | 10 | ||
| @@ -229,7 +229,7 @@ when editing big diffs)." | |||
| 229 | (1 diff-hunk-header-face) | 229 | (1 diff-hunk-header-face) |
| 230 | (2 diff-comment-face)) | 230 | (2 diff-comment-face)) |
| 231 | ("^\\*\\*\\* .+ \\*\\*\\*\\*". diff-hunk-header-face) ;context | 231 | ("^\\*\\*\\* .+ \\*\\*\\*\\*". diff-hunk-header-face) ;context |
| 232 | ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\(\\S-+\\).*[^*-]\n" | 232 | ("^\\(---\\|\\+\\+\\+\\|\\*\\*\\*\\) \\(\\S-+\\)\\(.*[^*-]\\)?\n" |
| 233 | (0 diff-header-face) (2 diff-file-header-face prepend)) | 233 | (0 diff-header-face) (2 diff-file-header-face prepend)) |
| 234 | ("^[0-9,]+[acd][0-9,]+$" . diff-hunk-header-face) | 234 | ("^[0-9,]+[acd][0-9,]+$" . diff-hunk-header-face) |
| 235 | ("^!.*\n" . diff-changed-face) ;context | 235 | ("^!.*\n" . diff-changed-face) ;context |
| @@ -1050,7 +1050,6 @@ With a prefix argument, REVERSE the hunk." | |||
| 1050 | 1050 | ||
| 1051 | 1051 | ||
| 1052 | (defun diff-test-hunk (&optional reverse) | 1052 | (defun diff-test-hunk (&optional reverse) |
| 1053 | ;; FIXME: is `reverse' ever useful ??? | ||
| 1054 | "See whether it's possible to apply the current hunk. | 1053 | "See whether it's possible to apply the current hunk. |
| 1055 | With a prefix argument, try to REVERSE the hunk." | 1054 | With a prefix argument, try to REVERSE the hunk." |
| 1056 | (interactive "P") | 1055 | (interactive "P") |
| @@ -1067,15 +1066,15 @@ is given) determines whether to jump to the old or the new file. | |||
| 1067 | If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument]) | 1066 | If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument]) |
| 1068 | then `diff-jump-to-old-file-flag' is also set, for the next invocations." | 1067 | then `diff-jump-to-old-file-flag' is also set, for the next invocations." |
| 1069 | (interactive "P") | 1068 | (interactive "P") |
| 1070 | (destructuring-bind (buf line-offset pos src dst &optional switched) | 1069 | ;; When pointing at a removal line, we probably want to jump to |
| 1071 | ;; We normally jump to the NEW file, where the hunk should already | 1070 | ;; the old location, and else to the new (i.e. as if reverting). |
| 1072 | ;; be applied, so favor the `reverse'. | 1071 | ;; This is a convenient detail when using smerge-diff. |
| 1073 | (diff-find-source-location other-file t) | 1072 | (let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]"))))) |
| 1074 | (pop-to-buffer buf) | 1073 | (destructuring-bind (buf line-offset pos src dst &optional switched) |
| 1075 | (goto-char (+ pos (cdr src))) | 1074 | (diff-find-source-location other-file rev) |
| 1076 | (if line-offset | 1075 | (pop-to-buffer buf) |
| 1077 | (diff-hunk-status-msg line-offset (not switched) t) | 1076 | (goto-char (+ pos (cdr src))) |
| 1078 | (message "Hunk text not found")))) | 1077 | (diff-hunk-status-msg line-offset (not switched) t)))) |
| 1079 | 1078 | ||
| 1080 | 1079 | ||
| 1081 | (defun diff-current-defun () | 1080 | (defun diff-current-defun () |