Mercurial > emacs
comparison lisp/smerge-mode.el @ 108733:46ac70591556
* smerge-mode.el: Fix typos.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Fri, 21 May 2010 03:05:50 +0200 |
parents | 1d1d5d9bd884 |
children |
comparison
equal
deleted
inserted
replaced
108732:7e7c06acebf4 | 108733:46ac70591556 |
---|---|
455 (insert ">>>>>>> " name3 "\n") | 455 (insert ">>>>>>> " name3 "\n") |
456 (setq line endline)))))))) | 456 (setq line endline)))))))) |
457 | 457 |
458 (defun smerge-resolve (&optional safe) | 458 (defun smerge-resolve (&optional safe) |
459 "Resolve the conflict at point intelligently. | 459 "Resolve the conflict at point intelligently. |
460 This relies on mode-specific knowledge and thus only works in | 460 This relies on mode-specific knowledge and thus only works in some |
461 some major modes. Uses `smerge-resolve-function' to do the actual work." | 461 major modes. Uses `smerge-resolve-function' to do the actual work." |
462 (interactive) | 462 (interactive) |
463 (smerge-match-conflict) | 463 (smerge-match-conflict) |
464 (smerge-remove-props (match-beginning 0) (match-end 0)) | 464 (smerge-remove-props (match-beginning 0) (match-end 0)) |
465 (let ((md (match-data)) | 465 (let ((md (match-data)) |
466 (m0b (match-beginning 0)) | 466 (m0b (match-beginning 0)) |
813 - it needs to be unaffected by changes performed by the `preproc' argument | 813 - it needs to be unaffected by changes performed by the `preproc' argument |
814 to `smerge-refine-subst'. | 814 to `smerge-refine-subst'. |
815 This only matters if `smerge-refine-weight-hack' is nil.") | 815 This only matters if `smerge-refine-weight-hack' is nil.") |
816 | 816 |
817 (defvar smerge-refine-ignore-whitespace t | 817 (defvar smerge-refine-ignore-whitespace t |
818 "If non-nil,Indicate that smerge-refine should try to ignore change in whitespace.") | 818 "If non-nil, indicate that `smerge-refine' should try to ignore change in whitespace.") |
819 | 819 |
820 (defvar smerge-refine-weight-hack t | 820 (defvar smerge-refine-weight-hack t |
821 "If non-nil, pass to diff as many lines as there are chars in the region. | 821 "If non-nil, pass to diff as many lines as there are chars in the region. |
822 I.e. each atomic element (e.g. word) will be copied as many times (on different | 822 I.e. each atomic element (e.g. word) will be copied as many times (on different |
823 lines) as it has chars. This has 2 advantages: | 823 lines) as it has chars. This has two advantages: |
824 - if `diff' tries to minimize the number *lines* (rather than chars) | 824 - if `diff' tries to minimize the number *lines* (rather than chars) |
825 added/removed, this adjust the weights so that adding/removing long | 825 added/removed, this adjust the weights so that adding/removing long |
826 symbols is considered correspondingly more costly. | 826 symbols is considered correspondingly more costly. |
827 - `smerge-refine-forward-function' only needs to be called when chopping up | 827 - `smerge-refine-forward-function' only needs to be called when chopping up |
828 the regions, and `forward-char' can be used afterwards. | 828 the regions, and `forward-char' can be used afterwards. |
917 | 917 |
918 (defun smerge-refine-subst (beg1 end1 beg2 end2 props &optional preproc) | 918 (defun smerge-refine-subst (beg1 end1 beg2 end2 props &optional preproc) |
919 "Show fine differences in the two regions BEG1..END1 and BEG2..END2. | 919 "Show fine differences in the two regions BEG1..END1 and BEG2..END2. |
920 PROPS is an alist of properties to put (via overlays) on the changes. | 920 PROPS is an alist of properties to put (via overlays) on the changes. |
921 If non-nil, PREPROC is called with no argument in a buffer that contains | 921 If non-nil, PREPROC is called with no argument in a buffer that contains |
922 a copy of a region, just before preparing it to for `diff'. It can be used to | 922 a copy of a region, just before preparing it to for `diff'. It can be |
923 replace chars to try and eliminate some spurious differences." | 923 used to replace chars to try and eliminate some spurious differences." |
924 (let* ((buf (current-buffer)) | 924 (let* ((buf (current-buffer)) |
925 (pos (point)) | 925 (pos (point)) |
926 (file1 (make-temp-file "diff1")) | 926 (file1 (make-temp-file "diff1")) |
927 (file2 (make-temp-file "diff2"))) | 927 (file2 (make-temp-file "diff2"))) |
928 ;; Chop up regions into smaller elements and save into files. | 928 ;; Chop up regions into smaller elements and save into files. |
986 (delete-file file1) | 986 (delete-file file1) |
987 (delete-file file2)))) | 987 (delete-file file2)))) |
988 | 988 |
989 (defun smerge-refine (&optional part) | 989 (defun smerge-refine (&optional part) |
990 "Highlight the words of the conflict that are different. | 990 "Highlight the words of the conflict that are different. |
991 For 3-way conflicts, highlights only 2 of the 3 parts. | 991 For 3-way conflicts, highlights only two of the three parts. |
992 A numeric argument PART can be used to specify which 2 parts; | 992 A numeric argument PART can be used to specify which two parts; |
993 repeating the command will highlight other 2 parts." | 993 repeating the command will highlight other two parts." |
994 (interactive | 994 (interactive |
995 (if (integerp current-prefix-arg) (list current-prefix-arg) | 995 (if (integerp current-prefix-arg) (list current-prefix-arg) |
996 (smerge-match-conflict) | 996 (smerge-match-conflict) |
997 (let* ((prop (get-text-property (match-beginning 0) 'smerge-refine-part)) | 997 (let* ((prop (get-text-property (match-beginning 0) 'smerge-refine-part)) |
998 (part (if (and (consp prop) | 998 (part (if (and (consp prop) |
1159 (message "Conflict resolution finished; you may save the buffer"))))) | 1159 (message "Conflict resolution finished; you may save the buffer"))))) |
1160 (message "Please resolve conflicts now; exit ediff when done"))) | 1160 (message "Please resolve conflicts now; exit ediff when done"))) |
1161 | 1161 |
1162 (defun smerge-makeup-conflict (pt1 pt2 pt3 &optional pt4) | 1162 (defun smerge-makeup-conflict (pt1 pt2 pt3 &optional pt4) |
1163 "Insert diff3 markers to make a new conflict. | 1163 "Insert diff3 markers to make a new conflict. |
1164 Uses point and mark for 2 of the relevant positions and previous marks | 1164 Uses point and mark for two of the relevant positions and previous marks |
1165 for the other ones. | 1165 for the other ones. |
1166 By default, makes up a 2-way conflict, | 1166 By default, makes up a 2-way conflict, |
1167 with a \\[universal-argument] prefix, makes up a 3-way conflict." | 1167 with a \\[universal-argument] prefix, makes up a 3-way conflict." |
1168 (interactive | 1168 (interactive |
1169 (list (point) | 1169 (list (point) |
1182 (insert "||||||| BASE\n") | 1182 (insert "||||||| BASE\n") |
1183 (goto-char pt4) (beginning-of-line)) | 1183 (goto-char pt4) (beginning-of-line)) |
1184 (insert "<<<<<<< MINE\n")) | 1184 (insert "<<<<<<< MINE\n")) |
1185 (if smerge-mode nil (smerge-mode 1)) | 1185 (if smerge-mode nil (smerge-mode 1)) |
1186 (smerge-refine)) | 1186 (smerge-refine)) |
1187 | 1187 |
1188 | 1188 |
1189 (defconst smerge-parsep-re | 1189 (defconst smerge-parsep-re |
1190 (concat smerge-begin-re "\\|" smerge-end-re "\\|" | 1190 (concat smerge-begin-re "\\|" smerge-end-re "\\|" |
1191 smerge-base-re "\\|" smerge-other-re "\\|")) | 1191 smerge-base-re "\\|" smerge-other-re "\\|")) |
1192 | 1192 |