unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#34421: [PATCH 1/2] smerge-mode: factor out going to next conflict
@ 2019-02-10 21:14 Konstantin Kharlamov
  2019-02-10 21:14 ` bug#34420: [PATCH 2/2] smerge-mode: new function to go " Konstantin Kharlamov
  0 siblings, 1 reply; 16+ messages in thread
From: Konstantin Kharlamov @ 2019-02-10 21:14 UTC (permalink / raw)
  To: 34421

* lisp/vc/smerge-mode.el (smerge-goto-next-conflict)
---
 lisp/vc/smerge-mode.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index 569797e18dd..929cd85432a 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -269,6 +269,9 @@ font-lock-keywords
 
 (defconst smerge-match-names ["conflict" "upper" "base" "lower"])
 
+(defsubst smerge-goto-next-conflict (&optional bound)
+  (re-search-forward smerge-begin-re bound t))
+
 (defun smerge-ensure-match (n)
   (unless (match-end n)
     (error "No `%s'" (aref smerge-match-names n))))
@@ -276,7 +279,7 @@ smerge-ensure-match
 (defun smerge-auto-leave ()
   (when (and smerge-auto-leave
 	     (save-excursion (goto-char (point-min))
-			     (not (re-search-forward smerge-begin-re nil t))))
+			     (not (smerge-goto-next-conflict))))
     (when (and (listp buffer-undo-list) smerge-mode)
       (push (list 'apply 'smerge-mode 1) buffer-undo-list))
     (smerge-mode -1)))
@@ -312,7 +315,7 @@ smerge-combine-with-next
       (push (if (match-end i) (copy-marker (match-end i) t)) ends))
     (setq ends (apply 'vector ends))
     (goto-char (aref ends 0))
-    (if (not (re-search-forward smerge-begin-re nil t))
+    (if (not (smerge-goto-next-conflict))
 	(error "No next conflict")
       (smerge-match-conflict)
       (let ((match-data (mapcar (lambda (m) (if m (copy-marker m)))
@@ -407,7 +410,7 @@ smerge-popup-context-menu
     ;; There's no conflict at point, the text-props are just obsolete.
     (save-excursion
       (let ((beg (re-search-backward smerge-end-re nil t))
-	    (end (re-search-forward smerge-begin-re nil t)))
+	    (end (smerge-goto-next-conflict)))
 	(smerge-remove-props (or beg (point-min)) (or end (point-max)))
 	(push event unread-command-events)))))
 
@@ -651,7 +654,7 @@ smerge-resolve-all
   (interactive)
   (save-excursion
     (goto-char (point-min))
-    (while (re-search-forward smerge-begin-re nil t)
+    (while (smerge-goto-next-conflict)
       (condition-case nil
           (progn
             (smerge-match-conflict)
@@ -812,7 +815,7 @@ smerge-match-conflict
 	  (cond
 	   ((save-excursion
 	      (goto-char upper-start)
-	      (re-search-forward smerge-begin-re end t))
+	      (smerge-goto-next-conflict end))
 	    ;; There's a nested conflict and we're after the beginning
 	    ;; of the outer one but before the beginning of the inner one.
 	    ;; Of course, maybe this is not a nested conflict but in that
@@ -887,7 +890,7 @@ smerge-find-conflict
                (goto-char pos))))
     ;; If we're not already inside a conflict, look for the next conflict
     ;; and add/update its overlay.
-    (while (and (not found) (re-search-forward smerge-begin-re limit t))
+    (while (and (not found) (smerge-goto-next-conflict limit))
       (condition-case nil
           (progn
             (smerge-match-conflict)
-- 
2.20.1






^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-02-18 23:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-10 21:14 bug#34421: [PATCH 1/2] smerge-mode: factor out going to next conflict Konstantin Kharlamov
2019-02-10 21:14 ` bug#34420: [PATCH 2/2] smerge-mode: new function to go " Konstantin Kharlamov
2019-02-10 22:30   ` bug#34420: [PATCH v2 " Konstantin Kharlamov
2019-02-13 21:44   ` bug#34420: [PATCH " Konstantin Kharlamov
2019-02-16  7:32     ` Eli Zaretskii
2019-02-16  7:32     ` Eli Zaretskii
2019-02-16 13:41       ` Stefan Monnier
2019-02-17  9:18         ` Konstantin Kharlamov
2019-02-17 15:37           ` Eli Zaretskii
2019-02-17 15:59             ` Konstantin Kharlamov
2019-02-18  3:22           ` Stefan Monnier
2019-02-18 17:49             ` Stefan Monnier
2019-02-18 21:12               ` hi-angel
2019-02-18 21:51                 ` Stefan Monnier
2019-02-18 22:01                   ` hi-angel
2019-02-18 23:28                     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).