aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Tromey2017-09-09 17:20:43 -0600
committerTom Tromey2017-09-16 21:55:05 -0600
commit9d101376b42e51007e7f83b646e172c52251ae1e (patch)
treeac684590a5f53ccb8a36b5de634503f36b072d19
parent13aba24adde7e46382daa1e4f0aad194e5232b83 (diff)
downloademacs-9d101376b42e51007e7f83b646e172c52251ae1e.tar.gz
emacs-9d101376b42e51007e7f83b646e172c52251ae1e.zip
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.
-rw-r--r--lisp/vc/smerge-mode.el2
-rw-r--r--test/lisp/vc/smerge-mode-tests.el34
2 files changed, 35 insertions, 1 deletions
diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index 112a9bc5247..91be89b5dc1 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -725,7 +725,7 @@ this keeps \"UUU\"."
725 (let ((i 3)) 725 (let ((i 3))
726 (while (or (not (match-end i)) 726 (while (or (not (match-end i))
727 (< (point) (match-beginning i)) 727 (< (point) (match-beginning i))
728 (>= (point) (match-end i))) 728 (> (point) (match-end i)))
729 (cl-decf i)) 729 (cl-decf i))
730 i)) 730 i))
731 731
diff --git a/test/lisp/vc/smerge-mode-tests.el b/test/lisp/vc/smerge-mode-tests.el
new file mode 100644
index 00000000000..204a4b93ab5
--- /dev/null
+++ b/test/lisp/vc/smerge-mode-tests.el
@@ -0,0 +1,34 @@
1;; Copyright (C) 2017 Free Software Foundation, Inc
2
3;; Maintainer: emacs-devel@gnu.org
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'smerge-mode)
23
24(ert-deftest smerge-mode-test-empty-hunk ()
25 "Regression test for bug #25555"
26 (with-temp-buffer
27 (insert "<<<<<<< one\n")
28 (save-excursion
29 (insert "=======\nLLL\n>>>>>>> end\n"))
30 (smerge-mode)
31 (smerge-keep-current)
32 (should (equal (buffer-substring (point-min) (point-max)) ""))))
33
34(provide 'smerge-mode-tests)