diff options
| author | Stefan Monnier | 2004-04-15 20:19:11 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-04-15 20:19:11 +0000 |
| commit | 9f0c286d22c49f88af21e00532e2fd232f748c99 (patch) | |
| tree | d82f12fdbad25df261830cba35922fd4a9eb5ba8 | |
| parent | adbb5567a81761c6625031c743e812cda1cdc8b6 (diff) | |
| download | emacs-9f0c286d22c49f88af21e00532e2fd232f748c99.tar.gz emacs-9f0c286d22c49f88af21e00532e2fd232f748c99.zip | |
(smerge-match-conflict): Try to do something sensible
for nested conflict markers.
(smerge-find-conflict): Better handle errors in smerge-match-conflict.
| -rw-r--r-- | lisp/smerge-mode.el | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/smerge-mode.el b/lisp/smerge-mode.el index bd4d8d04a6f..80547821343 100644 --- a/lisp/smerge-mode.el +++ b/lisp/smerge-mode.el | |||
| @@ -477,6 +477,13 @@ An error is raised if not inside a conflict." | |||
| 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) |
| @@ -521,9 +528,11 @@ 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) |
| @@ -673,5 +682,5 @@ buffer names." | |||
| 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 |