bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

smerge-match-conflict


From: Per Starback
Subject: smerge-match-conflict
Date: Sun, 11 Nov 2001 15:14:38 +0100

GNU Emacs 21.1:

This is really two bugs in the same function, one of them being fixed
in the included patch, but the other not.  My reason for reporting them
together is that the best way I know of showing them is with the same
example.

Create a conflict like this:

$ mkdir /tmp/bug
$ export CVSROOT=/tmp/bug/cvsroot
$ cvs init
$ cd /tmp/bug
$ mkdir foosrc
$ cd foosrc
$ touch bar
$ cvs import -m imported foo foo start
$ cd ..
$ cvs co -d foo1 foo
$ cvs co -d foo2 foo
$ echo -n text1 >foo1/bar
$ echo -n text2 >foo2/bar
$ cvs commit -m first foo1/bar
$ emacs -q foo2/bar

        C-x v v

Emacs now asks "bar is not up-to-date. Merge in changes now? (yes or no) "

        y e s RET

Emacs next asks "Conflicts detected.  Resolve them now? (y or n) "

        y

This yields the error

        smerge-ediff: Wrong type argument: stringp, nil

Explanation and partial fix
---------------------------

Note that the buffer bar<2> now contains

        <<<<<<< bar
        text2=======
        text1>>>>>>> 1.2
        
Since the "========" sequence doesn't start on a new line
smerge-match-conflict doesn't find it with the help of
smerge-other-re.  If I terminate the contents of the "bar" files with
newline there is no problem.  So this is bug #1.  I guess looking for
"=======" that doesn't start a new line might produce too many
false hits.  Maybe "(diff)Merging Incomplete Lines" is of use here.
Or maybe it's not worth fixing this.

Anyway, when smerge-find-conclict calls smerge-match-conflict it will
ignore-errors, but smerge-match-conflict doesn't yield an error since
it does ignore-errors itself, and only returns the string
"Point not in conflict region" when the search for smerge-other-re
doesn't succeed.  The documentation for smerge-match-conflict says
that

        An error is raised if not inside a conflict.

But it doesn't, and that is bug #2.  This change makes that so.  I
made smerge-match-conflict only catch search-failed errors, since that
is the only error it is prepared for, as far as I understand.

======================================================================
*** smerge-mode.el.~1.14~       Tue Jul 31 10:28:43 2001
--- smerge-mode.el      Sun Nov 11 14:32:45 2001
***************
*** 332,338 ****
                                  (when base-start (1- base-start)) base-start
                                  (1- other-start) other-start))
          t)
!       (error "Point not in conflict region"))))
  
  (defun smerge-find-conflict (&optional limit)
    "Find and match a conflict region.  Intended as a font-lock MATCHER.
--- 332,338 ----
                                  (when base-start (1- base-start)) base-start
                                  (1- other-start) other-start))
          t)
!       (search-failed (error "Point not in conflict region")))))
  
  (defun smerge-find-conflict (&optional limit)
    "Find and match a conflict region.  Intended as a font-lock MATCHER.
======================================================================

With this change the cvs conflict example doesn't yield an error at
least.  You have to do the conflict resolution by hand though, because
of bug #1.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]