commit cb906249450aeec41f73273b69af097e84cc681a (HEAD, refs/remotes/origin/master) Author: Wang Diancheng Date: Fri Jun 30 15:08:18 2023 +0800 Fix target-async and background execution in gdb-mi.el * lisp/progmodes/gdb-mi.el (gdb-target-async-checked): New variable. (gdb-non-stop-setting): Change the value back to default to non-nil on systems other than MS-Windows. (gdb-non-stop-handler): Try to set mi-async first, falling back to target-async by calling 'gdb-set-mi-async-handler'. (gdb-set-mi-async-handler, gdb-try-check-target-async-support): New functions. (gdb-check-target-async): Set 'gdb-non-stop' here... (gdb-starting): ...and here. (gdb-stopped): Call 'gdb-try-check-target-async-support' when the program stops for the first time. (Bug#64186) (Bug#63084) Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index c9afe502a50..199be3318a1 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -237,6 +237,7 @@ gdb-handler-list (defvar gdb-source-file-list nil "List of source files for the current executable.") (defvar gdb-first-done-or-error t) +(defvar gdb-target-async-checked nil) (defvar gdb-source-window-list nil "List of windows used for displaying source files. Sorted in most-recently-visited-first order.") @@ -453,9 +454,7 @@ gdb-debug-log-max (const :tag "Unlimited" nil)) :version "22.1") -;; This is disabled by default because we don't really support -;; asynchronous execution of the debuggee; see bug#63084. FIXME. -(defcustom gdb-non-stop-setting nil +(defcustom gdb-non-stop-setting (not (eq system-type 'windows-nt)) "If non-nil, GDB sessions are expected to support the non-stop mode. When in the non-stop mode, stopped threads can be examined while other threads continue to execute. @@ -470,7 +469,7 @@ gdb-non-stop-setting GDB session needs to be restarted for this setting to take effect." :type 'boolean :group 'gdb-non-stop - :version "29.1") + :version "30.1") (defcustom gdb-debuginfod-enable-setting ;; debuginfod servers are only for ELF executables, and elfutils, of @@ -1069,6 +1068,7 @@ gdb-init-1 gdb-handler-list '() gdb-prompt-name nil gdb-first-done-or-error t + gdb-target-async-checked nil gdb-buffer-fringe-width (car (window-fringes)) gdb-debug-log nil gdb-source-window-list nil @@ -1078,7 +1078,8 @@ gdb-init-1 gdb-threads-list '() gdb-breakpoints-list '() gdb-register-names '() - gdb-non-stop gdb-non-stop-setting + gdb-supports-non-stop nil + gdb-non-stop nil gdb-debuginfod-enable gdb-debuginfod-enable-setting) ;; (gdbmi-bnf-init) @@ -1110,7 +1111,7 @@ gdb-init-1 (gdb-input "-gdb-set interactive-mode on" 'ignore)) (gdb-input "-gdb-set height 0" 'ignore) - (when gdb-non-stop + (when gdb-non-stop-setting (gdb-input "-gdb-set non-stop 1" 'gdb-non-stop-handler)) (gdb-input "-enable-pretty-printing" 'ignore) @@ -1145,16 +1146,30 @@ gdb-non-stop-handler (setq gdb-non-stop nil) (setq gdb-supports-non-stop nil)) (setq gdb-supports-non-stop t) - (gdb-input "-gdb-set target-async 1" 'ignore) + ;; Try to use "mi-async" first, needs GDB 7.7 onwards. Note if + ;; "mi-async" is not available, GDB is still running in "sync" + ;; mode, "No symbol" for "mi-async" must appear before other + ;; commands. + (gdb-input "-gdb-set mi-async 1" 'gdb-set-mi-async-handler))) + +(defun gdb-set-mi-async-handler() + (goto-char (point-min)) + (if (re-search-forward "No symbol" nil t) + (gdb-input "-gdb-set target-async 1" 'ignore))) + +(defun gdb-try-check-target-async-support() + (when (and gdb-non-stop-setting gdb-supports-non-stop + (not gdb-target-async-checked)) (gdb-input "-list-target-features" 'gdb-check-target-async))) (defun gdb-check-target-async () (goto-char (point-min)) - (unless (re-search-forward "async" nil t) + (if (re-search-forward "async" nil t) + (setq gdb-non-stop t) (message "Target doesn't support non-stop mode. Turning it off.") - (setq gdb-non-stop nil) - (gdb-input "-gdb-set non-stop 0" 'ignore))) + (gdb-input "-gdb-set non-stop 0" 'ignore)) + (setq gdb-target-async-checked t)) (defun gdb-delchar-or-quit (arg) "Delete ARG characters or send a quit command to GDB. @@ -2652,6 +2667,14 @@ gdb-running (defun gdb-starting (_output-field _result) ;; CLI commands don't emit ^running at the moment so use gdb-running too. (setq gdb-inferior-status "running") + + ;; Set `gdb-non-stop' when `gdb-last-command' is a CLI background + ;; running command e.g. "run &", attach &" or a MI command + ;; e.g. "-exec-run" or "-exec-attach". + (when (or (string-match "&\s*$" gdb-last-command) + (string-match "^-" gdb-last-command)) + (gdb-try-check-target-async-support)) + (gdb-force-mode-line-update (propertize gdb-inferior-status 'face font-lock-type-face)) (setq gdb-active-process t) @@ -2722,6 +2745,10 @@ gdb-stopped ;; Print "(gdb)" to GUD console (when gdb-first-done-or-error + ;; If running target with a non-background CLI command + ;; e.g. "run" (no trailing '&'), target async feature can only + ;; be checked when when the program stops for the first time + (gdb-try-check-target-async-support) (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name))) ;; In non-stop, we update information as soon as another thread gets commit 47cbecb47487794902319f16204b66e04ba1ec91 Author: Mattias Engdegård Date: Wed Jul 5 19:42:05 2023 +0200 ; fix last change * lisp/language/tibetan.el (tibetan-regexp, tibetan-precomposed-regexp) (tibetan-precomposition-rule-regexp): Don't use regexp-opt after all since it breaks bootstrapping. diff --git a/lisp/language/tibetan.el b/lisp/language/tibetan.el index 2249fa467b1..31ff37016fe 100644 --- a/lisp/language/tibetan.el +++ b/lisp/language/tibetan.el @@ -558,29 +558,31 @@ tibetan-precomposition-rule-alist ("སྨ" . ""))) (defconst tibetan-regexp - (regexp-opt - (mapcar (lambda (x) (regexp-quote (car x))) - (append tibetan-precomposed-transcription-alist - tibetan-consonant-transcription-alist - tibetan-vowel-transcription-alist - tibetan-modifier-transcription-alist - tibetan-subjoined-transcription-alist))) + (mapconcat (lambda (x) (regexp-quote (car x))) + (append tibetan-precomposed-transcription-alist + tibetan-consonant-transcription-alist + tibetan-vowel-transcription-alist + tibetan-modifier-transcription-alist + tibetan-subjoined-transcription-alist) + "\\|") "Regexp matching a Tibetan transcription of a composable Tibetan sequence. The result of matching is to be used for indexing alists at conversion from a roman transcription to the corresponding Tibetan character.") (defvar tibetan-precomposed-regexp (purecopy - (concat "^" (regexp-opt - (mapcar #'car tibetan-precomposed-transcription-alist) - t))) + (concat "^\\(" + (mapconcat #'car tibetan-precomposed-transcription-alist "\\|") + "\\)")) "Regexp string to match a romanized Tibetan complex consonant. The result of matching is to be used for indexing alists when the input key from an input method is converted to the corresponding precomposed glyph.") (defvar tibetan-precomposition-rule-regexp (purecopy - (regexp-opt (mapcar #'car tibetan-precomposition-rule-alist) t)) + (concat "\\(" + (mapconcat #'car tibetan-precomposition-rule-alist "\\|") + "\\)")) "Regexp string to match a sequence of Tibetan consonantic components. That is, one base consonant and one or more subjoined consonants. The result of matching is to be used for indexing alist when the component commit d7168e8575794b7af4e7e2bde51ca0663bbc2eac Author: Mattias Engdegård Date: Wed Jul 5 15:25:30 2023 +0200 Improve some big regexps * lisp/language/lao-util.el (lao-transcription-pattern): Remove duplicate definition. * lisp/language/tibetan.el (tibetan-regexp, tibetan-precomposed-regexp) (tibetan-precomposition-rule-regexp): Use regexp-opt. diff --git a/lisp/language/lao-util.el b/lisp/language/lao-util.el index 6b9a8984414..33e98a60d63 100644 --- a/lisp/language/lao-util.el +++ b/lisp/language/lao-util.el @@ -298,25 +298,6 @@ lao-transcription-punctuation-alist ("\\\\" . "ໆ") ("\\$" . "ຯ"))) -(defconst lao-transcription-pattern - (concat - "\\(" - (mapconcat 'car lao-transcription-consonant-alist "\\|") - "\\)\\(" - (mapconcat 'car lao-transcription-semi-vowel-alist "\\|") - "\\)?\\(\\(" - (mapconcat 'car lao-transcription-vowel-alist "\\|") - "\\)\\(" - (mapconcat 'car lao-transcription-maa-sakod-alist "\\|") - "\\)?\\(" - (mapconcat (lambda (x) (regexp-quote (car x))) - lao-transcription-tone-alist "\\|") - "\\)?\\)?\\|" - (mapconcat (lambda (x) (regexp-quote (car x))) - lao-transcription-punctuation-alist "\\|") - ) - "Regexp of Roman transcription pattern for one Lao syllable.") - (defconst lao-transcription-pattern (concat "\\(" diff --git a/lisp/language/tibetan.el b/lisp/language/tibetan.el index 1292092c582..2249fa467b1 100644 --- a/lisp/language/tibetan.el +++ b/lisp/language/tibetan.el @@ -558,48 +558,29 @@ tibetan-precomposition-rule-alist ("སྨ" . ""))) (defconst tibetan-regexp - (let (pattern) - (dolist (alist (list tibetan-precomposed-transcription-alist - tibetan-consonant-transcription-alist - tibetan-vowel-transcription-alist - tibetan-modifier-transcription-alist - tibetan-subjoined-transcription-alist) - (apply #'concat (nreverse (cdr pattern)))) - (dolist (key-val alist) - (setq pattern (cons "\\|" (cons (regexp-quote (car key-val)) - pattern)))))) + (regexp-opt + (mapcar (lambda (x) (regexp-quote (car x))) + (append tibetan-precomposed-transcription-alist + tibetan-consonant-transcription-alist + tibetan-vowel-transcription-alist + tibetan-modifier-transcription-alist + tibetan-subjoined-transcription-alist))) "Regexp matching a Tibetan transcription of a composable Tibetan sequence. The result of matching is to be used for indexing alists at conversion from a roman transcription to the corresponding Tibetan character.") (defvar tibetan-precomposed-regexp (purecopy - (let ((l tibetan-precomposed-transcription-alist) - temp) - (setq temp "^\\(") - (setq temp - (concat temp (car (car l)))) - (setq l (cdr l)) - (while l - (setq temp - (concat temp "\\|" (car (car l)))) - (setq l (cdr l))) - (concat temp "\\)"))) + (concat "^" (regexp-opt + (mapcar #'car tibetan-precomposed-transcription-alist) + t))) "Regexp string to match a romanized Tibetan complex consonant. The result of matching is to be used for indexing alists when the input key from an input method is converted to the corresponding precomposed glyph.") (defvar tibetan-precomposition-rule-regexp (purecopy - (let ((l tibetan-precomposition-rule-alist) - temp) - (setq temp "\\(") - (setq temp (concat temp (car (car l)))) - (setq l (cdr l)) - (while l - (setq temp (concat temp "\\|" (car (car l)))) - (setq l (cdr l))) - (concat temp "\\)"))) + (regexp-opt (mapcar #'car tibetan-precomposition-rule-alist) t)) "Regexp string to match a sequence of Tibetan consonantic components. That is, one base consonant and one or more subjoined consonants. The result of matching is to be used for indexing alist when the component commit 1dc2d5441e3d7d202ca9d842b73f165a1b2ed42e Author: Juri Linkov Date: Wed Jul 5 20:20:48 2023 +0300 * lisp/tab-bar.el: Restore the original tab where minibuffer was activated. (tab-bar-minibuffer-restore-tab): New variable and function. (tab-bar-select-tab): Use them (bug#64373). diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 87ca80ce00a..234e7e5d14d 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -1253,6 +1253,19 @@ tab-bar--tabs-recent tabs)))) +(defvar tab-bar-minibuffer-restore-tab nil + "Tab number for `tab-bar-minibuffer-restore-tab'.") + +(defun tab-bar-minibuffer-restore-tab () + "Switch back to the tab where the minibuffer was activated. +This is necessary to prepare the same window configuration where +original windows were saved and will be restored. This function +is used only when `read-minibuffer-restore-windows' is non-nil." + (when (and read-minibuffer-restore-windows + tab-bar-minibuffer-restore-tab) + (tab-bar-select-tab tab-bar-minibuffer-restore-tab) + (setq tab-bar-minibuffer-restore-tab nil))) + (defun tab-bar-select-tab (&optional tab-number) "Switch to the tab by its absolute position TAB-NUMBER in the tab bar. When this command is bound to a numeric key (with a key prefix or modifier key @@ -1278,6 +1291,11 @@ tab-bar-select-tab (to-index (1- (max 1 (min to-number (length tabs))))) (minibuffer-was-active (minibuffer-window-active-p (selected-window)))) + (when (and read-minibuffer-restore-windows minibuffer-was-active + (not tab-bar-minibuffer-restore-tab)) + (setq tab-bar-minibuffer-restore-tab (1+ from-index)) + (add-hook 'minibuffer-exit-hook 'tab-bar-minibuffer-restore-tab)) + (unless (eq from-index to-index) (let* ((from-tab (tab-bar--tab)) (to-tab (nth to-index tabs)) commit 26f31fe3b584d6c1846a2b5d68d0655e1e4d5145 Author: Stefan Monnier Date: Wed Jul 5 11:37:28 2023 -0400 * lisp/emacs-lisp/syntax.el (syntax-propertize-rules): Fix bug#64459 diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index e35992298a6..d8f6c58f6ca 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -248,12 +248,14 @@ syntax-propertize-rules Note: There may be at most nine back-references in the REGEXPs of all RULES in total." - (declare (debug (&rest &or symbolp ;FIXME: edebug this eval step. - (form &rest - (numberp - [&or stringp ;FIXME: Use &wrap - ("prog1" [&or stringp def-form] def-body) - def-form]))))) + (declare + (debug (&rest &or symbolp ;FIXME: edebug this eval step. + (def-form ;; `def-' needed to debug during macroexpansion. + &rest (numberp + [&or stringp ;FIXME: Use &wrap + ;; `def-' because this is the body of a function. + ("prog1" [&or stringp def-form] def-body) + def-form]))))) (let ((newrules nil)) (while rules (if (symbolp (car rules)) commit 14e57b8f4cfbc82cbe17c7b7808d690e8975f56d Author: Michael Albinus Date: Wed Jul 5 16:19:23 2023 +0200 Adapt information about Tramp's temporary directory * doc/misc/tramp.texi (Overview): Use scp in the example. (FUSE-based methods): Move information about mount point to node "FUSE setup". (Overview, Predefined connection information, FUSE setup) (Traces and Profiles): Refer to node "Temporary directory". (Frequently Asked Questions): Move information about temporary directory to node "Temporary directory". (Temporary directory): New node. (Top, Files directories and localnames): Add it to @menu. diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 4973ab2c9b1..ff2a66ae720 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -163,6 +163,7 @@ Top How file names, directories and localnames are mangled and managed +* Temporary directory:: Where temporary files are kept. * Localname deconstruction:: Breaking a localname into its components. * External packages:: Integration with external Lisp packages. @@ -290,11 +291,14 @@ Overview file's contents. For external transfers, @value{tramp} sends a command as follows: + @example -$ rcp user@@host:/path/to/remote/file /tmp/tramp.4711 +$ scp user@@host:/path/to/remote/file /tramp.4711 @end example -@value{tramp} reads the local temporary file @file{/tmp/tramp.4711} -into a buffer, and then deletes the temporary file. + +@value{tramp} reads the local temporary file @file{/tramp.4711} +into a buffer, and then deletes the temporary +file.@footnote{@ref{Temporary directory}} @item Edit, modify, change the buffer contents as normal, and then save the @@ -1398,14 +1402,6 @@ FUSE-based methods needed in the remote file name. If a user name is contained in the remote file name, it is ignored. -Internally, @value{tramp} mounts the remote system storage at location -@file{/tmp/tramp.rclone.storage}, with @file{storage} being the name -of the configured system storage. - -The mount point and optional flags to the different @option{rclone} -operations could be passed as connection properties, @xref{Setup of -rclone method}. - Access via @option{rclone} is slow. If you have an alternative method for accessing the system storage, you should use it. @ref{GVFS-based methods} for example, methods @option{gdrive} and @@ -2219,6 +2215,7 @@ Predefined connection information The temporary directory on the remote host. If not specified, the default value is @t{"/data/local/tmp"} for the @option{adb} method, @t{"/C$/Temp"} for the @option{smb} method, and @t{"/tmp"} otherwise. +@ref{Temporary directory}. @item @t{"direct-async-process"} @@ -2246,8 +2243,8 @@ Predefined connection information The directory file name an @acronym{FUSE}-based file system is mounted on. The default value of this property is -@t{"/tmp/tramp.method.user@@host#port"} (not specified in -@code{tramp-methods}). +@t{"/tramp.method.user@@host#port"} (not specified in +@code{tramp-methods}). @ref{Temporary directory}. @item @t{"mount-args"}@* @t{"copyto-args"}@* @@ -2951,10 +2948,11 @@ FUSE setup @section @acronym{FUSE} setup hints The @acronym{FUSE} file systems are mounted by default at -@file{/tmp/tramp.method.user@@host#port}. The user name and port -number are optional. If the file system is already mounted, it will -be used as it is. If the mount point does not exist yet, -@value{tramp} creates this directory. +@t{"/tramp.method.user@@host#port"}.@footnote{@ref{Temporary +directory}} Method is either @t{"rclone"} or @t{"sshfs"}. The user +name and port number are optional. If the file system is already +mounted, it will be used as it is. If the mount point does not exist +yet, @value{tramp} creates this directory. The mount point can be overwritten by the connection property @t{"mount-point"}, @ref{Predefined connection information}. @@ -5382,26 +5380,6 @@ Frequently Asked Questions @file{$@{XDG_DATA_HOME@}/Trash/files/}, if needed. -@item -How to identify temporary files produced by @value{tramp}? - -@vindex tramp-temp-name-prefix -Temporary files are kept in your @code{temporary-file-directory} -directory, which is often @file{/tmp/}. By default, they have the -file name prefix @t{"tramp."}. If you want to change this prefix, for -example because you want to identify temporary files produced by -@code{file-local-copy} in your package, you can bind the variable -@code{tramp-temp-name-prefix} temporarily: - -@example -@group -(let ((tramp-temp-name-prefix "my-prefix.")) - (file-local-copy "@trampfn{ssh,,.emacs}")) -@result{} "/tmp/my-prefix.HDfgDZ" -@end group -@end example - - @item How to shorten long file names when typing in @value{tramp}? @@ -5919,11 +5897,45 @@ Files directories and localnames @chapter How file names, directories and localnames are mangled and managed @menu +* Temporary directory:: Where temporary files are kept. * Localname deconstruction:: Splitting a localname into its component parts. * External packages:: Integrating with external Lisp packages. @end menu +@node Temporary directory +@section Where temporary files are kept + +@vindex temporary-file-directory +Internally, @value{tramp} uses @t{"~/.cache/emacs"} +as local temporary directory if it exists. Otherwise, the value of +@code{temporary-file-directory} is used, which is often @t{"/tmp"}. + +@vindex tramp-compat-temporary-file-directory +@vindex +This local temporary directory is kept in the constant +@code{tramp-compat-temporary-file-directory}. In this manual, we use +@t{""} for its value. + +The temporary directory on a remote host is @t{"/data/local/tmp"} for +the @option{adb} method, @t{"/C$/Temp"} for the @option{smb} method, +and @t{"/tmp"} otherwise. For some methods, this can be customized. + +@vindex tramp-temp-name-prefix +Temporary files have the file name prefix @t{"tramp."}. If you want +to change this prefix, for example because you want to identify +temporary files produced by @code{file-local-copy} in your package, +you can bind the variable @code{tramp-temp-name-prefix} temporarily: + +@example +@group +(let ((tramp-temp-name-prefix "my-prefix.")) + (file-local-copy "@trampfn{ssh,,.emacs}")) +@result{} "/tmp/my-prefix.HDfgDZ" +@end group +@end example + + @node Localname deconstruction @section Splitting a localname into its component parts @@ -6091,10 +6103,9 @@ Traces and Profiles (customize-set-variable 'tramp-debug-to-file t) @end lisp -The debug buffer is written as a file in your -@code{temporary-file-directory}, which is usually @file{/tmp/}. Use -this option with care, because it could decrease the performance of -@value{tramp} actions. +The debug buffer is written as a file in your @ref{Temporary +directory}. Use this option with care, because it could decrease the +performance of @value{tramp} actions. If @code{tramp-verbose} is greater than or equal to 11, @value{tramp} function call traces are written to the buffer @file{*trace-output*}. commit 6c5574f9248380750cb30ea37922678c4d44a776 Author: Michael Albinus Date: Wed Jul 5 11:33:57 2023 +0200 * test/lisp/net/tramp-tests.el (tramp-test49-unload): Extend test. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 869bc63a544..51980e335e7 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -8040,6 +8040,7 @@ tramp-test49-unload (and (functionp x) (null (autoloadp (symbol-function x)))) (macrop x)) (string-prefix-p "tramp" (symbol-name x)) + (string-match-p (rx bol "with" (| "tramp" "parsed")) (symbol-name x)) ;; `tramp-completion-mode' is autoloaded in Emacs < 28.1. (not (eq 'tramp-completion-mode x)) ;; `tramp-register-archive-file-name-handler' is autoloaded commit 2dc7798449d76c5d761395507558ec6351eacb09 Author: Michael Albinus Date: Wed Jul 5 10:05:44 2023 +0200 `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. 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 @@ Testing Accessibility 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 @@ remote-file-name-access-timeout "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 @@ with-tramp-timeout (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 @@ tramp-handle-file-group-gid (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)