emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android af8232a150c: Merge remote-tracking branch 'origin/master


From: Po Lu
Subject: feature/android af8232a150c: Merge remote-tracking branch 'origin/master' into feature/android
Date: Wed, 5 Jul 2023 20:35:09 -0400 (EDT)

branch: feature/android
commit af8232a150c934d500bfc231a0b9ac53d6d8415e
Merge: 08f90dc0058 47cbecb4748
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 doc/lispref/files.texi       |  9 +++--
 doc/misc/tramp.texi          | 93 +++++++++++++++++++++++++-------------------
 etc/NEWS                     |  6 +--
 lisp/emacs-lisp/syntax.el    | 14 ++++---
 lisp/files.el                |  2 +-
 lisp/language/lao-util.el    | 19 ---------
 lisp/language/tibetan.el     | 43 +++++++-------------
 lisp/mail/ietf-drums.el      | 25 ++++++++++--
 lisp/net/tramp.el            | 56 +++++++++++++-------------
 lisp/tab-bar.el              | 18 +++++++++
 test/lisp/net/tramp-tests.el |  1 +
 11 files changed, 152 insertions(+), 134 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/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 @@ 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*}.
diff --git a/etc/NEWS b/etc/NEWS
index aadd5a52ee2..d4666e30c8b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -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
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 @@ 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))
diff --git a/lisp/files.el b/lisp/files.el
index e1e2a19a80b..7cbda41b6c0 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/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 @@
     ("\\\\" . "ໆ")
     ("\\$" . "ຯ")))
 
-(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..31ff37016fe 100644
--- a/lisp/language/tibetan.el
+++ b/lisp/language/tibetan.el
@@ -558,48 +558,31 @@
     ("སྨ" . "����")))
 
 (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
diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el
index f60a3a3da28..aa714292bcc 100644
--- a/lisp/mail/ietf-drums.el
+++ b/lisp/mail/ietf-drums.el
@@ -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 ()
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index e83f58f4eb2..ab868153236 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -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)
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 08935a1b287..3180d19052f 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -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))
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 @@ 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]