[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2dc7798449d: `remote-file-name-access-timeout' being 0 is equal t
From: |
Michael Albinus |
Subject: |
master 2dc7798449d: `remote-file-name-access-timeout' being 0 is equal to nil |
Date: |
Wed, 5 Jul 2023 04:05:59 -0400 (EDT) |
branch: master
commit 2dc7798449d76c5d761395507558ec6351eacb09
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
`remote-file-name-access-timeout' being 0 is equal to nil
* doc/lispref/files.texi (Testing Accessibility): Clarify the
value of remote-file-name-access-timeout.
* etc/NEWS: Clarify the value of remote-file-name-access-timeout.
* lisp/files.el (remote-file-name-access-timeout): Adapt docstring.
* lisp/net//tramp.el (with-tramp-timeout): Ensure, that the
timeout is a positive number, or nil.
(tramp-handle-access-file): Simplify code.
---
doc/lispref/files.texi | 9 ++++----
etc/NEWS | 6 +++---
lisp/files.el | 2 +-
lisp/net/tramp.el | 56 ++++++++++++++++++++++++++------------------------
4 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 8f1210ad486..66de0f036c4 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -974,10 +974,11 @@ If you can read @var{filename} this function returns
@code{nil};
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
diff --git a/etc/NEWS b/etc/NEWS
index 5318add7a82..e36e77fa97f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -68,7 +68,7 @@ remote buffers. The default is nil.
+++
** 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.
+++
@@ -469,9 +469,9 @@ desktop restoration to continue.
+++
*** 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.
* New Modes and Packages in Emacs 30.1
diff --git a/lisp/files.el b/lisp/files.el
index dae71a50df0..2fffd2e6c35 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1332,7 +1332,7 @@ consecutive checks. For example:
"Timeout (in seconds) for `access-file'.
This timeout limits the time to check, whether a remote file is
accessible. `access-file' returns an error after that time. If
-the value is nil, no timeout is used.
+the value is 0 or nil, no timeout is used.
This applies only when there isn't time spent for other actions,
like reading passwords."
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b8345dcff49..8c9023d004a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2439,7 +2439,9 @@ without a visible progress reporter."
(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)))
@@ -3985,34 +3987,34 @@ Let-bind it when necessary.")
(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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 2dc7798449d: `remote-file-name-access-timeout' being 0 is equal to nil,
Michael Albinus <=