[Top][All Lists]

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

Re: suggested optimization for file-in-directory-p

From: Michael Albinus
Subject: Re: suggested optimization for file-in-directory-p
Date: Wed, 11 Nov 2015 11:58:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Harvey Chapman <address@hidden> writes:

Hi Harvey,

> This answer was provided and recommended to be passed along to this
> list in the hope that Tramp might make this optimization, too.

Thanks for this report. Yes, I have taken over this change for
`file-in-directory-p', and also for `file-equal-p'. Will be released
with Tramp 2.2.13 (later this year) and Emacs 25.1.

> +                          (equal (file-remote-p file)
> +                                 (file-remote-p topdir))

Here one could also use `string-equal', it is aware of handling a string
being nil.

More important, this works only if file and topdir are absolute file
names. `file-remote-p' returns nil for relative file names, look:

(let ((default-directory "/ssh::"))
  (file-remote-p "foo"))

=> nil

So the test shall be

(string-equal (file-remote-p (expand-file-name file))
              (file-remote-p (expand-file-name topdir)))

That's how I've implemented it in Tramp.

reply via email to

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