GNU bug report logs - #34420
[PATCH 2/2] smerge-mode: new function to go to next conflict

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>

Date: Sun, 10 Feb 2019 21:18:01 UTC

Severity: wishlist

Tags: patch

Merged with 34421

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
Subject: bug#34421: closed (Re: bug#34420: [PATCH 2/2] smerge-mode: new
 function to go to next conflict)
Date: Mon, 18 Feb 2019 23:29:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#34420: [PATCH 1/2] smerge-mode: factor out going to next conflict

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 34421 <at> debbugs.gnu.org.

-- 
34420: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34420
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: hi-angel <at> yandex.ru
Cc: 34420-done <at> debbugs.gnu.org
Subject: Re: bug#34420: [PATCH 2/2] smerge-mode: new function to go to next
 conflict
Date: Mon, 18 Feb 2019 18:28:33 -0500
> Ah, works for me, thanks! I didn't want to upgrade to latest master because
> I've been using harfbuzz branch, but I just installed and tested master —
> everything is okay.

Thanks, closing,


        Stefan

[Message part 3 (message/rfc822, inline)]
From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH 1/2] smerge-mode: factor out going to next conflict
Date: Mon, 11 Feb 2019 00:14:52 +0300
* 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




This bug report was last modified 6 years and 144 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.