Subject: Re: 23.3; Can't visit VMS file from Windows Emacs 23.3.1

From: Michael Albinus <[email-masked]>
Date: Wed, 31 Aug 2011 13:39:14 +0200

[email-masked] writes:

> Michael,

Hi Alan,

> Please find attached the contents of the *trace-output* and *ftp
> grunwald@confid* buffers afetr I executed
>
> C-x C-f /grunwald@confid:login.com
>
> Best of luck :-)

Thanks, it helps :-)

The following call is guilty:

8 -> ange-ftp-fix-name-for-vms: name="\"/$DISK1!/GRUNWALD/\"" reverse=nil
8 <- ange-ftp-fix-name-for-vms: "[.\".$DISK1!.GRUNWALD]\""

This reminds me, that we have changed the quoting for file names a while
ago. This results in surrounding a file name under Windows by '"', like
"/$DISK1!/GRUNWALD/".  Obviously, ange-ftp-fix-name-for-vms must be
aware of it.

Could you, please, check whether the following patch helps?

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs-23/lisp/net/ange-ftp.el.~100624~	2011-08-31 13:30:47.905559520 +0200
--- /home/albinus/src/emacs-23/lisp/net/ange-ftp.el	2011-08-31 13:28:25.395350494 +0200
***************
*** 5017,5023 ****
  		      dir (and dir "/")
  		      file))
  	  (error "name %s didn't match" name))
!       (let (drive dir file tmp)
  	(if (string-match "\\`/[^:]+:/" name)
  	    (setq drive (substring name 1
  				   (1- (match-end 0)))
--- 5017,5027 ----
  		      dir (and dir "/")
  		      file))
  	  (error "name %s didn't match" name))
!       (let (drive dir file tmp quote)
! 	(if (string-match "\\`\".+\"\\'" name)
! 	    (setq name (substring name 1 -1)
! 		  quote "\"")
! 	  (setq quote ""))
  	(if (string-match "\\`/[^:]+:/" name)
  	    (setq drive (substring name 1
  				   (1- (match-end 0)))
***************
*** 5026,5034 ****
  	(if tmp
  	    (setq dir (subst-char-in-string ?/ ?. (substring tmp 0 -1) t)))
  	(setq file (file-name-nondirectory name))
! 	(concat drive
  		(and dir (concat "[" (if drive nil ".") dir "]"))
! 		file)))))
  
  ;; (ange-ftp-fix-name-for-vms "/PUB$:/ANONYMOUS/SDSCPUB/NEXT/Readme.txt;1")
  ;; (ange-ftp-fix-name-for-vms "/PUB$:[ANONYMOUS.SDSCPUB.NEXT]Readme.txt;1" t)
--- 5030,5038 ----
  	(if tmp
  	    (setq dir (subst-char-in-string ?/ ?. (substring tmp 0 -1) t)))
  	(setq file (file-name-nondirectory name))
! 	(concat quote drive
  		(and dir (concat "[" (if drive nil ".") dir "]"))
! 		file quote)))))
  
  ;; (ange-ftp-fix-name-for-vms "/PUB$:/ANONYMOUS/SDSCPUB/NEXT/Readme.txt;1")
  ;; (ange-ftp-fix-name-for-vms "/PUB$:[ANONYMOUS.SDSCPUB.NEXT]Readme.txt;1" t)
--8<---------------cut here---------------end--------------->8---

> Alan

Best regards, Michael.