otherwise it signals an error
using @var{string} as the error message text.
-If the user option @code{remote-file-name-access-timeout} is a number,
-the function signals an error when it doesn't finish after that time
-(in seconds). This applies only to remote files, and only when there
-is no additional time spent while reading passwords or alike.
+If the user option @code{remote-file-name-access-timeout} is a
+positive number, the function signals an error when it doesn't finish
+after that time (in seconds). This applies only to remote files, and
+only when there is no additional time spent while reading passwords or
+alike.
@end defun
@defun file-ownership-preserved-p filename &optional group
+++
** New user option 'remote-file-name-access-timeout'.
-When a natural number, this option limits the call of 'access-file'
+When a positive number, this option limits the call of 'access-file'
for remote files to this number of seconds. Default is nil.
+++
+++
*** Checking recent remote files can now time out.
-Similarly to buffer restoration by "desktop", 'recentf-mode' checking
+Similarly to buffer restoration by Desktop, 'recentf-mode' checking
of the accessibility of remote files can now time out if
-`remote-file-name-access-timeout' is set to a positive number.
+'remote-file-name-access-timeout' is set to a positive number.
\f
* New Modes and Packages in Emacs 30.1
(declare (indent 1) (debug ((form body) body)))
(let ((seconds (car list))
(timeout-forms (cdr list)))
- `(if-let (((natnump ,seconds)))
+ ;; If non-nil, `seconds' must be a positive number.
+ `(if-let (((natnump ,seconds))
+ ((not (zerop timeout))))
(with-timeout (,seconds ,@timeout-forms) ,@body)
,@body)))
(defun tramp-handle-access-file (filename string)
"Like `access-file' for Tramp files."
(let ((timeout
- (with-connection-local-variables
- ;; This variable exists since Emacs 30.1.
- (bound-and-true-p remote-file-name-access-timeout)))
+ ;; This variable exists since Emacs 30.1.
+ (bound-and-true-p remote-file-name-access-timeout))
+ (v (tramp-dissect-file-name
+ (if (file-name-absolute-p filename) filename default-directory)))
;; We rely on timers, so don't suspend them.
(tramp-dont-suspend-timers t))
- (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)))
- (setq filename (file-truename filename))
- (if (file-exists-p filename)
- (unless
- (funcall
- (if (file-directory-p filename)
- #'file-accessible-directory-p #'file-readable-p)
- filename)
- (tramp-compat-permission-denied
- v (format "%s: Permission denied, %s" string filename)))
- (tramp-error
- v 'file-missing
- (format "%s: No such file or directory, %s" string filename)))))))
+ (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)))
+ (setq filename (file-truename filename))
+ (if (file-exists-p filename)
+ (unless
+ (funcall
+ (if (file-directory-p filename)
+ #'file-accessible-directory-p #'file-readable-p)
+ filename)
+ (tramp-compat-permission-denied
+ v (format "%s: Permission denied, %s" string filename)))
+ (tramp-error
+ v 'file-missing
+ (format "%s: No such file or directory, %s" string filename))))))
(defun tramp-handle-add-name-to-file
(filename newname &optional ok-if-already-exists)