[Top][All Lists]

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

Re: File path completions: strange speed discrepancy

From: Michael Albinus
Subject: Re: File path completions: strange speed discrepancy
Date: Tue, 21 Sep 2021 15:15:06 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

JD Smith <> writes:


> OK I believe I’ve cracked it.


> And, at long last, HERE we see the problem, in
> `tramp-compat-temporary-file-directory':
>     (eval (car (get 'temporary-file-directory 'standard-value)) t))
> Why is this an issue?  That standard value of
> `temporary-file-directory' contains, for 'darwin systems:
>     (shell-command-to-string \"getconf DARWIN_USER_TEMP_DIR\"))))

When I wrote tramp-compat-temporary-file-directory, I didn't expect an
external process is spawned. But I don't use macOS ...

> One thing I don’t understand is why tramp needs to re-evaluate the
> standard value of the variable `temporary-file-directory’ at all. 
> That variable doesn’t appear to change on remote hosts, or ever
> really.  What does change is the returned result of the
> identically-name function `temporary-file-directory’.  

Tramp needs a trustworthy value on the local host. There were bug
reports, that this variable got another value, somewhere else (even
remote!), which has broken Tramp. That's why I have introduced this

> A quick fix for me was simply to (see FIXED timing, below):
>     (defsubst tramp-compat-temporary-file-directory ()
>       "Return name of directory for temporary files.
>     It is the default value of `temporary-file-directory'."
>       temporary-file-directory)

I have fixed this slightly different: I've changed the defsubst to a
defconst. All callees need to be changed, but that's simple.

Will be available with next Tramp, roughly in a week.

> I note that this remains an issue in Emacs 28.1 and Tramp v2.5.1.2.

Yes, there are still discrepancies in my tests (I'm running GNU/Linux),
mainly in tramp-sh-handle-expand-file-name:

Running on "/"

read-file-name-default                          1           0.866070978   
completing-read                                 1           0.864735142   
completion-file-name-table                      21          0.7882453620  

Running on "/ssh::"

read-file-name-default                          1           6.540671391   
tramp-sh-handle-expand-file-name                408         4.9722099110  
completing-read                                 1           1.586810819   
completion-file-name-table                      21          1.3919740299  

So there is still something to be investigated in
tramp-sh-handle-expand-file-name. But since this is the test case we have
started on a remote default-directory, it might be OK. At least the time
for tramp-sh-handle-expand-file-name is not cumulated in
completing-read. Will see.

> Thanks for your help with this (and as always, for Tramp, which is
> unique and incredibly useful).

I have to thank for your investigation and patience. I wouldn't find it
ever, because I have no macOS.

> Best,

Best regards, Michael.

reply via email to

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