changeset 41064:cdd9ef6f603d

(smerge-match-conflict): Fix typo. (smerge-diff): Be careful to read match-data early enough.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 15 Nov 2001 01:25:35 +0000
parents dfe821140b60
children af0215d05281
files lisp/smerge-mode.el
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/smerge-mode.el	Thu Nov 15 00:34:53 2001 +0000
+++ b/lisp/smerge-mode.el	Thu Nov 15 01:25:35 2001 +0000
@@ -4,7 +4,7 @@
 
 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
 ;; Keywords: merge diff3 cvs conflict
-;; Revision: $Id: smerge-mode.el,v 1.13 2001/07/31 08:26:47 gerd 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 @@
 				  (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 @@
   (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)