[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: testing for a remote file to include file on a Windows mappeddrive

From: Stefan Monnier
Subject: Re: testing for a remote file to include file on a Windows mappeddrive
Date: Mon, 04 Feb 2008 16:55:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

> unhandled-file-name-directory is something that shall provide
> `call-process' and `start-process' with a suitable default
> directory. That's why Tramp always returns "~/", and ange-ftp does
> "/tmp/". It doesn't look like it is usable in the `process-file' and
> `start-file-process' cases.

It's not needed for process-file and start-file-process.

> file-relative-name might be sufficient in obvious cases:

>   (file-relative-name "/sudo::/var/syslog/syslog.log" "/sudo::")
>     => "../var/syslog/syslog.log"

> But:

>   (file-relative-name "/sudo::/var/syslog/syslog.log" "/ssh::")
>     => "/sudo:address@hidden:/var/syslog/syslog.log"

> This is correct, but inconvenient.

No, it's very convenient: file-name-absolute-p will then tell you if the
process can reach those files.

>> I suggest to change unhandled-file-name-directory so that it can (and
>> should) return nil if the named file/directory cannot be
>> directly accessed.

> ... from a local subprocess. It shall not be used for default
> directories of `process-file' and `start-file-process'.

Yes, indeed, I'm only concerned about call-process and start-process.

>> And then let users of unhandled-file-name-directory
>> default to "~/" if it returned nil.  Then we can define file-local-name
>> as follows:
>> (defun file-local-name/unhandled-file-name (file)
>> (setq file (expand-file-name file))
>> (let ((dir (unhandled-file-name-directory file)))
>> (if file (expand-file-name (file-name-nondirectory file) dir))))
>> or alternatively, we can add file-local-name/unhandled-file-name and
>> drop unhandled-file-name-directory (which can be defined then as
>> (defun unhandled-file-name-directory (file)
>> (unhandled-file-name (file-name-directory (expand-file-name
>> file))))

> I agree. It doesn't make sense for Tramp and ange-ftp, guessing what
> might be a good default directory for `call-process' and `start-process'.
> They shall simply apply `ignore'; alternatively it shall not be called
> per file-name-handler.

Not all file handlers are like Tramp: jka-compr and several others only
modify the way files are accessed, rather than providing access to
more files.  So it still needs to be a file-name-handler.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]