Mercurial > emacs
comparison lisp/smerge-mode.el @ 54903:922f49230ff5
(smerge-match-conflict): Try to do something sensible
for nested conflict markers.
(smerge-find-conflict): Better handle errors in smerge-match-conflict.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 15 Apr 2004 20:19:11 +0000 |
parents | 367886fbcfd9 |
children | a23bbf466906 |
comparison
equal
deleted
inserted
replaced
54902:0895b563f562 | 54903:922f49230ff5 |
---|---|
475 | 475 |
476 base-start base-end) | 476 base-start base-end) |
477 | 477 |
478 ;; handle the various conflict styles | 478 ;; handle the various conflict styles |
479 (cond | 479 (cond |
480 ((save-excursion | |
481 (goto-char mine-start) | |
482 (re-search-forward smerge-begin-re nil end)) | |
483 ;; There's a nested conflict and we're after the the beginning | |
484 ;; of the outer one but before the beginning of the inner one. | |
485 (error "There is a nested conflict")) | |
486 | |
480 ((re-search-backward smerge-base-re start t) | 487 ((re-search-backward smerge-base-re start t) |
481 ;; a 3-parts conflict | 488 ;; a 3-parts conflict |
482 (set (make-local-variable 'smerge-conflict-style) 'diff3-A) | 489 (set (make-local-variable 'smerge-conflict-style) 'diff3-A) |
483 (setq base-end mine-end) | 490 (setq base-end mine-end) |
484 (setq mine-end (match-beginning 0)) | 491 (setq mine-end (match-beginning 0)) |
519 "Find and match a conflict region. Intended as a font-lock MATCHER. | 526 "Find and match a conflict region. Intended as a font-lock MATCHER. |
520 The submatches are the same as in `smerge-match-conflict'. | 527 The submatches are the same as in `smerge-match-conflict'. |
521 Returns non-nil if a match is found between the point and LIMIT. | 528 Returns non-nil if a match is found between the point and LIMIT. |
522 The point is moved to the end of the conflict." | 529 The point is moved to the end of the conflict." |
523 (when (re-search-forward smerge-begin-re limit t) | 530 (when (re-search-forward smerge-begin-re limit t) |
524 (ignore-errors | 531 (condition-case err |
525 (smerge-match-conflict) | 532 (progn |
526 (goto-char (match-end 0))))) | 533 (smerge-match-conflict) |
534 (goto-char (match-end 0))) | |
535 (error (smerge-find-conflict limit))))) | |
527 | 536 |
528 (defun smerge-diff (n1 n2) | 537 (defun smerge-diff (n1 n2) |
529 (smerge-match-conflict) | 538 (smerge-match-conflict) |
530 (smerge-ensure-match n1) | 539 (smerge-ensure-match n1) |
531 (smerge-ensure-match n2) | 540 (smerge-ensure-match n2) |
671 (font-lock-fontify-region (match-beginning 0) (match-end 0) nil)))))) | 680 (font-lock-fontify-region (match-beginning 0) (match-end 0) nil)))))) |
672 | 681 |
673 | 682 |
674 (provide 'smerge-mode) | 683 (provide 'smerge-mode) |
675 | 684 |
676 ;;; arch-tag: 605c8d1e-e43d-4943-a6f3-1bcc4333e690 | 685 ;; arch-tag: 605c8d1e-e43d-4943-a6f3-1bcc4333e690 |
677 ;;; smerge-mode.el ends here | 686 ;;; smerge-mode.el ends here |