Mercurial > emacs
comparison lisp/diff-mode.el @ 64004:ea880752de3b
(diff-mode): Finish `defgroup' description with period.
(diff-context->unified, diff-reverse-direction, diff-unified->context):
"?\ " -> "?\s".
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 04 Jul 2005 01:55:56 +0000 |
parents | 3ed17f92f3c9 |
children | 30fe6a97264a |
comparison
equal
deleted
inserted
replaced
64003:bf6ae7cf12eb | 64004:ea880752de3b |
---|---|
55 | 55 |
56 (eval-when-compile (require 'cl)) | 56 (eval-when-compile (require 'cl)) |
57 | 57 |
58 | 58 |
59 (defgroup diff-mode () | 59 (defgroup diff-mode () |
60 "Major mode for viewing/editing diffs" | 60 "Major mode for viewing/editing diffs." |
61 :version "21.1" | 61 :version "21.1" |
62 :group 'tools | 62 :group 'tools |
63 :group 'diff) | 63 :group 'diff) |
64 | 64 |
65 (defcustom diff-default-read-only nil | 65 (defcustom diff-default-read-only nil |
638 (goto-char (point-max)) | 638 (goto-char (point-max)) |
639 (let ((modif nil) last-pt) | 639 (let ((modif nil) last-pt) |
640 (while (progn (setq last-pt (point)) | 640 (while (progn (setq last-pt (point)) |
641 (= (forward-line -1) 0)) | 641 (= (forward-line -1) 0)) |
642 (case (char-after) | 642 (case (char-after) |
643 (? (insert " ") (setq modif nil) (backward-char 1)) | 643 (?s (insert " ") (setq modif nil) (backward-char 1)) |
644 (?+ (delete-region (point) last-pt) (setq modif t)) | 644 (?+ (delete-region (point) last-pt) (setq modif t)) |
645 (?- (if (not modif) | 645 (?- (if (not modif) |
646 (progn (forward-char 1) | 646 (progn (forward-char 1) |
647 (insert " ")) | 647 (insert " ")) |
648 (delete-char 1) | 648 (delete-char 1) |
721 (goto-char pt1) | 721 (goto-char pt1) |
722 (forward-line 1) | 722 (forward-line 1) |
723 (while (< (point) pt2) | 723 (while (< (point) pt2) |
724 (case (char-after) | 724 (case (char-after) |
725 ((?! ?-) (delete-char 2) (insert "-") (forward-line 1)) | 725 ((?! ?-) (delete-char 2) (insert "-") (forward-line 1)) |
726 (?\ ;merge with the other half of the chunk | 726 (?\s ;merge with the other half of the chunk |
727 (let* ((endline2 | 727 (let* ((endline2 |
728 (save-excursion | 728 (save-excursion |
729 (goto-char pt2) (forward-line 1) (point))) | 729 (goto-char pt2) (forward-line 1) (point))) |
730 (c (char-after pt2))) | 730 (c (char-after pt2))) |
731 (case c | 731 (case c |
732 ((?! ?+) | 732 ((?! ?+) |
733 (insert "+" | 733 (insert "+" |
734 (prog1 (buffer-substring (+ pt2 2) endline2) | 734 (prog1 (buffer-substring (+ pt2 2) endline2) |
735 (delete-region pt2 endline2)))) | 735 (delete-region pt2 endline2)))) |
736 (?\ ;FIXME: check consistency | 736 (?\s ;FIXME: check consistency |
737 (delete-region pt2 endline2) | 737 (delete-region pt2 endline2) |
738 (delete-char 1) | 738 (delete-char 1) |
739 (forward-line 1)) | 739 (forward-line 1)) |
740 (?\\ (forward-line 1)) | 740 (?\\ (forward-line 1)) |
741 (t (delete-char 1) (forward-line 1))))) | 741 (t (delete-char 1) (forward-line 1))))) |
812 (delete-char 1) (insert "-") t) | 812 (delete-char 1) (insert "-") t) |
813 ((?\\ ?#) t) | 813 ((?\\ ?#) t) |
814 (t (when (and first last (< first last)) | 814 (t (when (and first last (< first last)) |
815 (insert (delete-and-extract-region first last))) | 815 (insert (delete-and-extract-region first last))) |
816 (setq first nil last nil) | 816 (setq first nil last nil) |
817 (equal ?\ c))) | 817 (equal ?\s c))) |
818 (forward-line 1)))))))))) | 818 (forward-line 1)))))))))) |
819 | 819 |
820 (defun diff-fixup-modifs (start end) | 820 (defun diff-fixup-modifs (start end) |
821 "Fixup the hunk headers (in case the buffer was modified). | 821 "Fixup the hunk headers (in case the buffer was modified). |
822 START and END are either taken from the region (if a prefix arg is given) or | 822 START and END are either taken from the region (if a prefix arg is given) or |