Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-07-06 08:34:26 +08:00
commit af8232a150
11 changed files with 152 additions and 134 deletions

View file

@ -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

View file

@ -163,6 +163,7 @@ Using @value{tramp}
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 @@ accumulated in the buffer, then decodes that output to produce the
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 <TMP>/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{<TMP>/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 @@ User names are part of the @command{rclone} configuration, and not
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 @@ to a remote home directory, like @option{adb}, @option{rclone} and
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 @@ this property has no effect.
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{"<TMP>/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 @@ The fallback is to start Emacs from a shell.
@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{"<TMP>/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 @@ be restored by moving them manually from
@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 @@ programs.
@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 <TMP>
This local temporary directory is kept in the constant
@code{tramp-compat-temporary-file-directory}. In this manual, we use
@t{"<TMP>"} 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 @@ a file:
(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*}.

View file

@ -80,7 +80,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.
+++
@ -491,9 +491,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

View file

@ -248,12 +248,14 @@ some parts of the text or may be applied several times to other parts.
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))

View file

@ -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."

View file

@ -298,25 +298,6 @@
("\\\\" . "")
("\\$" . "")))
(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
"\\("

View file

@ -558,48 +558,31 @@
("སྨ" . "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>")))
(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))))))
(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
(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 "^\\("
(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
(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 "\\)")))
(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

View file

@ -272,6 +272,21 @@ a list of address strings."
(while (not (eobp))
(setq c (char-after))
(cond
((eq c ?:)
(setq beg (1+ (point)))
(skip-chars-forward "^;")
(when-let ((address
(condition-case nil
(ietf-drums-parse-addresses
(buffer-substring beg (point)) rawp)
(error nil))))
(if (listp address)
(setq pairs (append address pairs))
(push address pairs)))
(condition-case nil
(forward-char 1)
(error nil))
(setq beg (point)))
((memq c '(?\" ?< ?\())
(condition-case nil
(forward-sexp 1)
@ -285,10 +300,12 @@ a list of address strings."
(ietf-drums-parse-address
(buffer-substring beg (point)))
(error nil))))
(if address (push address pairs))
(when (or (consp address)
(and (stringp address) (< 0 (length address))))
(push address pairs))
(forward-char 1)
(setq beg (point)))
(t
((not (eobp))
(forward-char 1))))
(setq address
(if rawp
@ -297,7 +314,9 @@ a list of address strings."
(ietf-drums-parse-address
(buffer-substring beg (point)))
(error nil))))
(if address (push address pairs))
(when (or (consp address)
(and (stringp address) (< 0 (length address))))
(push address pairs))
(nreverse pairs)))))
(defun ietf-drums-unfold-fws ()

View file

@ -2444,7 +2444,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)))
@ -3990,34 +3992,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)

View file

@ -1328,6 +1328,19 @@ inherits the current tab's `explicit-name' parameter."
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
@ -1353,6 +1366,11 @@ Negative TAB-NUMBER counts tabs from the end of the tab bar."
(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))

View file

@ -8040,6 +8040,7 @@ Since it unloads Tramp, it shall be the last test to run."
(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