emacs-diffs
[Top][All Lists]
Advanced

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

master 5eaa7ec0986: Tramp code cleanup


From: Michael Albinus
Subject: master 5eaa7ec0986: Tramp code cleanup
Date: Wed, 3 May 2023 07:26:51 -0400 (EDT)

branch: master
commit 5eaa7ec09860c779ca7c9af4fbda673a1046c362
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Tramp code cleanup
    
    * doc/lispref/files.texi (Magic File Names): Order alphabetically.
    
    * lisp/net/tramp.el (tramp-file-name-for-operation):
    * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
    * lisp/net/tramp-archive.el (tramp-archive-file-name-handler-alist):
    * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
    * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
    * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
    * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist):
    * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
    * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
    * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
    Order alphabetically.
    
    * lisp/net/tramp.el (tramp-handle-file-user-uid)
    (tramp-handle-file-group-gid, tramp-read-id-output):
    * lisp/net/tramp-archive.el (tramp-archive-handle-file-group-gid):
    (tramp-archive-handle-file-user-uid): Fix docstring.
    
    * test/lisp/net/tramp-archive-tests.el
    (tramp-archive-test44-user-group-ids): Fix docstring.
---
 doc/lispref/files.texi               |  8 ++++----
 lisp/net/tramp-adb.el                |  2 +-
 lisp/net/tramp-archive.el            | 18 +++++++++---------
 lisp/net/tramp-crypt.el              |  2 +-
 lisp/net/tramp-gvfs.el               |  2 +-
 lisp/net/tramp-rclone.el             |  2 +-
 lisp/net/tramp-sh.el                 |  2 +-
 lisp/net/tramp-smb.el                |  2 +-
 lisp/net/tramp-sshfs.el              |  2 +-
 lisp/net/tramp-sudoedit.el           |  2 +-
 lisp/net/tramp.el                    |  8 ++++----
 test/lisp/net/tramp-archive-tests.el |  3 ++-
 12 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 6e1aae5d63b..3982eb14f2b 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -3390,7 +3390,7 @@ first, before handlers for jobs such as remote file 
access.
 @code{file-directory-p},
 @code{file-equal-p},
 @code{file-executable-p}, @code{file-exists-p},
-@code{file-in-directory-p},
+@code{file-group-gid}, @code{file-in-directory-p},
 @code{file-local-copy}, @code{file-locked-p},
 @code{file-modes}, @code{file-name-all-completions},
 @code{file-name-as-directory},
@@ -3405,7 +3405,7 @@ first, before handlers for jobs such as remote file 
access.
 @code{file-readable-p}, @code{file-regular-p},
 @code{file-remote-p}, @code{file-selinux-context},
 @code{file-symlink-p}, @code{file-system-info},
-@code{file-truename}, @code{file-user-uid}, @code{file-group-gid},
+@code{file-truename}, @code{file-user-uid},
 @code{file-writable-p},
 @code{find-backup-file-name},@*
 @code{get-file-buffer},
@@ -3452,7 +3452,7 @@ first, before handlers for jobs such as remote file 
access.
 @code{file-direc@discretionary{}{}{}tory-p},
 @code{file-equal-p},
 @code{file-executable-p}, @code{file-exists-p},
-@code{file-in-directory-p},
+@code{file-group-gid}, @code{file-in-directory-p},
 @code{file-local-copy}, @code{file-locked-p},
 @code{file-modes}, @code{file-name-all-completions},
 @code{file-name-as-directory},
@@ -3467,7 +3467,7 @@ first, before handlers for jobs such as remote file 
access.
 @code{file-readable-p}, @code{file-regular-p},
 @code{file-remote-p}, @code{file-selinux-context},
 @code{file-symlink-p}, @code{file-system-info},
-@code{file-truename}, @code{file-user-uid}, @code{file-group-gid},
+@code{file-truename}, @code{file-user-uid},
 @code{file-writable-p},
 @code{find-backup-file-name},
 @code{get-file-buffer},
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 6c668640ba4..2b5369ea3b5 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -130,6 +130,7 @@ It is used for TCP/IP devices."
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-adb-handle-file-executable-p)
     (file-exists-p . tramp-adb-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-adb-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
@@ -154,7 +155,6 @@ It is used for TCP/IP devices."
     (file-system-info . tramp-adb-handle-file-system-info)
     (file-truename . tramp-handle-file-truename)
     (file-user-uid . tramp-handle-file-user-uid)
-    (file-group-gid . tramp-handle-file-group-gid)
     (file-writable-p . tramp-adb-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 8de6d406817..6fcb0ae5e69 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -242,6 +242,7 @@ It must be supported by libarchive(3).")
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-archive-handle-file-executable-p)
     (file-exists-p . tramp-archive-handle-file-exists-p)
+    (file-group-gid . tramp-archive-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-archive-handle-file-local-copy)
     (file-locked-p . ignore)
@@ -266,7 +267,6 @@ It must be supported by libarchive(3).")
     (file-system-info . tramp-archive-handle-file-system-info)
     (file-truename . tramp-archive-handle-file-truename)
     (file-user-uid . tramp-archive-handle-file-user-uid)
-    (file-group-gid . tramp-archive-handle-file-group-gid)
     (file-writable-p . ignore)
     (find-backup-file-name . ignore)
     ;; `get-file-buffer' performed by default handler.
@@ -645,6 +645,13 @@ offered."
   "Like `file-exists-p' for file archives."
   (file-exists-p (tramp-archive-gvfs-file-name filename)))
 
+(defun tramp-archive-handle-file-group-gid ()
+  "Like `file-group-gid' for file archives."
+  (with-parsed-tramp-archive-file-name default-directory nil
+    (let ((default-directory (file-name-directory archive)))
+      ;; `file-group-gid' exists since Emacs 30.1.
+      (tramp-compat-funcall 'file-group-gid))))
+
 (defun tramp-archive-handle-file-local-copy (filename)
   "Like `file-local-copy' for file archives."
   (file-local-copy (tramp-archive-gvfs-file-name filename)))
@@ -673,19 +680,12 @@ offered."
       (concat (file-truename archive) local))))
 
 (defun tramp-archive-handle-file-user-uid ()
-  "Like `user-uid' for file archives."
+  "Like `file-user-uid' for file archives."
   (with-parsed-tramp-archive-file-name default-directory nil
     (let ((default-directory (file-name-directory archive)))
       ;; `file-user-uid' exists since Emacs 30.1.
       (tramp-compat-funcall 'file-user-uid))))
 
-(defun tramp-archive-handle-file-group-gid ()
-  "Like `group-gid' for file archives."
-  (with-parsed-tramp-archive-file-name default-directory nil
-    (let ((default-directory (file-name-directory archive)))
-      ;; `file-group-gid' exists since Emacs 30.1.
-      (tramp-compat-funcall 'file-group-gid))))
-
 (defun tramp-archive-handle-insert-directory
   (filename switches &optional wildcard full-directory-p)
   "Like `insert-directory' for file archives."
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 4acf6938b84..276b65fcfb3 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -181,6 +181,7 @@ If NAME doesn't belong to an encrypted remote directory, 
return nil."
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-crypt-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    ;; `file-group-gid' performed by default-handler.
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-crypt-handle-file-locked-p)
@@ -205,7 +206,6 @@ If NAME doesn't belong to an encrypted remote directory, 
return nil."
     (file-system-info . tramp-crypt-handle-file-system-info)
     ;; `file-truename' performed by default handler.
     ;; `file-user-uid' performed by default-handler.
-    ;; `file-group-gid' performed by default-handler.
     (file-writable-p . tramp-crypt-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index cce34889000..e3b42acfed5 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -807,6 +807,7 @@ It has been changed in GVFS 1.14.")
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-gvfs-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
@@ -831,7 +832,6 @@ It has been changed in GVFS 1.14.")
     (file-system-info . tramp-gvfs-handle-file-system-info)
     (file-truename . tramp-handle-file-truename)
     (file-user-uid . tramp-handle-file-user-uid)
-    (file-group-gid . tramp-handle-file-group-gid)
     (file-writable-p . tramp-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index aa869460589..02e96e10438 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -95,6 +95,7 @@
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-fuse-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
@@ -119,7 +120,6 @@
     (file-system-info . tramp-rclone-handle-file-system-info)
     (file-truename . tramp-handle-file-truename)
     (file-user-uid . tramp-handle-file-user-uid)
-    (file-group-gid . tramp-handle-file-group-gid)
     (file-writable-p . tramp-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index eacf7084fd1..94fbc588b5d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1073,6 +1073,7 @@ Format specifiers \"%s\" are replaced before the script 
is used.")
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-sh-handle-file-executable-p)
     (file-exists-p . tramp-sh-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-sh-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
@@ -1097,7 +1098,6 @@ Format specifiers \"%s\" are replaced before the script 
is used.")
     (file-system-info . tramp-sh-handle-file-system-info)
     (file-truename . tramp-sh-handle-file-truename)
     (file-user-uid . tramp-handle-file-user-uid)
-    (file-group-gid . tramp-handle-file-group-gid)
     (file-writable-p . tramp-sh-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 93e6266313d..1182501e820 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -246,6 +246,7 @@ See `tramp-actions-before-shell' for more info.")
     (file-file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-handle-file-exists-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-smb-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
@@ -270,7 +271,6 @@ See `tramp-actions-before-shell' for more info.")
     (file-system-info . tramp-smb-handle-file-system-info)
     (file-truename . tramp-handle-file-truename)
     (file-user-uid . tramp-handle-file-user-uid)
-    (file-group-gid . tramp-handle-file-group-gid)
     (file-writable-p . tramp-smb-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index d552f6c83fa..9d871276f7a 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -101,6 +101,7 @@
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-fuse-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
@@ -125,7 +126,6 @@
     (file-system-info . tramp-sshfs-handle-file-system-info)
     (file-truename . tramp-handle-file-truename)
     (file-user-uid . tramp-handle-file-user-uid)
-    (file-group-gid . tramp-handle-file-group-gid)
     (file-writable-p . tramp-sshfs-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 531a1591a16..e41a4a590e2 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -90,6 +90,7 @@ See `tramp-actions-before-shell' for more info.")
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-sudoedit-handle-file-executable-p)
     (file-exists-p . tramp-sudoedit-handle-file-exists-p)
+    (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
     (file-locked-p . tramp-handle-file-locked-p)
@@ -115,7 +116,6 @@ See `tramp-actions-before-shell' for more info.")
     (file-system-info . tramp-sudoedit-handle-file-system-info)
     (file-truename . tramp-sudoedit-handle-file-truename)
     (file-user-uid . tramp-handle-file-user-uid)
-    (file-group-gid . tramp-handle-file-group-gid)
     (file-writable-p . tramp-sudoedit-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 9729baeb0d4..7ce984d9144 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2650,7 +2650,7 @@ Must be handled by the callers."
              ;; Emacs 29+ only.
               list-system-processes memory-info process-attributes
               ;; Emacs 30+ only.
-             file-user-uid file-group-gid))
+             file-group-gid file-user-uid))
     default-directory)
    ;; PROC.
    ((member operation '(file-notify-rm-watch file-notify-valid-p))
@@ -3931,7 +3931,7 @@ Let-bind it when necessary.")
       (tramp-make-tramp-file-name (tramp-dissect-file-name filename)))))
 
 (defun tramp-handle-file-user-uid ()
-  "Like `user-uid' for Tramp files."
+  "Like `file-user-uid' for Tramp files."
   (let ((v (tramp-dissect-file-name default-directory)))
     (or (tramp-get-remote-uid v 'integer)
         ;; Some handlers for `tramp-get-remote-uid' return nil if they
@@ -3940,7 +3940,7 @@ Let-bind it when necessary.")
         tramp-unknown-id-integer)))
 
 (defun tramp-handle-file-group-gid ()
-  "Like `group-gid' for Tramp files."
+  "Like `file-group-gid' for Tramp files."
   (let ((v (tramp-dissect-file-name default-directory)))
     (or (tramp-get-remote-gid v 'integer)
         ;; Some handlers for `tramp-get-remote-gid' return nil if they
@@ -6399,7 +6399,7 @@ ID-FORMAT valid values are `string' and `integer'."
 
 (defun tramp-read-id-output (vec)
   "Read in connection buffer the output of the `id' command.
-Set connection properties \"{uid,gid.groups}-{integer,string}\"."
+Set connection properties \"{uid,gid,groups}-{integer,string}\"."
   (with-current-buffer (tramp-get-connection-buffer vec)
     (let (uid-integer uid-string
          gid-integer gid-string
diff --git a/test/lisp/net/tramp-archive-tests.el 
b/test/lisp/net/tramp-archive-tests.el
index 5fa727a13e5..2e2e313f35c 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -883,7 +883,8 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
 
 ;; `file-user-uid' and `file-group-gid' were introduced in Emacs 30.1.
 (ert-deftest tramp-archive-test44-user-group-ids ()
-  "Check that `file-user-uid' returns proper values."
+  "Check results of user/group functions.
+`file-user-uid' and `file-group-gid' should return proper values."
   (skip-unless tramp-archive-enabled)
   (skip-unless (and (fboundp 'file-user-uid)
                     (fboundp 'file-group-gid)))



reply via email to

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