Mercurial > emacs
comparison lisp/diff-mode.el @ 90389:146cd8369025
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-60
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 259-273)
- Update from CVS
- lisp/replace.el (occur-engine): Bind `inhibit-field-text-motion' to t
- Merge from gnus--rel--5.10
- Rename "field-at-point" to "field-at-pos"
- (comint-insert-input): Remove redundant calls to setq and goto-char
* gnus--rel--5.10 (patch 99-100)
- Merge from emacs--devo--0
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 10 May 2006 20:42:41 +0000 |
parents | 2ecafc6d5db7 ef7506f44a3a |
children | a8190f7e546e |
comparison
equal
deleted
inserted
replaced
90388:a786f674d33f | 90389:146cd8369025 |
---|---|
631 | 631 |
632 (defun diff-unified->context (start end) | 632 (defun diff-unified->context (start end) |
633 "Convert unified diffs to context diffs. | 633 "Convert unified diffs to context diffs. |
634 START and END are either taken from the region (if a prefix arg is given) or | 634 START and END are either taken from the region (if a prefix arg is given) or |
635 else cover the whole bufer." | 635 else cover the whole bufer." |
636 (interactive (if current-prefix-arg | 636 (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active)) |
637 (list (mark) (point)) | 637 (list (region-beginning) (region-end)) |
638 (list (point-min) (point-max)))) | 638 (list (point-min) (point-max)))) |
639 (unless (markerp end) (setq end (copy-marker end))) | 639 (unless (markerp end) (setq end (copy-marker end))) |
640 (let (;;(diff-inhibit-after-change t) | 640 (let (;;(diff-inhibit-after-change t) |
641 (inhibit-read-only t)) | 641 (inhibit-read-only t)) |
642 (save-excursion | 642 (save-excursion |
720 "Convert context diffs to unified diffs. | 720 "Convert context diffs to unified diffs. |
721 START and END are either taken from the region | 721 START and END are either taken from the region |
722 \(when it is highlighted) or else cover the whole buffer. | 722 \(when it is highlighted) or else cover the whole buffer. |
723 With a prefix argument, convert unified format to context format." | 723 With a prefix argument, convert unified format to context format." |
724 (interactive (if (and transient-mark-mode mark-active) | 724 (interactive (if (and transient-mark-mode mark-active) |
725 (list (mark) (point) current-prefix-arg) | 725 (list (region-beginning) (region-end) current-prefix-arg) |
726 (list (point-min) (point-max) current-prefix-arg))) | 726 (list (point-min) (point-max) current-prefix-arg))) |
727 (if to-context | 727 (if to-context |
728 (diff-unified->context start end) | 728 (diff-unified->context start end) |
729 (unless (markerp end) (setq end (copy-marker end))) | 729 (unless (markerp end) (setq end (copy-marker end))) |
730 (let ( ;;(diff-inhibit-after-change t) | 730 (let ( ;;(diff-inhibit-after-change t) |
793 | 793 |
794 (defun diff-reverse-direction (start end) | 794 (defun diff-reverse-direction (start end) |
795 "Reverse the direction of the diffs. | 795 "Reverse the direction of the diffs. |
796 START and END are either taken from the region (if a prefix arg is given) or | 796 START and END are either taken from the region (if a prefix arg is given) or |
797 else cover the whole bufer." | 797 else cover the whole bufer." |
798 (interactive (if current-prefix-arg | 798 (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active)) |
799 (list (mark) (point)) | 799 (list (region-beginning) (region-end)) |
800 (list (point-min) (point-max)))) | 800 (list (point-min) (point-max)))) |
801 (unless (markerp end) (setq end (copy-marker end))) | 801 (unless (markerp end) (setq end (copy-marker end))) |
802 (let (;;(diff-inhibit-after-change t) | 802 (let (;;(diff-inhibit-after-change t) |
803 (inhibit-read-only t)) | 803 (inhibit-read-only t)) |
804 (save-excursion | 804 (save-excursion |
855 | 855 |
856 (defun diff-fixup-modifs (start end) | 856 (defun diff-fixup-modifs (start end) |
857 "Fixup the hunk headers (in case the buffer was modified). | 857 "Fixup the hunk headers (in case the buffer was modified). |
858 START and END are either taken from the region (if a prefix arg is given) or | 858 START and END are either taken from the region (if a prefix arg is given) or |
859 else cover the whole bufer." | 859 else cover the whole bufer." |
860 (interactive (if current-prefix-arg | 860 (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active)) |
861 (list (mark) (point)) | 861 (list (region-beginning) (region-end)) |
862 (list (point-min) (point-max)))) | 862 (list (point-min) (point-max)))) |
863 (let ((inhibit-read-only t)) | 863 (let ((inhibit-read-only t)) |
864 (save-excursion | 864 (save-excursion |
865 (goto-char end) (diff-end-of-hunk) | 865 (goto-char end) (diff-end-of-hunk) |
866 (let ((plus 0) (minus 0) (space 0) (bang 0)) | 866 (let ((plus 0) (minus 0) (space 0) (bang 0)) |
1067 nil t) | 1067 nil t) |
1068 (equal (match-string 1) (match-string 2))))) | 1068 (equal (match-string 1) (match-string 2))))) |
1069 | 1069 |
1070 (defun diff-hunk-text (hunk destp char-offset) | 1070 (defun diff-hunk-text (hunk destp char-offset) |
1071 "Return the literal source text from HUNK as (TEXT . OFFSET). | 1071 "Return the literal source text from HUNK as (TEXT . OFFSET). |
1072 if DESTP is nil TEXT is the source, otherwise the destination text. | 1072 If DESTP is nil, TEXT is the source, otherwise the destination text. |
1073 CHAR-OFFSET is a char-offset in HUNK, and OFFSET is the corresponding | 1073 CHAR-OFFSET is a char-offset in HUNK, and OFFSET is the corresponding |
1074 char-offset in TEXT." | 1074 char-offset in TEXT." |
1075 (with-temp-buffer | 1075 (with-temp-buffer |
1076 (insert hunk) | 1076 (insert hunk) |
1077 (goto-char (point-min)) | 1077 (goto-char (point-min)) |
1300 (defun diff-goto-source (&optional other-file event) | 1300 (defun diff-goto-source (&optional other-file event) |
1301 "Jump to the corresponding source line. | 1301 "Jump to the corresponding source line. |
1302 `diff-jump-to-old-file' (or its opposite if the OTHER-FILE prefix arg | 1302 `diff-jump-to-old-file' (or its opposite if the OTHER-FILE prefix arg |
1303 is given) determines whether to jump to the old or the new file. | 1303 is given) determines whether to jump to the old or the new file. |
1304 If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument]) | 1304 If the prefix arg is bigger than 8 (for example with \\[universal-argument] \\[universal-argument]) |
1305 then `diff-jump-to-old-file' is also set, for the next invocations." | 1305 then `diff-jump-to-old-file' is also set, for the next invocations." |
1306 (interactive (list current-prefix-arg last-input-event)) | 1306 (interactive (list current-prefix-arg last-input-event)) |
1307 ;; When pointing at a removal line, we probably want to jump to | 1307 ;; When pointing at a removal line, we probably want to jump to |
1308 ;; the old location, and else to the new (i.e. as if reverting). | 1308 ;; the old location, and else to the new (i.e. as if reverting). |
1309 ;; This is a convenient detail when using smerge-diff. | 1309 ;; This is a convenient detail when using smerge-diff. |
1310 (if event (posn-set-point (event-end event))) | 1310 (if event (posn-set-point (event-end event))) |