From: Michael Albinus <michael.albinus@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tom@tomhunt.email, 64401@debbugs.gnu.org
Subject: bug#64401: 28.1; Desktop restoration
Date: Mon, 03 Jul 2023 19:47:06 +0200 [thread overview]
Message-ID: <87ttukopk5.fsf@gmx.de> (raw)
In-Reply-To: <87h6qm38i3.fsf@gmx.de> (Michael Albinus's message of "Sun, 02 Jul 2023 12:36:36 +0200")
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.
next prev parent reply other threads:[~2023-07-03 17:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 17:52 bug#64401: 28.1; Desktop restoration Tom Hunt
2023-07-01 18:43 ` Eli Zaretskii
2023-07-01 18:46 ` Tom Hunt
2023-07-01 18:54 ` Eli Zaretskii
2023-07-02 8:29 ` Michael Albinus
2023-07-02 8:37 ` Eli Zaretskii
2023-07-02 9:23 ` Michael Albinus
2023-07-02 10:02 ` Eli Zaretskii
2023-07-02 10:36 ` Michael Albinus
2023-07-03 17:47 ` Michael Albinus [this message]
2023-07-04 13:30 ` Michael Albinus
2023-07-12 14:16 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ttukopk5.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=64401@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=tom@tomhunt.email \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).