Gnus development mailing list
 help / color / mirror / Atom feed
From: Jan Vroonhof <vroonhof@math.ethz.ch>
Cc: Jan Vroonhof <vroonhof@math.ethz.ch>,
	ding@gnus.org, xemacs-patches@xemacs.org,
	efs-bugs@hplb.hpl.hp.com
Subject: Re: MIME attachments?
Date: Tue, 15 Jun 1999 20:52:19 +0200	[thread overview]
Message-ID: <19990615205219.A7475@riesz.math.ethz.ch> (raw)
In-Reply-To: <86vhcpcpb4.fsf@kramer.in.aventail.com>; from William M. Perry on Tue, Jun 15, 1999 at 11:05:19AM -0700

> > > You have to use insert-file-contents if you want to be able to attach files 
> > > through efs / ange-ftp / rcp / whatever.
> > 
> > That is a bug in insert-file-contents-literally, it really should be made
> > a file-handler method. Apperently FSF Emacs 20.4 already contains a a
>
> I don't think I quite understand how you would make
> insert-file-contents-literally work for EFS files and yet not let things
> like jka-compr and friends get at it.

Simply let jka-compr and friends not implement it, like this (note the 
absence of any patch to jka-comp.el). Only kai has get to work to do
this for rcp.el:

1999-06-15  Jan Vroonhof  <vroonhof@math.ethz.ch>

	* efs.el (efs-insert-file-contents-general): Generalized i-f-c
	function derived from old i-f-c function.
	(efs-insert-file-contents): Use it.
	(efs-insert-file-contents-literally): Use it.

	* files.el (insert-file-contents-literally): Use binary coding
	system (from Morioka san).
	(insert-file-contents-literally): Make file-name-handler method.

	

Index: lisp/files.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs-20/lisp/files.el,v
retrieving revision 1.31
diff -u -u -r1.31 files.el
--- files.el	1999/05/13 12:19:37	1.31
+++ files.el	1999/06/16 02:26:06
@@ -874,23 +874,31 @@
 (defun insert-file-contents-literally (filename &optional visit beg end replace)
   "Like `insert-file-contents', q.v., but only reads in the file.
 A buffer may be modified in several ways after reading into the buffer due
-to advanced Emacs features, such as file-name-handlers, format decoding,
-find-file-hooks, etc.
+to advanced Emacs features, such as format decoding, character code
+conversion,find-file-hooks, automatic uncompression, etc.
+
   This function ensures that none of these modifications will take place."
-  (let ((file-name-handler-alist nil)
-	(format-alist nil)
-	(after-insert-file-functions nil)
-	(find-buffer-file-type-function
-	 (if (fboundp 'find-buffer-file-type)
-	     (symbol-function 'find-buffer-file-type)
-	   nil)))
-    (unwind-protect
-	(progn
-	  (fset 'find-buffer-file-type (lambda (filename) t))
-	  (insert-file-contents filename visit beg end replace))
-      (if find-buffer-file-type-function
-	  (fset 'find-buffer-file-type find-buffer-file-type-function)
-	(fmakunbound 'find-buffer-file-type)))))
+  (let ((wrap-func (find-file-name-handler filename
+					   'insert-file-contents-literally)))
+    (if wrap-func 
+	(funcall wrap-func 'insert-file-contents-literally filename
+		 visit beg end replace)
+      (let ((file-name-handler-alist nil)
+	    (format-alist nil)
+	    (after-insert-file-functions nil)
+	    (coding-system-for-read 'binary)
+	    (coding-system-for-read 'binary)
+	    (find-buffer-file-type-function
+	     (if (fboundp 'find-buffer-file-type)
+		 (symbol-function 'find-buffer-file-type)
+	       nil)))
+	(unwind-protect
+	    (progn
+	      (fset 'find-buffer-file-type (lambda (filename) t))
+	      (insert-file-contents filename visit beg end replace))
+	  (if find-buffer-file-type-function
+	      (fset 'find-buffer-file-type find-buffer-file-type-function)
+	    (fmakunbound 'find-buffer-file-type)))))))
 
 (defun find-file-noselect (filename &optional nowarn rawfile)
   "Read file FILENAME into a buffer and return the buffer.


diff -u /scratch/vroonhof/cvs/xemacs-20/xemacs-packages/lisp/efs/efs.el~ /scratch/vroonhof/cvs/xemacs-20/xemacs-packages/lisp/efs/efs.el
--- /scratch/vroonhof/cvs/xemacs-20/xemacs-packages/lisp/efs/efs.el~	Tue Jun 15 20:45:13 1999
+++ /scratch/vroonhof/cvs/xemacs-20/xemacs-packages/lisp/efs/efs.el	Tue Jun 15 20:45:13 1999
@@ -88,6 +88,7 @@
 ;;; get-file-buffer
 ;;; insert-directory
 ;;; insert-file-contents
+;;; insert-file-contents-literally
 ;;; list-directory
 ;;; make-directory-internal
 ;;; rename-file
@@ -7011,10 +7012,21 @@
 	    (efs-set-buffer-mode))
 	(error "efs-write-region called for a local file")))))
 
-(defun efs-insert-file-contents (filename &optional visit &rest args)
+(defun efs-insert-file-contents (filename &rest args)
   ;; Inserts file contents for remote files.
   ;; The additional ARGS covers V19 BEG and END. Should also handle the
   ;; CODING-SYSTEM arg for mule. Hope the two don't trip over each other.
+  (apply 'efs-insert-file-contents-general 'insert-file-contents filename args))
+
+(defun efs-insert-file-contents-literally (filename &rest args)
+  ;; Inserts file contents for remote files.
+  ;; The additional ARGS covers V19 BEG and END. Should also handle the
+  ;; CODING-SYSTEM arg for mule. Hope the two don't trip over each other.
+  (apply 'efs-insert-file-contents-general 'insert-file-contents-literally
+	 filename args))
+
+(defun efs-insert-file-contents-general
+         (handled-func filename &optional visit &rest args)  
   (barf-if-buffer-read-only)
   (unwind-protect
       (let* ((filename (expand-file-name filename))
@@ -7055,7 +7067,7 @@
 		   (format "Retrieving %s" abbr)
 		   (efs-cont (result line cont-lines) (filename visit buffer
 								host-type
-								temp args)
+								temp handled-func args)
 		     (if result
 			 (signal 'ftp-error
 				 (list "Opening input file"
@@ -7073,7 +7085,7 @@
 				   (file-readable-p temp))
 			       
 			       (setq i-f-c-size
-				   (nth 1 (apply 'insert-file-contents
+				     (nth 1 (apply handled-func
 						 temp visit args)))
 			     (signal 'ftp-error
 				     (list
@@ -10449,6 +10461,7 @@
 
 ;; I/O
 (put 'insert-file-contents 'efs 'efs-insert-file-contents)
+(put 'insert-file-contents-literally 'efs 'efs-insert-file-contents-literally)
 (put 'write-region 'efs 'efs-write-region)
 (put 'directory-files 'efs 'efs-directory-files)
 (put 'list-directory 'efs 'efs-list-directory)



  reply	other threads:[~1999-06-15 18:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-15 14:32 Hamish Macdonald
1999-06-15 14:46 ` Norman Walsh
1999-06-15 14:53 ` Hamish Macdonald
1999-06-15 14:58   ` Hamish Macdonald
1999-06-15 15:34     ` Hamish Macdonald
1999-06-15 15:45       ` Hamish Macdonald
1999-06-15 15:58         ` William M. Perry
1999-06-15 16:05           ` Alexandre Oliva
1999-06-15 16:11             ` Didier Verna
1999-06-15 16:11           ` Hrvoje Niksic
1999-06-15 16:26           ` Kyle Jones
1999-06-15 16:33             ` Hamish Macdonald
1999-06-15 17:57               ` Kyle Jones
1999-07-03  9:28           ` Lars Magne Ingebrigtsen
1999-07-03 12:40             ` Hrvoje Niksic
1999-07-04  4:42               ` Lars Magne Ingebrigtsen
1999-06-15 17:24         ` Jan Vroonhof
1999-06-15 17:30           ` William M. Perry
1999-06-15 17:43             ` Jan Vroonhof
1999-06-15 18:05               ` William M. Perry
1999-06-15 18:52                 ` Jan Vroonhof [this message]
1999-06-15 15:00   ` Lee Willis
1999-06-15 18:56 XEmacs Patches Moderator Robot
1999-06-15 19:04 ` Jan Vroonhof

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19990615205219.A7475@riesz.math.ethz.ch \
    --to=vroonhof@math.ethz.ch \
    --cc=ding@gnus.org \
    --cc=efs-bugs@hplb.hpl.hp.com \
    --cc=xemacs-patches@xemacs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).