comparison lisp/diff-mode.el @ 90786:ca12f314faac

Changes from arch/CVS synchronization
author Miles Bader <miles@gnu.org>
date Sun, 18 Mar 2007 14:00:43 +0000
parents 8c2ef9d5d4a8
children 91bf6e05918b
comparison
equal deleted inserted replaced
90785:8c2ef9d5d4a8 90786:ca12f314faac
983 983
984 ;;;###autoload 984 ;;;###autoload
985 (define-derived-mode diff-mode fundamental-mode "Diff" 985 (define-derived-mode diff-mode fundamental-mode "Diff"
986 "Major mode for viewing/editing context diffs. 986 "Major mode for viewing/editing context diffs.
987 Supports unified and context diffs as well as (to a lesser extent) 987 Supports unified and context diffs as well as (to a lesser extent)
988 normal diffs. If you edit the buffer manually, diff-mode will try 988 normal diffs.
989 to update the hunk headers for you on-the-fly.
990
991 When the buffer is read-only, the ESC prefix is not necessary. 989 When the buffer is read-only, the ESC prefix is not necessary.
992 If you edit the buffer manually, diff-mode will try to update the hunk 990 If you edit the buffer manually, diff-mode will try to update the hunk
993 headers for you on-the-fly. 991 headers for you on-the-fly.
994 992
995 You can also switch between context diff and unified diff with \\[diff-context->unified], 993 You can also switch between context diff and unified diff with \\[diff-context->unified],
996 or vice versa with \\[diff-unified->context] and you can also reverse the direction of 994 or vice versa with \\[diff-unified->context] and you can also reverse the direction of
997 a diff with \\[diff-reverse-direction]. 995 a diff with \\[diff-reverse-direction].
998 996 \\{diff-mode-map}"
999 When the buffer is read-only, the Meta- modifier is not necessary
1000 to run the Diff mode commands:
1001
1002 \\{diff-mode-map}"
1003
1004 (set (make-local-variable 'font-lock-defaults) diff-font-lock-defaults) 997 (set (make-local-variable 'font-lock-defaults) diff-font-lock-defaults)
1005 (set (make-local-variable 'outline-regexp) diff-outline-regexp) 998 (set (make-local-variable 'outline-regexp) diff-outline-regexp)
1006 (set (make-local-variable 'imenu-generic-expression) 999 (set (make-local-variable 'imenu-generic-expression)
1007 diff-imenu-generic-expression) 1000 diff-imenu-generic-expression)
1008 ;; These are not perfect. They would be better done separately for 1001 ;; These are not perfect. They would be better done separately for
1373 (not diff-apply-hunk-to-backup-file) 1366 (not diff-apply-hunk-to-backup-file)
1374 (not (set (make-local-variable 'diff-apply-hunk-to-backup-file) 1367 (not (set (make-local-variable 'diff-apply-hunk-to-backup-file)
1375 (yes-or-no-p (format "Really apply this hunk to %s? " 1368 (yes-or-no-p (format "Really apply this hunk to %s? "
1376 (file-name-nondirectory 1369 (file-name-nondirectory
1377 buffer-file-name))))))) 1370 buffer-file-name)))))))
1378 (error "%s" 1371 (error (substitute-command-keys
1379 (substitute-command-keys
1380 (format "Use %s\\[diff-apply-hunk] to apply it to the other file" 1372 (format "Use %s\\[diff-apply-hunk] to apply it to the other file"
1381 (if (not reverse) "\\[universal-argument] "))))) 1373 (if (not reverse) "\\[universal-argument] ")))))
1382 ((and switched 1374 ((and switched
1383 ;; A reversed patch was detected, perhaps apply it in reverse. 1375 ;; A reversed patch was detected, perhaps apply it in reverse.
1384 (not (save-window-excursion 1376 (not (save-window-excursion