diff options
| author | Miles Bader | 2004-06-28 07:56:49 +0000 |
|---|---|---|
| committer | Miles Bader | 2004-06-28 07:56:49 +0000 |
| commit | 327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801 (patch) | |
| tree | 21de188e13b5e41a79bb50040933072ae0235217 /lisp/diff-mode.el | |
| parent | 852f73b7fa7b71910282eacb6263b3ecfd4ee783 (diff) | |
| parent | 376de73927383d6062483db10b8a82448505f52b (diff) | |
| download | emacs-327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801.tar.gz emacs-327719ee8a3fcdb36ed6acaf6d8cb5fbdf0bd801.zip | |
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-218
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-220
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-221
Restore deleted tagline in etc/TUTORIAL.ru
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-222
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-228
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-229
Remove TeX output files from the archive
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248
src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-258
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264
Update from CVS: lispref/display.texi: emacs -> Emacs.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275
Update from CVS: man/makefile.w32-in: Revert last change
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-295
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-296
Allow restarting an existing debugger session that's exited
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-297
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-327
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-328
Update from CVS: src/.gdbinit (xsymbol): Fix last change.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-329
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-344
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-345
Tweak source regexps so that building in place won't cause problems
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-346
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-351
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-352
Update from CVS: lisp/flymake.el: New file.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-361
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-362
Support " [...]" style defaults in minibuffer-electric-default-mode
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-363
(read-number): Use canonical format for default in prompt.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-364
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-367
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-368
Improve display-supports-face-attributes-p on non-ttys
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369
Rewrite face-differs-from-default-p
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Move `display-supports-face-attributes-p' entirely into C code
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-371
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Simplify face-differs-from-default-p; don't consider :stipple.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-373
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
(tty_supports_face_attributes_p): Ensure attributes differ from default
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-375
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
(Fdisplay_supports_face_attributes_p): Work around bootstrapping problem
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Face merging cleanups
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-382
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-384
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385
src/xfaces.c (push_named_merge_point): Return 0 if a cycle is detected
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-386
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-395
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-396
Tweak arch tagging to make build/install-in-place less annoying
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-397
Work around vc-arch problems when building eshell
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-398
Tweak permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-399
Tweak directory permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-400
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-401
More build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-402
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-403
Yet more build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-404
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410
Make sure image types are initialized for lookup too
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416
Update from CVS
Diffstat (limited to 'lisp/diff-mode.el')
| -rw-r--r-- | lisp/diff-mode.el | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el index f6b2520a112..26ff5441baf 100644 --- a/lisp/diff-mode.el +++ b/lisp/diff-mode.el | |||
| @@ -48,7 +48,6 @@ | |||
| 48 | ;; | 48 | ;; |
| 49 | ;; - Refine hunk on a word-by-word basis. | 49 | ;; - Refine hunk on a word-by-word basis. |
| 50 | ;; | 50 | ;; |
| 51 | ;; - Use the new next-error-function to allow C-x `. | ||
| 52 | ;; - Handle `diff -b' output in context->unified. | 51 | ;; - Handle `diff -b' output in context->unified. |
| 53 | 52 | ||
| 54 | ;;; Code: | 53 | ;;; Code: |
| @@ -170,27 +169,27 @@ when editing big diffs)." | |||
| 170 | ;;;; | 169 | ;;;; |
| 171 | 170 | ||
| 172 | (defface diff-header-face | 171 | (defface diff-header-face |
| 173 | '((((type tty pc) (class color) (background light)) | 172 | '((((class color) (min-colors 88) (background light)) |
| 174 | (:foreground "blue1" :weight bold)) | ||
| 175 | (((type tty pc) (class color) (background dark)) | ||
| 176 | (:foreground "green" :weight bold)) | ||
| 177 | (((class color) (background light)) | ||
| 178 | (:background "grey85")) | 173 | (:background "grey85")) |
| 179 | (((class color) (background dark)) | 174 | (((class color) (min-colors 88) (background dark)) |
| 180 | (:background "grey45")) | 175 | (:background "grey45")) |
| 176 | (((class color) (background light)) | ||
| 177 | (:foreground "blue1" :weight bold)) | ||
| 178 | (((class color) (background dark)) | ||
| 179 | (:foreground "green" :weight bold)) | ||
| 181 | (t (:weight bold))) | 180 | (t (:weight bold))) |
| 182 | "`diff-mode' face inherited by hunk and index header faces.") | 181 | "`diff-mode' face inherited by hunk and index header faces.") |
| 183 | (defvar diff-header-face 'diff-header-face) | 182 | (defvar diff-header-face 'diff-header-face) |
| 184 | 183 | ||
| 185 | (defface diff-file-header-face | 184 | (defface diff-file-header-face |
| 186 | '((((type tty pc) (class color) (background light)) | 185 | '((((class color) (min-colors 88) (background light)) |
| 187 | (:foreground "yellow" :weight bold)) | ||
| 188 | (((type tty pc) (class color) (background dark)) | ||
| 189 | (:foreground "cyan" :weight bold)) | ||
| 190 | (((class color) (background light)) | ||
| 191 | (:background "grey70" :weight bold)) | 186 | (:background "grey70" :weight bold)) |
| 192 | (((class color) (background dark)) | 187 | (((class color) (min-colors 88) (background dark)) |
| 193 | (:background "grey60" :weight bold)) | 188 | (:background "grey60" :weight bold)) |
| 189 | (((class color) (background light)) | ||
| 190 | (:foreground "yellow" :weight bold)) | ||
| 191 | (((class color) (background dark)) | ||
| 192 | (:foreground "cyan" :weight bold)) | ||
| 194 | (t (:weight bold))) ; :height 1.3 | 193 | (t (:weight bold))) ; :height 1.3 |
| 195 | "`diff-mode' face used to highlight file header lines.") | 194 | "`diff-mode' face used to highlight file header lines.") |
| 196 | (defvar diff-file-header-face 'diff-file-header-face) | 195 | (defvar diff-file-header-face 'diff-file-header-face) |
| @@ -305,7 +304,11 @@ when editing big diffs)." | |||
| 305 | (defvar diff-narrowed-to nil) | 304 | (defvar diff-narrowed-to nil) |
| 306 | 305 | ||
| 307 | (defun diff-end-of-hunk (&optional style) | 306 | (defun diff-end-of-hunk (&optional style) |
| 308 | (if (looking-at diff-hunk-header-re) (goto-char (match-end 0))) | 307 | (when (looking-at diff-hunk-header-re) |
| 308 | (unless style | ||
| 309 | ;; Especially important for unified (because headers are ambiguous). | ||
| 310 | (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context)))))) | ||
| 311 | (goto-char (match-end 0))) | ||
| 309 | (let ((end (and (re-search-forward (case style | 312 | (let ((end (and (re-search-forward (case style |
| 310 | ;; A `unified' header is ambiguous. | 313 | ;; A `unified' header is ambiguous. |
| 311 | (unified (concat "^[^-+# \\]\\|" | 314 | (unified (concat "^[^-+# \\]\\|" |
| @@ -882,9 +885,14 @@ See `after-change-functions' for the meaning of BEG, END and LEN." | |||
| 882 | (diff-fixup-modifs (point) (cdr diff-unhandled-changes))))) | 885 | (diff-fixup-modifs (point) (cdr diff-unhandled-changes))))) |
| 883 | (setq diff-unhandled-changes nil))) | 886 | (setq diff-unhandled-changes nil))) |
| 884 | 887 | ||
| 885 | ;;;; | 888 | (defun diff-next-error (arg reset) |
| 886 | ;;;; The main function | 889 | ;; Select a window that displays the current buffer so that point |
| 887 | ;;;; | 890 | ;; movements are reflected in that window. Otherwise, the user might |
| 891 | ;; never see the hunk corresponding to the source she's jumping to. | ||
| 892 | (pop-to-buffer (current-buffer)) | ||
| 893 | (if reset (goto-char (point-min))) | ||
| 894 | (diff-hunk-next arg) | ||
| 895 | (diff-goto-source)) | ||
| 888 | 896 | ||
| 889 | ;;;###autoload | 897 | ;;;###autoload |
| 890 | (define-derived-mode diff-mode fundamental-mode "Diff" | 898 | (define-derived-mode diff-mode fundamental-mode "Diff" |
| @@ -912,6 +920,7 @@ a diff with \\[diff-reverse-direction]." | |||
| 912 | ;; (set (make-local-variable 'paragraph-separate) paragraph-start) | 920 | ;; (set (make-local-variable 'paragraph-separate) paragraph-start) |
| 913 | ;; (set (make-local-variable 'page-delimiter) "--- [^\t]+\t") | 921 | ;; (set (make-local-variable 'page-delimiter) "--- [^\t]+\t") |
| 914 | ;; compile support | 922 | ;; compile support |
| 923 | (set (make-local-variable 'next-error-function) 'diff-next-error) | ||
| 915 | 924 | ||
| 916 | (when (and (> (point-max) (point-min)) diff-default-read-only) | 925 | (when (and (> (point-max) (point-min)) diff-default-read-only) |
| 917 | (toggle-read-only t)) | 926 | (toggle-read-only t)) |
| @@ -967,7 +976,7 @@ a diff with \\[diff-reverse-direction]." | |||
| 967 | "Turn context diffs into unified diffs if applicable." | 976 | "Turn context diffs into unified diffs if applicable." |
| 968 | (if (save-excursion | 977 | (if (save-excursion |
| 969 | (goto-char (point-min)) | 978 | (goto-char (point-min)) |
| 970 | (looking-at "\\*\\*\\* ")) | 979 | (and (looking-at diff-hunk-header-re) (eq (char-after) ?*))) |
| 971 | (let ((mod (buffer-modified-p))) | 980 | (let ((mod (buffer-modified-p))) |
| 972 | (unwind-protect | 981 | (unwind-protect |
| 973 | (diff-context->unified (point-min) (point-max)) | 982 | (diff-context->unified (point-min) (point-max)) |
| @@ -1239,9 +1248,12 @@ If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[u | |||
| 1239 | (defun diff-current-defun () | 1248 | (defun diff-current-defun () |
| 1240 | "Find the name of function at point. | 1249 | "Find the name of function at point. |
| 1241 | For use in `add-log-current-defun-function'." | 1250 | For use in `add-log-current-defun-function'." |
| 1242 | (destructuring-bind (buf line-offset pos src dst &optional switched) | 1251 | (save-excursion |
| 1243 | (diff-find-source-location) | 1252 | (when (looking-at diff-hunk-header-re) |
| 1244 | (save-excursion | 1253 | (forward-line 1) |
| 1254 | (while (and (looking-at " ") (not (zerop (forward-line 1)))))) | ||
| 1255 | (destructuring-bind (buf line-offset pos src dst &optional switched) | ||
| 1256 | (diff-find-source-location) | ||
| 1245 | (beginning-of-line) | 1257 | (beginning-of-line) |
| 1246 | (or (when (memq (char-after) '(?< ?-)) | 1258 | (or (when (memq (char-after) '(?< ?-)) |
| 1247 | ;; Cursor is pointing at removed text. This could be a removed | 1259 | ;; Cursor is pointing at removed text. This could be a removed |