Subject: 24.0.50; Can't load remote elc.gz file using tramp-ftp

From: Katsumi Yamaoka <[email-masked]>
Date: Fri, 27 Aug 2010 17:02:32 +0900

Hi,

Now there is the file gnus.elc.gz in: /ftp:ftp.jpl.org:/pub/tmp/lisp
You can see this one fails:

(let ((load-path (cons "/ftp:ftp.jpl.org:/pub/tmp/lisp" load-path)))
  (load "gnus"))

;; (require 'gnus) also fails.

This might not be a bug and there might not be a demand either,
but loading elc.gz file using tramp-ssh succeeds (you don't have
access to this, sorry):

(let ((load-path (cons "/ssh:jpl.org:~/ftp/pub/tmp/lisp" load-path)))
  (load "gnus"))

It seems easy to solve.  How about the attached patch?

BTW, after starting Emacs, I needed to do tramp-ftp (e.g. dired)
to the remote site before testing the above two items.  If not,
I got the error `Variable binding depth exceeds max-specpdl-size'
for unknown reason.  At that time, there were many "*ftp-.netrc*<N>"
buffers, in which `buffer-file-name' was "~/.netrc".  I'd like to
investigate this when I have time.

Regards,

--8<---------------cut here---------------start------------->8---
--- ange-ftp.el~	2010-05-28 00:48:36 +0000
+++ ange-ftp.el	2010-08-27 05:59:12 +0000
@@ -1728,11 +1728,12 @@
 ;;; Temporary file location and deletion...
 ;;; ------------------------------------------------------------
 
-(defun ange-ftp-make-tmp-name (host)
+(defun ange-ftp-make-tmp-name (host &optional suffix)
   "This routine will return the name of a new file."
   (make-temp-file (if (ange-ftp-use-gateway-p host)
 		      ange-ftp-gateway-tmp-name-template
-		    ange-ftp-tmp-name-template)))
+		    ange-ftp-tmp-name-template)
+		  nil suffix))
 
 (defun ange-ftp-del-tmp-name (filename)
   "Force to delete temporary file."
@@ -4158,7 +4159,8 @@
   (let* ((fn1 (expand-file-name file))
 	 (pa1 (ange-ftp-ftp-name fn1)))
     (if pa1
-	(let ((tmp1 (ange-ftp-make-tmp-name (car pa1))))
+	(let ((tmp1 (ange-ftp-make-tmp-name (car pa1)
+					    (file-name-extension file t))))
 	  (ange-ftp-copy-file-internal fn1 tmp1 t nil
 				       (format "Getting %s" fn1))
 	  tmp1))))
--8<---------------cut here---------------end--------------->8---