]> code.delx.au - gnu-emacs/blobdiff - lisp/smerge-mode.el
Added checks that distinguish between cygwin and windows in some
[gnu-emacs] / lisp / smerge-mode.el
index 5c8af81b492fdefac961a65bc63bee587373a95a..5ce9328048d931250c7aca5a556b6f49f9b982f2 100644 (file)
@@ -1,10 +1,10 @@
 ;;; smerge-mode.el --- Minor mode to resolve diff3 conflicts
 
-;; Copyright (C) 1999, 2000  Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000, 2001  Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
 ;; Keywords: merge diff3 cvs conflict
-;; Revision: $Id: smerge-mode.el,v 1.12 2001/03/07 00:16:29 monnier Exp $
+;; Revision: $Id: smerge-mode.el,v 1.14 2001/07/31 08:28:43 gerd Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -332,7 +332,7 @@ An error is raised if not inside a conflict."
                                  (when base-start (1- base-start)) base-start
                                  (1- other-start) other-start))
          t)
-      (error "Point not in conflict region"))))
+      (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.
@@ -350,12 +350,18 @@ The point is moved to the end of the conflict."
   (smerge-ensure-match n2)
   (let ((name1 (aref smerge-match-names n1))
        (name2 (aref smerge-match-names n2))
+       ;; Read them before the match-data gets clobbered.
+       (beg1 (match-beginning n1))
+       (end1 (match-end n1))
+       (beg2 (match-beginning n2))
+       (end2 (match-end n2))
        (file1 (make-temp-file "smerge1"))
        (file2 (make-temp-file "smerge2"))
        (dir default-directory)
-       (file (file-relative-name buffer-file-name)))
-    (write-region (match-beginning n1) (match-end n1) file1)
-    (write-region (match-beginning n2) (match-end n2) file2)
+       (file (file-relative-name buffer-file-name))
+       (coding-system-for-read buffer-file-coding-system))
+    (write-region beg1 end1 file1)
+    (write-region beg2 end2 file2)
     (unwind-protect
        (with-current-buffer (get-buffer-create smerge-diff-buffer-name)
          (setq default-directory dir)
@@ -465,7 +471,7 @@ The point is moved to the end of the conflict."
   "Minor mode to simplify editing output from the diff3 program.
 \\{smerge-mode-map}"
   nil " SMerge" nil
-  (when font-lock-mode
+  (when (and (boundp 'font-lock-mode) font-lock-mode)
     (set (make-local-variable 'font-lock-multiline) t)
     (save-excursion
       (if smerge-mode