CVS update by michaels xemacs/lisp ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Tue Dec 5 03:21:05 EST 2006


  User: michaels
  Date: 06/12/05 09:21:05

  Modified:    xemacs/lisp ChangeLog code-files.el
Log:
2006-11-30  Mike Sperber  <mike at xemacs.org>

	* fileio.c (Finsert_file_contents_internal): Don't call the
	file-name handler for `insert-file-contents' from here, which is
	too late.  Instead, do it from Lisp.SSper

2006-11-30  Mike Sperber  <mike at xemacs.org>

	* code-files.el (insert-file-contents): Call the file-name handler
	from Lisp, not from `insert-file-contents-internal', which is too late.

Revision  Changes    Path
1.1027    +6 -0      XEmacs/xemacs/src/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1026
retrieving revision 1.1027
diff -u -p -r1.1026 -r1.1027
--- ChangeLog	2006/12/04 09:25:04	1.1026
+++ ChangeLog	2006/12/05 08:20:54	1.1027
@@ -1,3 +1,9 @@
+2006-11-30  Mike Sperber  <mike at xemacs.org>
+
+	* fileio.c (Finsert_file_contents_internal): Don't call the
+	file-name handler for `insert-file-contents' from here, which is
+	too late.  Instead, do it from Lisp.SSper
+
 2006-11-29  Dr. Volker Zell  <Dr.Volker.Zell at oracle.com>
 
 	* sysdir.h: Revert workaround missing d_ino field from 'struct



1.108     +0 -10     XEmacs/xemacs/src/fileio.c

Index: fileio.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -p -r1.107 -r1.108
--- fileio.c	2006/11/01 20:25:50	1.107
+++ fileio.c	2006/12/05 08:20:56	1.108
@@ -2844,16 +2844,6 @@ under Mule, is very difficult.)
 
   filename = Fexpand_file_name (filename, Qnil);
 
-  /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
-  handler = Ffind_file_name_handler (filename, Qinsert_file_contents);
-  if (!NILP (handler))
-    {
-      val = call6 (handler, Qinsert_file_contents, filename,
-		   visit, start, end, replace);
-      goto handled;
-    }
-
   if (!NILP (used_codesys))
     CHECK_SYMBOL (used_codesys);
 



1.776     +5 -0      XEmacs/xemacs/lisp/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.775
retrieving revision 1.776
diff -u -p -r1.775 -r1.776
--- ChangeLog	2006/11/30 07:29:34	1.775
+++ ChangeLog	2006/12/05 08:21:02	1.776
@@ -1,3 +1,8 @@
+2006-11-30  Mike Sperber  <mike at xemacs.org>
+
+	* code-files.el (insert-file-contents): Call the file-name handler
+	from Lisp, not from `insert-file-contents-internal', which is too late.
+
 2006-11-28  Mike Sperber  <mike at xemacs.org>
 
 	* files.el (revert-buffer-internal): Determine the coding system



1.20      +84 -80    XEmacs/xemacs/lisp/code-files.el

Index: code-files.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/code-files.el,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -p -r1.19 -r1.20
--- code-files.el	2003/10/07 21:52:15	1.19
+++ code-files.el	2006/12/05 08:21:03	1.20
@@ -382,86 +382,90 @@ coding-system determination procedure.
 See also `insert-file-contents-access-hook',
 `insert-file-contents-pre-hook', `insert-file-contents-error-hook',
 and `insert-file-contents-post-hook'."
-  (let (return-val coding-system used-codesys)
-    ;; OK, first load the file.
-    (condition-case err
-	(progn
-	  (run-hook-with-args 'insert-file-contents-access-hook
-			      filename visit)
-	  ;; determine the coding system to use, as described above.
-	  (setq coding-system
-		(or
-		 ;; #1.
-		 coding-system-for-read
-		 ;; #2.
-		 (run-hook-with-args-until-success
-		  'insert-file-contents-pre-hook
-		  filename visit)
-		 ;; #3.
-		 (find-file-coding-system-for-read-from-filename filename)
-		 ;; #4.
-		 buffer-file-coding-system-for-read
-		 ;; #5.
-		 'raw-text))
-	  (if (consp coding-system)
-	      (setq return-val coding-system)
-	    (if (null (find-coding-system coding-system))
-		(progn
-		  (lwarn 'coding-system 'notice
-		   "Invalid coding-system (%s), using 'undecided"
-		   coding-system)
-		  (setq coding-system 'undecided)))
-	    (setq return-val
-		  (insert-file-contents-internal filename visit start end
-						 replace coding-system
-						 ;; store here!
-						 'used-codesys))
-	    ))
-      (file-error
-       (run-hook-with-args 'insert-file-contents-error-hook
-			   filename visit err)
-       (signal (car err) (cdr err))))
-    (setq coding-system used-codesys)
-    ;; call any `post-read-conversion' for the coding system that
-    ;; was used ...
-    (let ((func
-	   (coding-system-property coding-system 'post-read-conversion))
-	  (endmark (make-marker)))
-      (set-marker endmark (+ (point) (nth 1 return-val)))
-      (if func
-	  (unwind-protect
-	      (save-excursion
-		(let (buffer-read-only)
-		  (if (>= (function-max-args func) 2)
-		      ;; #### fuckme!  Someone at FSF changed the calling
-		      ;; convention of post-read-conversion.  We try to
-		      ;; support the old way.  #### Should we kill this?
-		      (funcall func (point) (marker-position endmark))
-		    (funcall func (- (marker-position endmark) (point))))))
-	    (if visit
-		(progn
-		  (set-buffer-auto-saved)
-		  (set-buffer-modified-p nil)))))
-      (setcar (cdr return-val) (- (marker-position endmark) (point))))
-    ;; now finally set the buffer's `buffer-file-coding-system' ...
-    (if (run-hook-with-args-until-success 'insert-file-contents-post-hook
-					  filename visit return-val)
-	nil
-      (if (local-variable-p 'buffer-file-coding-system (current-buffer))
-	  ;; if buffer-file-coding-system is already local, just
-	  ;; set its eol type to what was found, if it wasn't
-	  ;; set already.
-	  (set-buffer-file-coding-system
-	   (subsidiary-coding-system buffer-file-coding-system
-				     (coding-system-eol-type coding-system)) t)
-	;; otherwise actually set buffer-file-coding-system.
-	(set-buffer-file-coding-system coding-system t)))
-    ;; ... and `buffer-file-coding-system-when-loaded'.  the machinations
-    ;; of set-buffer-file-coding-system cause the actual coding system
-    ;; object to be stored, so do that here, too.
-    (setq buffer-file-coding-system-when-loaded 
-	  (get-coding-system coding-system))
-    return-val))
+  (let* ((expanded (substitute-in-file-name filename))
+	 (handler (find-file-name-handler expanded 'insert-file-contents)))
+    (if handler
+	(funcall handler 'insert-file-contents filename visit start end replace)
+      (let (return-val coding-system used-codesys)
+	;; OK, first load the file.
+	(condition-case err
+	    (progn
+	      (run-hook-with-args 'insert-file-contents-access-hook
+				  filename visit)
+	      ;; determine the coding system to use, as described above.
+	      (setq coding-system
+		    (or
+		     ;; #1.
+		     coding-system-for-read
+		     ;; #2.
+		     (run-hook-with-args-until-success
+		      'insert-file-contents-pre-hook
+		      filename visit)
+		     ;; #3.
+		     (find-file-coding-system-for-read-from-filename filename)
+		     ;; #4.
+		     buffer-file-coding-system-for-read
+		     ;; #5.
+		     'raw-text))
+	      (if (consp coding-system)
+		  (setq return-val coding-system)
+		(if (null (find-coding-system coding-system))
+		    (progn
+		      (lwarn 'coding-system 'notice
+			"Invalid coding-system (%s), using 'undecided"
+			coding-system)
+		      (setq coding-system 'undecided)))
+		(setq return-val
+		      (insert-file-contents-internal filename visit start end
+						     replace coding-system
+						     ;; store here!
+						     'used-codesys))
+		))
+	  (file-error
+	   (run-hook-with-args 'insert-file-contents-error-hook
+			       filename visit err)
+	   (signal (car err) (cdr err))))
+	(setq coding-system used-codesys)
+	;; call any `post-read-conversion' for the coding system that
+	;; was used ...
+	(let ((func
+	       (coding-system-property coding-system 'post-read-conversion))
+	      (endmark (make-marker)))
+	  (set-marker endmark (+ (point) (nth 1 return-val)))
+	  (if func
+	      (unwind-protect
+		  (save-excursion
+		    (let (buffer-read-only)
+		      (if (>= (function-max-args func) 2)
+			  ;; #### fuckme!  Someone at FSF changed the calling
+			  ;; convention of post-read-conversion.  We try to
+			  ;; support the old way.  #### Should we kill this?
+			  (funcall func (point) (marker-position endmark))
+			(funcall func (- (marker-position endmark) (point))))))
+		(if visit
+		    (progn
+		      (set-buffer-auto-saved)
+		      (set-buffer-modified-p nil)))))
+	  (setcar (cdr return-val) (- (marker-position endmark) (point))))
+	;; now finally set the buffer's `buffer-file-coding-system' ...
+	(if (run-hook-with-args-until-success 'insert-file-contents-post-hook
+					      filename visit return-val)
+	    nil
+	  (if (local-variable-p 'buffer-file-coding-system (current-buffer))
+	      ;; if buffer-file-coding-system is already local, just
+	      ;; set its eol type to what was found, if it wasn't
+	      ;; set already.
+	      (set-buffer-file-coding-system
+	       (subsidiary-coding-system buffer-file-coding-system
+					 (coding-system-eol-type coding-system)) t)
+	    ;; otherwise actually set buffer-file-coding-system.
+	    (set-buffer-file-coding-system coding-system t)))
+	;; ... and `buffer-file-coding-system-when-loaded'.  the machinations
+	;; of set-buffer-file-coding-system cause the actual coding system
+	;; object to be stored, so do that here, too.
+	(setq buffer-file-coding-system-when-loaded 
+	      (get-coding-system coding-system))
+	return-val))))
 
 (defvar write-region-pre-hook nil
   "A special hook to decide the coding system used for writing out a file.





More information about the XEmacs-CVS mailing list