Commits

Anonymous committed dfa515a

fix replace in j-c-i-f-c <87add4bnn6.fsf_-_@tleepslib.sk.tsukuba.ac.jp>

Comments (0)

Files changed (2)

+2003-05-26  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* jka-compr.el (jka-compr-insert-file-contents): New docstring.
+	Implement REPLACE argument correctly.  Thanks to Martin Schwenke
+	<martin@meltin.net> for reporting and testing.  Bugfix suggested
+	by Richard Stallman <rms@gnu.org>.
+	(Maintainer): Update to XEmacs Development Team.
+
 2003-03-09  Ben Wing  <ben@xemacs.org>
 
 	* Makefile:
 ;; Copyright (C) 1993, 1994  Free Software Foundation, Inc.
 
 ;; Author: jka@ece.cmu.edu (Jay K. Adams)
-;; Maintainer: FSF
+;; Maintainer: XEmacs Development Team
 ;; Keywords: data
 
 ;; This file is part of XEmacs.
 
 
 (defun jka-compr-insert-file-contents (file &optional visit beg end replace)
+  "Insert contents of FILE in current buffer after point.
+Returns list of absolute file name and length of data inserted.
+
+If second argument VISIT is non-nil, the buffer's visited filename
+and last save file modtime are set, and it is marked unmodified.
+If visiting and the file does not exist, visiting is completed
+before the error is signaled.
+
+The optional third and fourth arguments BEG and END
+specify what portion of the file to insert.
+If VISIT is non-nil, BEG and END must be nil.
+If optional fifth argument REPLACE is non-nil,
+it means replace the current buffer contents (in the accessible portion)
+with the file contents.  This is better than simply deleting and inserting
+the whole thing because (1) it preserves some marker positions
+and (2) it puts less data in the undo list.  (#### Is (2) true?)
+
+Coding system determination differs from `insert-file-contents'.  It is set
+to 'undecided unless `coding-system-for-read' is bound.  WARNING: That means
+this function is likely broken under Mule.  Use jka-compr at your own risk
+in Mule Emacsen."
   (barf-if-buffer-read-only)
 
   (and (or beg end)
 						  uncompress-args)))
 		      (setq size (- (point) start))
 		      (if replace
-			  (let* ((del-beg (point))
-				 (del-end (+ del-beg size)))
-			    (delete-region del-beg
-					   (min del-end (point-max)))))
+			  (delete-region (point) (point-max)))
 		      (goto-char start))
 		  (error
 		   (if (and (eq (car error-code) 'file-error)