From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.bugs Subject: bug#25555: 25.1.91; smerge-keep-current -vs- empty change Date: Sat, 09 Sep 2017 17:22:28 -0600 Message-ID: <8760cra24r.fsf@bapiya> References: <87r33od36m.fsf@tromey.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1504999411 27796 195.159.176.226 (9 Sep 2017 23:23:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 9 Sep 2017 23:23:31 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 25555@debbugs.gnu.org To: Tom Tromey Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 10 01:23:26 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dqp5f-0006Bc-PZ for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Sep 2017 01:23:08 +0200 Original-Received: from localhost ([::1]:51151 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqp5m-0000Zp-Ss for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Sep 2017 19:23:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dqp5e-0000YV-8i for bug-gnu-emacs@gnu.org; Sat, 09 Sep 2017 19:23:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dqp5a-0008MX-66 for bug-gnu-emacs@gnu.org; Sat, 09 Sep 2017 19:23:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49377) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dqp5Z-0008MI-UT for bug-gnu-emacs@gnu.org; Sat, 09 Sep 2017 19:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dqp5Z-0002MR-MR for bug-gnu-emacs@gnu.org; Sat, 09 Sep 2017 19:23:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tom Tromey Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Sep 2017 23:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25555 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25555-submit@debbugs.gnu.org id=B25555.15049993659050 (code B ref 25555); Sat, 09 Sep 2017 23:23:01 +0000 Original-Received: (at 25555) by debbugs.gnu.org; 9 Sep 2017 23:22:45 +0000 Original-Received: from localhost ([127.0.0.1]:58058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dqp5I-0002Lu-T7 for submit@debbugs.gnu.org; Sat, 09 Sep 2017 19:22:45 -0400 Original-Received: from gproxy4-pub.mail.unifiedlayer.com ([69.89.23.142]:54438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dqp5G-0002Le-K3 for 25555@debbugs.gnu.org; Sat, 09 Sep 2017 19:22:43 -0400 Original-Received: from cmgw3 (unknown [10.0.90.84]) by gproxy4.mail.unifiedlayer.com (Postfix) with ESMTP id 6666117729D for <25555@debbugs.gnu.org>; Sat, 9 Sep 2017 17:22:35 -0600 (MDT) Original-Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id 7bNX1w00F2f2jeq01bNaDH; Sat, 09 Sep 2017 17:22:35 -0600 X-Authority-Analysis: v=2.2 cv=K/VSJ2eI c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=2JCJgTwv5E4A:10 a=zstS-IiYAAAA:8 a=mDV3o1hIAAAA:8 a=2pAosli-svLPFpYfrN4A:9 a=4G6NA9xxw8l3yy4pmD5M:22 a=_FVE-zBwftR9WsbkzFJk:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6lS0iF/nQyUohRC7Ka7QbUOcsFdClC9p2TwKwZDMZZQ=; b=kKHtWfWrfMviTQFO4RajhKc7uK pbUUMx+vA+ZqjgNIH7HwkhwNSz/PYNM/xya4uOb5pYGM7ux+ZlKJHVKDIkdVjGh37/ujWlxtyTYUj 1FF6qH96NH0WIFFzcscv3MypM; Original-Received: from 75-166-76-94.hlrn.qwest.net ([75.166.76.94]:43152 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1dqp55-003nE9-1y; Sat, 09 Sep 2017 17:22:31 -0600 X-Attribution: Tom In-Reply-To: <87r33od36m.fsf@tromey.com> (Tom Tromey's message of "Fri, 27 Jan 2017 06:48:17 -0700") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.76.94 X-Exim-ID: 1dqp55-003nE9-1y X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-76-94.hlrn.qwest.net (bapiya) [75.166.76.94]:43152 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-Local-Domain: yes 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: 208.118.235.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:136721 Archived-At: This patch fixes the problem for me. Tom commit 55289e4ce3adb27a6c03cc42783265cf4d680f25 Author: Tom Tromey Date: Sat Sep 9 17:20:43 2017 -0600 Allow smerge-keep-current to work for empty hunks Bug#25555 * lisp/vc/smerge-mode.el (smerge-get-current): Allow point to be at match-end. * test/lisp/vc/smerge-mode-tests.el: New file. diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el index f94f8a6..302adfe 100644 --- a/lisp/vc/smerge-mode.el +++ b/lisp/vc/smerge-mode.el @@ -725,7 +725,7 @@ smerge-get-current (let ((i 3)) (while (or (not (match-end i)) (< (point) (match-beginning i)) - (>= (point) (match-end i))) + (> (point) (match-end i))) (cl-decf i)) i)) diff --git a/test/lisp/vc/smerge-mode-tests.el b/test/lisp/vc/smerge-mode-tests.el new file mode 100644 index 0000000..204a4b9 --- /dev/null +++ b/test/lisp/vc/smerge-mode-tests.el @@ -0,0 +1,34 @@ +;; Copyright (C) 2017 Free Software Foundation, Inc + +;; Maintainer: emacs-devel@gnu.org + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'smerge-mode) + +(ert-deftest smerge-mode-test-empty-hunk () + "Regression test for bug #25555" + (with-temp-buffer + (insert "<<<<<<< one\n") + (save-excursion + (insert "=======\nLLL\n>>>>>>> end\n")) + (smerge-mode) + (smerge-keep-current) + (should (equal (buffer-substring (point-min) (point-max)) "")))) + +(provide 'smerge-mode-tests)