From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#34421: [PATCH 1/2] smerge-mode: factor out going to next conflict Date: Mon, 11 Feb 2019 00:14:52 +0300 Message-ID: <20190210211453.26816-1-Hi-Angel@yandex.ru> Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="134996"; mail-complaints-to="usenet@blaine.gmane.org" To: 34421@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 10 22:18:22 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gswUX-000Yvq-Qq for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Feb 2019 22:18:22 +0100 Original-Received: from localhost ([127.0.0.1]:36777 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gswUW-0001LJ-Q5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Feb 2019 16:18:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gswUL-0001Kr-Rg for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2019 16:18:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gswUJ-0005IN-Ot for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2019 16:18:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43595) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gswUF-0005E1-PA for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2019 16:18:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gswUF-0005y2-Hf for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2019 16:18:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Feb 2019 21:18:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 34421 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.154983344022342 (code B ref -1); Sun, 10 Feb 2019 21:18:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Feb 2019 21:17:20 +0000 Original-Received: from localhost ([127.0.0.1]:42874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gswTW-0005mj-0I for submit@debbugs.gnu.org; Sun, 10 Feb 2019 16:17:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36631) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gswTT-0005hK-Vo for submit@debbugs.gnu.org; Sun, 10 Feb 2019 16:17:16 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:48654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gswTN-0004mY-FA for submit@debbugs.gnu.org; Sun, 10 Feb 2019 16:17:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gswTM-0000ss-BN for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2019 16:17:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gswRR-0003gw-HV for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2019 16:15:11 -0500 Original-Received: from forward105o.mail.yandex.net ([2a02:6b8:0:1a2d::608]:50468) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gswRP-0003eq-CI for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2019 16:15:08 -0500 Original-Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 655454200454 for ; Mon, 11 Feb 2019 00:15:01 +0300 (MSK) Original-Received: from smtp4p.mail.yandex.net (smtp4p.mail.yandex.net [2a02:6b8:0:1402::15:6]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id kYmKep19ol-F1We4Lid; Mon, 11 Feb 2019 00:15:01 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1549833301; bh=Pq8cRilZteQ2lhfyaQVi2ph4zP461YT1ZrQaTgmYVKU=; h=From:To:Subject:Date:Message-Id; b=KqU26fDFaXkagF+PrBcANdib5MNBWZ5hSivgADlq2fI7+pf1jeIv6xARquX5NwsPf eZlsKws6qeTIQe4kFwauh5bljYECEGwt+/YOYXQuM7zIdi6/PnrEQUGi3YgoI3vHca 6PIjrsGj85XBQyOHOjskkLWMNw5ZhHZ7b3gLlJ1o= Authentication-Results: mxback12g.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by smtp4p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id ppeUXVqyEA-F0p8ZQ2T; Mon, 11 Feb 2019 00:15:00 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) X-Mailer: git-send-email 2.20.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:155346 Archived-At: * 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 =20 (defconst smerge-match-names ["conflict" "upper" "base" "lower"]) =20 +(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))))) =20 @@ -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 conflic= t ;; 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) --=20 2.20.1