[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64401: 28.1; Desktop restoration
From: |
Michael Albinus |
Subject: |
bug#64401: 28.1; Desktop restoration |
Date: |
Mon, 03 Jul 2023 19:47:06 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Michael Albinus <michael.albinus@gmx.de> writes:
Hi Eli,
>> Also, the implementation should probably "remember" the result and
>> apply it to all the other files on the same volume?
>
> Hmm, this will be harder. `access-file' could fail for different
> reasons. And Tramp does not know whether two remote files belong to the
> same volume. Well, there is `file-attribute-device-number', but this is
> not trustworthy for all different kind of remote file systems.
>
> I'll see whether I can implement a cache for different volumes on remote
> hosts where it makes sense.
Going through the Tramp implementation, there's no need for such a
cache. The usual Tramp cache does it already sufficiently.
Either a file has already cached information, then that's fine. Or it
has no cache information, then we would need to call file-attributes
first in order to get the device number, and then it is in the cache.
Finally, I've pushed a fix to master along the idea sketched in this
thread. I've decided to set the default of remote-file-name-access-timeout
to nil (which preserves the existing behavior). There are so many
different possibilities I couldn't decide for a sensitive value.
The Tramp manual explains now
--8<---------------cut here---------------start------------->8---
Some packages, like ‘desktop.el’ or ‘recentf.el’, access remote
files when loaded. If the respective file is not accessible, TRAMP
could block. In order to check whether this could happen, add a
test via ‘access-file’ with a proper timeout prior loading these
packages:
(let ((remote-file-name-access-timeout 10))
(access-file "/method:user@host:/path/to/file" "error"))
⇒ nil
The result ‘nil’ means success. If the file is not accessible, or
if the underlying operations last too long, ‘access-file’ returns
with an error.
The value of the timeout (10 seconds in the example) depends on
your preference and on the quality of the connection to the remote
host. If the connection to the remote host isn’t established yet,
and if this requires an interactive password, the timeout check
doesn’t work properly.
--8<---------------cut here---------------end--------------->8---
Better would be, if desktop.el and recentf.el do this check on their
own. recentf.el uses file-readable-p (in recentf-keep-default-predicate).
desktop.el usually skips Tramp files (in desktop-files-not-to-save), but
this could be changed. In general it uses file-exists-p (in
desktop-restore-file-buffer) for a check before restoring.
Both implementations should be changed to use access-file instead. Will
try it next days. Do you know other packages in vanilla Emacs which
could profit from this mechanism?
And then we would need a good place to train users of desktop.el and
recentf.el to adapt remote-file-name-access-timeout - I have no idea
where.
>> Thanks.
Best regards, Michael.
- bug#64401: 28.1; Desktop restoration, Tom Hunt, 2023/07/01
- bug#64401: 28.1; Desktop restoration, Eli Zaretskii, 2023/07/01
- bug#64401: 28.1; Desktop restoration, Tom Hunt, 2023/07/02
- bug#64401: 28.1; Desktop restoration, Eli Zaretskii, 2023/07/01
- bug#64401: 28.1; Desktop restoration, Michael Albinus, 2023/07/02
- bug#64401: 28.1; Desktop restoration, Eli Zaretskii, 2023/07/02
- bug#64401: 28.1; Desktop restoration, Michael Albinus, 2023/07/02
- bug#64401: 28.1; Desktop restoration, Eli Zaretskii, 2023/07/02
- bug#64401: 28.1; Desktop restoration, Michael Albinus, 2023/07/02
- bug#64401: 28.1; Desktop restoration,
Michael Albinus <=
- bug#64401: 28.1; Desktop restoration, Michael Albinus, 2023/07/04
- bug#64401: 28.1; Desktop restoration, Michael Albinus, 2023/07/12