current @code{recentf-list} to a file, and @kbd{M-x recentf-edit-list}
edits it.
+@vindex remote-file-name-access-timeout
+ If you use remote files, you might also consider to customize
+@code{remote-file-name-access-timeout} to a proper value (number of
+seconds), after which time a check whether a remote file shall be used
+in Recentf is stopped. This prevents Emacs to be blocked.
+
@c FIXME partial-completion-mode (complete.el) is obsolete.
The @kbd{M-x ffap} command generalizes @code{find-file} with more
powerful heuristic defaults (@pxref{FFAP}), often based on the text at
according to your customizations in the init file.
@vindex desktop-files-not-to-save
+@vindex remote-file-name-access-timeout
Information about buffers visiting remote files is not saved by
default. Customize the variable @code{desktop-files-not-to-save} to
-change this.
+change this. In this case, you might also consider to customize
+@code{remote-file-name-access-timeout} to a proper value (number of
+seconds), after which time a buffer restoration of a remote file is
+stopped. This prevents Emacs to be blocked.
@vindex desktop-restore-eager
By default, all the buffers in the desktop are restored in one go.
this requires an interactive password, the timeout check doesn't work
properly.
+@c Since Emacs 30.
+@strong{Note}: In recent versions of Emacs, both packages apply
+already this check. You just need to customize
+@code{remote-file-name-access-timeout}.
+
@item
Does @value{tramp} support @acronym{SSH} security keys?
CPerl mode supports the new keywords for exception handling and the
object oriented syntax which were added in Perl 5.36 and 5.38.
+** Emacs Sessions (Desktop)
+
++++
+*** Restoring buffers with remote files should not block.
+When a buffer is restored which uses a remote file, the user option
+'remote-file-name-access-timeout' could be set to a positive number.
+This value will be used as timeout (in seconds) for checking, whether
+the remote file is accessible.
+
+** Recentf
+
++++
+*** Checking recent remote files should not block.
+When a a remote file is checked in 'recentf-list', the user option
+'remote-file-name-access-timeout' could be set to a positive number.
+This value will be used as timeout (in seconds) for checking, whether
+the remote file is accessible.
+
\f
* New Modes and Packages in Emacs 30.1
(desktop-clear)
(desktop-read desktop-dirname))
+;; ----------------------------------------------------------------------------
+(defun desktop-access-file (filename)
+ "Check whether FILENAME is accessible."
+ (ignore-errors (not (access-file filename "Restoring desktop buffer"))))
+
(defvar desktop-buffer-major-mode)
(defvar desktop-buffer-locals)
(defvar auto-insert) ; from autoinsert.el
_buffer-misc)
"Restore a file buffer."
(when buffer-filename
- (if (or (file-exists-p buffer-filename)
- (let ((msg (format "Desktop: File \"%s\" no longer exists."
+ (if (or (desktop-access-file buffer-filename)
+ (let ((msg (format "Desktop: File \"%s\" no longer accessible."
buffer-filename)))
(if desktop-missing-file-warning
(y-or-n-p (concat msg " Re-create buffer? "))
(with-parsed-tramp-file-name filename v
(with-tramp-timeout
(timeout
+ (unless (when-let ((p (tramp-get-connection-process v)))
+ (and (process-live-p p)
+ (tramp-get-connection-property p "connected")))
+ (tramp-cleanup-connection v 'keep-debug 'keep-password))
(tramp-error
v 'file-error
- (format "%s: Timeout %s second(s) accessing %s" string timeout filename)))
+ (format
+ "%s: Timeout %s second(s) accessing %s" string timeout filename)))
(setq filename (file-truename filename))
(if (file-exists-p filename)
(unless
:group 'recentf
:type '(repeat (choice regexp function)))
+(defun recentf-access-file (filename)
+ "Check whether FILENAME is accessible."
+ (ignore-errors (not (access-file filename "Checking recentf file"))))
+
(defun recentf-keep-default-predicate (file)
"Return non-nil if FILE should be kept in the recent list.
It handles the case of remote files as well."
(cond
- ((file-remote-p file nil t) (file-readable-p file))
+ ((file-remote-p file nil t) (recentf-access-file file))
((file-remote-p file))
((file-readable-p file))))