emacs-diffs
[Top][All Lists]
Advanced

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

master c8da2a991e: Tramp code cleanup


From: Michael Albinus
Subject: master c8da2a991e: Tramp code cleanup
Date: Sun, 3 Jul 2022 12:24:07 -0400 (EDT)

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

    Tramp code cleanup
    
    * lisp/net/tramp-cache.el (tramp-get-file-property)
    (tramp-get-connection-property): Make DEFAULT optional.  Adapt callees.
    
    * lisp/net/tramp.el:
    * lisp/net/tramp-adb.el:
    * lisp/net/tramp-cmds.el:
    * lisp/net/tramp-compat.el:
    * lisp/net/tramp-crypt.el:
    * lisp/net/tramp-ftp.el:
    * lisp/net/tramp-fuse.el:
    * lisp/net/tramp-gvfs.el:
    * lisp/net/tramp-integration.el:
    * lisp/net/tramp-sh.el:
    * lisp/net/tramp-smb.el:
    * lisp/net/tramp-sshfs.el:
    * lisp/net/trampver.el: Code cleanup.
    
    * test/lisp/net/tramp-tests.el (tramp--test-sh-no-ls--dired-p)
    (tramp--test-with-proper-process-name-and-buffer): Code cleanup.
---
 lisp/net/tramp-adb.el         |   5 +-
 lisp/net/tramp-cache.el       |   8 +--
 lisp/net/tramp-cmds.el        |   4 +-
 lisp/net/tramp-compat.el      |   6 +--
 lisp/net/tramp-crypt.el       |   2 +-
 lisp/net/tramp-ftp.el         |   2 +-
 lisp/net/tramp-fuse.el        |   4 +-
 lisp/net/tramp-gvfs.el        | 114 +++++++++++++++++++-----------------------
 lisp/net/tramp-integration.el |   2 +-
 lisp/net/tramp-sh.el          |  37 +++++++-------
 lisp/net/tramp-smb.el         |   8 +--
 lisp/net/tramp-sshfs.el       |   2 +-
 lisp/net/tramp.el             |  43 ++++++++--------
 lisp/net/trampver.el          |   8 +--
 test/lisp/net/tramp-tests.el  |  16 +++---
 15 files changed, 124 insertions(+), 137 deletions(-)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 9981cc3c13..b504ce600d 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -270,7 +270,7 @@ arguments to pass to the OPERATION."
   "Parse `file-attributes' for Tramp files using the ls(1) command."
   (with-current-buffer (tramp-get-buffer vec)
     (goto-char (point-min))
-    (let ((file-properties nil))
+    (let (file-properties)
       (while (re-search-forward tramp-adb-ls-toolbox-regexp nil t)
        (let* ((mod-string (match-string 1))
               (is-dir (eq ?d (aref mod-string 0)))
@@ -1289,8 +1289,7 @@ connection if a previous connection has died for some 
reason."
              "echo \\\"`getprop ro.product.model` "
              "`getprop ro.product.version` "
              "`getprop ro.build.version.release`\\\""))
-           (let ((old-getprop
-                  (tramp-get-connection-property vec "getprop" nil))
+           (let ((old-getprop (tramp-get-connection-property vec "getprop"))
                  (new-getprop
                   (tramp-set-connection-property
                    vec "getprop"
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index a0cbfed64e..dbebcad1a8 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -129,7 +129,7 @@ If KEY is `tramp-cache-undefined', don't create anything, 
and return nil."
          hash))))
 
 ;;;###tramp-autoload
-(defun tramp-get-file-property (key file property default)
+(defun tramp-get-file-property (key file property &optional default)
   "Get the PROPERTY of FILE from the cache context of KEY.
 Return DEFAULT if not set."
   ;; Unify localname.  Remove hop from `tramp-file-name' structure.
@@ -240,7 +240,7 @@ Return VALUE."
 (defun tramp-flush-file-properties (key file)
   "Remove all properties of FILE in the cache context of KEY."
   (let* ((file (tramp-run-real-handler #'directory-file-name (list file)))
-        (truename (tramp-get-file-property key file "file-truename" nil)))
+        (truename (tramp-get-file-property key file "file-truename")))
     ;; Unify localname.  Remove hop from `tramp-file-name' structure.
     (setq file (tramp-compat-file-name-unquote file)
          key (copy-tramp-file-name key))
@@ -262,7 +262,7 @@ Remove also properties of all files in subdirectories."
   (setq directory (tramp-compat-file-name-unquote directory))
   (let* ((directory (tramp-run-real-handler
                    #'directory-file-name (list directory)))
-        (truename (tramp-get-file-property key directory "file-truename" nil)))
+        (truename (tramp-get-file-property key directory "file-truename")))
     (tramp-message key 8 "%s" directory)
     (dolist (key (hash-table-keys tramp-cache-data))
       (when (and (tramp-file-name-p key)
@@ -311,7 +311,7 @@ This is suppressed for temporary buffers."
 ;;; -- Properties --
 
 ;;;###tramp-autoload
-(defun tramp-get-connection-property (key property default)
+(defun tramp-get-connection-property (key property &optional default)
   "Get the named PROPERTY for the connection.
 KEY identifies the connection, it is either a process or a
 `tramp-file-name' structure.  A special case is nil, which is
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 006683bdcc..bd2dbf4a1e 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -135,7 +135,7 @@ When called interactively, a Tramp connection has to be 
selected."
                     (get-buffer (tramp-debug-buffer-name vec)))
                   (unless keep-debug
                     (get-buffer (tramp-trace-buffer-name vec)))
-                  (tramp-get-connection-property vec "process-buffer" nil)))
+                  (tramp-get-connection-property vec "process-buffer")))
       (when (bufferp buf) (kill-buffer buf)))
 
     ;; Flush file cache.
@@ -722,7 +722,7 @@ the debug buffer(s).")
 
        (when (y-or-n-p "Do you want to append the buffer(s)?")
          ;; OK, let's send.  First we delete the buffer list.
-         (kill-buffer nil)
+         (kill-buffer)
          (switch-to-buffer curbuf)
          (goto-char (point-max))
          (insert (propertize "\n" 'display "\n\
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index bd6d53afcb..a12e4859ac 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -31,7 +31,7 @@
 
 (require 'auth-source)
 (require 'format-spec)
-(require 'ls-lisp)  ;; Due to `tramp-handle-insert-directory'.
+(require 'ls-lisp) ;; Due to `tramp-handle-insert-directory'.
 (require 'parse-time)
 (require 'shell)
 (require 'subr-x)
@@ -234,7 +234,7 @@ CONDITION can also be a list of error conditions."
   (if (fboundp 'string-replace)
       #'string-replace
     (lambda (from-string to-string in-string)
-      (let ((case-fold-search nil))
+      (let (case-fold-search)
         (replace-regexp-in-string
          (regexp-quote from-string) to-string in-string t t)))))
 
@@ -243,7 +243,7 @@ CONDITION can also be a list of error conditions."
   (if (fboundp 'string-search)
       #'string-search
     (lambda (needle haystack &optional start-pos)
-      (let ((case-fold-search nil))
+      (let (case-fold-search)
         (string-match-p (regexp-quote needle) haystack start-pos)))))
 
 ;; Function `make-lock-file-name' is new in Emacs 28.1.
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index ca7bcf35ce..6cb1237a0f 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -151,7 +151,7 @@ If NAME doesn't belong to a crypted remote directory, retun 
nil."
         (dolist (dir tramp-crypt-directories)
           (and (string-prefix-p
                 dir (file-name-as-directory (expand-file-name name)))
-               (throw  'crypt-file-name-p dir))))))
+               (throw 'crypt-file-name-p dir))))))
 
 
 ;; New handlers should be added here.
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index 7a13760ffc..dd7e0f9f34 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -125,7 +125,7 @@ pass to the OPERATION."
          ;; "ftp" method is used in the Tramp file name.  So we unset
          ;; those values.
          (ange-ftp-ftp-name-arg "")
-         (ange-ftp-ftp-name-res nil))
+         ange-ftp-ftp-name-res)
       (cond
        ;; If argument is a symlink, `file-directory-p' and
        ;; `file-exists-p' call the traversed file recursively.  So we
diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el
index 20be74a79b..2ff106d602 100644
--- a/lisp/net/tramp-fuse.el
+++ b/lisp/net/tramp-fuse.el
@@ -153,7 +153,7 @@
 
 (defun tramp-fuse-mount-point (vec)
   "Return local mount point of VEC."
-  (or (tramp-get-connection-property vec "mount-point" nil)
+  (or (tramp-get-connection-property vec "mount-point")
       (expand-file-name
        (concat
        tramp-temp-name-prefix
@@ -177,7 +177,7 @@ It has the same meaning as 
`remote-file-name-inhibit-cache'.")
   ;; cannot use `with-tramp-file-property', because we don't want to
   ;; cache a nil result.
   (let ((remote-file-name-inhibit-cache tramp-fuse-mount-timeout))
-    (or (tramp-get-file-property vec "/" "mounted" nil)
+    (or (tramp-get-file-property vec "/" "mounted")
         (let* ((default-directory tramp-compat-temporary-file-directory)
                (command (format "mount -t fuse.%s" (tramp-file-name-method 
vec)))
               (mount (shell-command-to-string command)))
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 07e084768a..056237fd55 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1020,7 +1020,7 @@ file names."
 
         ;; We cannot copy or rename directly.
         ((or (and equal-remote
-                  (tramp-get-connection-property v "direct-copy-failed" nil))
+                  (tramp-get-connection-property v "direct-copy-failed"))
              (and t1 (not (tramp-gvfs-file-name-p filename)))
              (and t2 (not (tramp-gvfs-file-name-p newname))))
          (let ((tmpfile (tramp-compat-make-temp-file filename)))
@@ -1057,7 +1057,7 @@ file names."
                (if (or (not equal-remote)
                        (and equal-remote
                             (tramp-get-connection-property
-                             v "direct-copy-failed" nil)))
+                             v "direct-copy-failed")))
                    ;; Propagate the error.
                    (with-current-buffer (tramp-get-connection-buffer v)
                      (goto-char (point-min))
@@ -1145,7 +1145,7 @@ file names."
     (setq name (tramp-compat-file-name-concat dir name)))
   ;; If NAME is not a Tramp file, run the real handler.
   (if (not (tramp-tramp-file-p name))
-      (tramp-run-real-handler #'expand-file-name (list name nil))
+      (tramp-run-real-handler #'expand-file-name (list name))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
       ;; If there is a default location, expand tilde.
@@ -1336,32 +1336,29 @@ If FILE-SYSTEM is non-nil, return file system 
attributes."
             (or (cdr (assoc "standard::size" attributes)) "0")))
       ;; ... file mode flags
       (setq res-filemodes
-           (let ((n (cdr (assoc "unix::mode" attributes))))
-             (if n
-                 (tramp-file-mode-from-int (string-to-number n))
-               (format
-                "%s%s%s%s------"
-                (if dirp "d" (if res-symlink-target "l" "-"))
-                (if (equal (cdr (assoc "access::can-read" attributes))
-                           "FALSE")
-                    "-" "r")
-                (if (equal (cdr (assoc "access::can-write" attributes))
-                           "FALSE")
-                    "-" "w")
-                (if (equal (cdr (assoc "access::can-execute" attributes))
-                           "FALSE")
-                    "-" "x")))))
+           (if-let ((n (cdr (assoc "unix::mode" attributes))))
+               (tramp-file-mode-from-int (string-to-number n))
+             (format
+              "%s%s%s%s------"
+              (if dirp "d" (if res-symlink-target "l" "-"))
+              (if (equal (cdr (assoc "access::can-read" attributes))
+                         "FALSE")
+                  "-" "r")
+              (if (equal (cdr (assoc "access::can-write" attributes))
+                         "FALSE")
+                  "-" "w")
+              (if (equal (cdr (assoc "access::can-execute" attributes))
+                         "FALSE")
+                  "-" "x"))))
       ;; ... inode and device
       (setq res-inode
-           (let ((n (cdr (assoc "unix::inode" attributes))))
-             (if n
-                 (string-to-number n)
-               (tramp-get-inode (tramp-dissect-file-name filename)))))
+           (if-let ((n (cdr (assoc "unix::inode" attributes))))
+               (string-to-number n)
+             (tramp-get-inode (tramp-dissect-file-name filename))))
       (setq res-device
-           (let ((n (cdr (assoc "unix::device" attributes))))
-             (if n
-                 (string-to-number n)
-               (tramp-get-device (tramp-dissect-file-name filename)))))
+           (if-let ((n (cdr (assoc "unix::device" attributes))))
+               (string-to-number n)
+             (tramp-get-device (tramp-dissect-file-name filename))))
 
       ;; Return data gathered.
       (list
@@ -1582,8 +1579,7 @@ If FILE-SYSTEM is non-nil, return file system attributes."
          (with-current-buffer (tramp-get-connection-buffer vec)
            (goto-char (point-min))
            (when (looking-at-p "gio: Operation not supported")
-             (tramp-set-connection-property vec key nil)))
-         nil))))
+             (tramp-set-connection-property vec key nil)))))))
 
 (defun tramp-gvfs-handle-set-file-modes (filename mode &optional flag)
   "Like `set-file-modes' for Tramp files."
@@ -1612,12 +1608,11 @@ If FILE-SYSTEM is non-nil, return file system 
attributes."
 If USER is a string, return its home directory instead of the
 user identified by VEC.  If there is no user specified in either
 VEC or USER, or if there is no home directory, return nil."
-  (let ((localname
-        (tramp-get-connection-property vec "default-location" nil))
+  (let ((localname (tramp-get-connection-property vec "default-location"))
        result)
     (cond
      ((zerop (length localname))
-      (tramp-get-connection-property (tramp-get-process vec) "share" nil))
+      (tramp-get-connection-property (tramp-get-process vec) "share"))
      ;; Google-drive.
      ((not (string-prefix-p "/" localname))
       (dolist (item
@@ -1634,8 +1629,7 @@ ID-FORMAT valid values are `string' and `integer'."
   (if (equal id-format 'string)
       (tramp-file-name-user vec)
     (when-let ((localname
-               (tramp-get-connection-property
-                (tramp-get-process vec) "share" nil)))
+               (tramp-get-connection-property (tramp-get-process vec) 
"share")))
       (file-attribute-user-id
        (file-attributes (tramp-make-tramp-file-name vec localname) 
id-format)))))
 
@@ -1643,8 +1637,7 @@ ID-FORMAT valid values are `string' and `integer'."
   "The gid of the remote connection VEC, in ID-FORMAT.
 ID-FORMAT valid values are `string' and `integer'."
   (when-let ((localname
-             (tramp-get-connection-property
-              (tramp-get-process vec) "share" nil)))
+             (tramp-get-connection-property (tramp-get-process vec) "share")))
     (file-attribute-group-id
      (file-attributes (tramp-make-tramp-file-name vec localname) id-format))))
 
@@ -1682,7 +1675,7 @@ ID-FORMAT valid values are `string' and `integer'."
                  (concat (tramp-gvfs-get-remote-prefix v) localname)))
          (when (string-equal "mtp" method)
            (when-let
-               ((media (tramp-get-connection-property v "media-device" nil)))
+               ((media (tramp-get-connection-property v "media-device")))
              (setq method (tramp-media-device-method media)
                    host (tramp-media-device-host media)
                    port (tramp-media-device-port media))))
@@ -1757,7 +1750,7 @@ a downcased host name only."
            (setq domain (read-string "Domain name: ")))
 
          (tramp-message l 6 "%S %S %S %d" message user domain flags)
-         (unless (tramp-get-connection-property l "first-password-request" nil)
+         (unless (tramp-get-connection-property l "first-password-request")
            (tramp-clear-passwd l))
 
          (setq password (tramp-read-passwd
@@ -1879,14 +1872,13 @@ Their full names are 
\"org.gtk.vfs.MountTracker.mounted\" and
        (when (member method tramp-media-methods)
          ;; Ensure that media devices are cached.
          (tramp-get-media-devices nil)
-         (let ((v (tramp-get-connection-property
-                   (make-tramp-media-device
-                    :method method :host host :port port)
-                   "vector" nil)))
-           (when v
-             (setq method (tramp-file-name-method v)
-                   host (tramp-file-name-host v)
-                   port (tramp-file-name-port v)))))
+         (when-let ((v (tramp-get-connection-property
+                        (make-tramp-media-device
+                         :method method :host host :port port)
+                        "vector" nil)))
+           (setq method (tramp-file-name-method v)
+                 host (tramp-file-name-host v)
+                 port (tramp-file-name-port v))))
        (when (member method tramp-gvfs-methods)
          (let ((v (make-tramp-file-name
                    :method method :user user :domain domain
@@ -1924,15 +1916,14 @@ Their full names are 
\"org.gtk.vfs.MountTracker.mounted\" and
 (defun tramp-gvfs-connection-mounted-p (vec)
   "Check, whether the location is already mounted."
   (or
-   (tramp-get-file-property vec "/" "fuse-mountpoint" nil)
+   (tramp-get-file-property vec "/" "fuse-mountpoint")
    (catch 'mounted
      (dolist
         (elt
          (with-tramp-file-property vec "/" "list-mounts"
            (with-tramp-dbus-call-method vec t
              :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
-             tramp-gvfs-interface-mounttracker tramp-gvfs-listmounts))
-         nil)
+             tramp-gvfs-interface-mounttracker tramp-gvfs-listmounts)))
        ;; Jump over the first elements of the mount info.  Since there
        ;; were changes in the entries, we cannot access dedicated
        ;; elements.
@@ -1981,14 +1972,13 @@ Their full names are 
\"org.gtk.vfs.MountTracker.mounted\" and
         (when (member method tramp-media-methods)
           ;; Ensure that media devices are cached.
           (tramp-get-media-devices vec)
-          (let ((v (tramp-get-connection-property
-                    (make-tramp-media-device
-                     :method method :host host :port port)
-                    "vector" nil)))
-            (when v
-              (setq method (tramp-file-name-method v)
-                    host (tramp-file-name-host v)
-                    port (tramp-file-name-port v)))))
+          (when-let ((v (tramp-get-connection-property
+                         (make-tramp-media-device
+                          :method method :host host :port port)
+                         "vector")))
+            (setq method (tramp-file-name-method v)
+                  host (tramp-file-name-host v)
+                  port (tramp-file-name-port v))))
         (when (and
                (string-equal method (tramp-file-name-method vec))
                (string-equal user (tramp-file-name-user vec))
@@ -2244,7 +2234,7 @@ connection if a previous connection has died for some 
reason."
               (tramp-error
                vec 'file-error
                "Timeout reached mounting %s@%s using %s" user host method)))
-         (while (not (tramp-get-file-property vec "/" "fuse-mountpoint" nil))
+         (while (not (tramp-get-file-property vec "/" "fuse-mountpoint"))
            (read-event nil nil 0.1)))
 
        ;; If `tramp-gvfs-handler-askquestion' has returned "No", it
@@ -2382,11 +2372,11 @@ It checks for registered GNOME Online Accounts."
 (defun tramp-get-media-device (vec)
   "Transform VEC into a `tramp-media-device' structure.
 Check, that respective cache values do exist."
-  (if-let ((media (tramp-get-connection-property vec "media-device" nil))
-          (prop (tramp-get-connection-property media "vector" nil)))
+  (if-let ((media (tramp-get-connection-property vec "media-device"))
+          (prop (tramp-get-connection-property media "vector")))
       media
     (tramp-get-media-devices vec)
-    (tramp-get-connection-property vec "media-device" nil)))
+    (tramp-get-connection-property vec "media-device")))
 
 (defun tramp-get-media-devices (vec)
   "Retrieve media devices, and cache them.
@@ -2431,9 +2421,9 @@ It checks for mounted media devices."
    (lambda (key)
      (and (tramp-media-device-p key)
          (string-equal service (tramp-media-device-method key))
-         (tramp-get-connection-property key "vector" nil)
+         (tramp-get-connection-property key "vector")
          (list nil (tramp-file-name-host
-                    (tramp-get-connection-property key "vector" nil)))))
+                    (tramp-get-connection-property key "vector")))))
    (hash-table-keys tramp-cache-data)))
 
 
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
index 5e51074c49..226113d880 100644
--- a/lisp/net/tramp-integration.el
+++ b/lisp/net/tramp-integration.el
@@ -108,7 +108,7 @@ been set up by `rfn-eshadow-setup-minibuffer'."
                     end))
             (point-max))
            (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
-                 (rfn-eshadow-update-overlay-hook nil)
+                 rfn-eshadow-update-overlay-hook
                  file-name-handler-alist)
              (move-overlay rfn-eshadow-overlay (point-max) (point-max))
              (rfn-eshadow-update-overlay))))))))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index f2e91a1977..174fde720e 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1146,8 +1146,8 @@ component is used as the target of the symlink."
 
            ;; Use Perl implementation.
            ((and (tramp-get-remote-perl v)
-                 (tramp-get-connection-property v "perl-file-spec" nil)
-                 (tramp-get-connection-property v "perl-cwd-realpath" nil))
+                 (tramp-get-connection-property v "perl-file-spec")
+                 (tramp-get-connection-property v "perl-cwd-realpath"))
             (tramp-maybe-send-script
              v tramp-perl-file-truename "tramp_perl_file_truename")
             (setq result
@@ -1185,9 +1185,9 @@ component is used as the target of the symlink."
     (with-parsed-tramp-file-name filename nil
       (with-tramp-file-property v localname "file-exists-p"
        (or (not (null (tramp-get-file-property
-                       v localname "file-attributes-integer" nil)))
+                       v localname "file-attributes-integer")))
             (not (null (tramp-get-file-property
-                       v localname "file-attributes-string" nil)))
+                       v localname "file-attributes-string")))
            (tramp-send-command-and-check
             v
             (format
@@ -1463,7 +1463,7 @@ of."
         v (format
            "env TZ=UTC %s %s %s %s"
            (tramp-get-remote-touch v)
-           (if (tramp-get-connection-property v "touch-t" nil)
+           (if (tramp-get-connection-property v "touch-t")
                (format "-t %s" (format-time-string "%Y%m%d%H%M.%S" time t))
              "")
            (if (eq flag 'nofollow) "-h" "")
@@ -2350,7 +2350,7 @@ The method used must be an out-of-band method."
                  ?h (or (tramp-file-name-host v) "")
                  ?u (or (tramp-file-name-user v)
                         ;; There might be an interactive setting.
-                        (tramp-get-connection-property v "login-as" nil)
+                        (tramp-get-connection-property v "login-as")
                         "")
                  ;; For direct remote copying, the port must be the
                  ;; same for source and target.
@@ -2771,7 +2771,7 @@ the result will be a local, non-Tramp, file name."
     (with-parsed-tramp-file-name name nil
       ;; If connection is not established yet, run the real handler.
       (if (not (tramp-connectable-p v))
-         (tramp-run-real-handler #'expand-file-name (list name nil))
+         (tramp-run-real-handler #'expand-file-name (list name))
        (unless (tramp-run-real-handler #'file-name-absolute-p (list localname))
          (setq localname (concat "~/" localname)))
        ;; Tilde expansion if necessary.  This needs a shell which
@@ -3976,7 +3976,7 @@ Only send the definition if it has not already been done."
   ;; We cannot let-bind (tramp-get-connection-process vec) because it
   ;; might be nil.
   (let ((scripts (tramp-get-connection-property
-                 (tramp-get-connection-process vec) "scripts" nil)))
+                 (tramp-get-connection-process vec) "scripts")))
     (unless (member name scripts)
       (with-tramp-progress-reporter
          vec 5 (format-message "Sending script `%s'" name)
@@ -4226,7 +4226,7 @@ file exists and nonzero exit status otherwise."
 (defun tramp-find-shell (vec)
   "Open a shell on the remote host which groks tilde expansion."
   ;; If we are in `make-process', we don't need another shell.
-  (unless (tramp-get-connection-property vec "process-name" nil)
+  (unless (tramp-get-connection-property vec "process-name")
     (with-current-buffer (tramp-get-buffer vec)
       (let ((default-shell (tramp-get-method-parameter vec 
'tramp-remote-shell))
            shell)
@@ -4323,11 +4323,10 @@ process to set up.  VEC specifies the connection."
   ;; connection properties.  We start again with
   ;; `tramp-maybe-open-connection', it will be caught there.
   (tramp-message vec 5 "Checking system information")
-  (let* ((old-uname (tramp-get-connection-property vec "uname" nil))
+  (let* ((old-uname (tramp-get-connection-property vec "uname"))
         (uname
          ;; If we are in `make-process', we don't need to recompute.
-         (if (and old-uname
-                  (tramp-get-connection-property vec "process-name" nil))
+         (if (and old-uname (tramp-get-connection-property vec "process-name"))
              old-uname
            (tramp-set-connection-property
             vec "uname"
@@ -4935,7 +4934,7 @@ Goes through the list `tramp-inline-compress-commands'."
   "Close the connection VEC after a session timeout.
 If there is just some editing, retry it after 5 seconds."
   (if (and (tramp-get-connection-property
-           (tramp-get-connection-process vec) "locked" nil)
+           (tramp-get-connection-process vec) "locked")
           (tramp-file-name-equal-p vec (car tramp-current-connection)))
       (progn
        (tramp-message
@@ -4954,7 +4953,7 @@ connection if a previous connection has died for some 
reason."
     (throw 'non-essential 'non-essential))
 
   (let ((p (tramp-get-connection-process vec))
-       (process-name (tramp-get-connection-property vec "process-name" nil))
+       (process-name (tramp-get-connection-property vec "process-name"))
        (process-environment (copy-sequence process-environment))
        (pos (with-current-buffer (tramp-get-connection-buffer vec) (point))))
 
@@ -5168,9 +5167,9 @@ connection if a previous connection has died for some 
reason."
                          previous-hop hop)))
 
                ;; Activate session timeout.
-               (when (tramp-get-connection-property p "session-timeout" nil)
+               (when (tramp-get-connection-property p "session-timeout")
                  (run-at-time
-                  (tramp-get-connection-property p "session-timeout" nil) nil
+                  (tramp-get-connection-property p "session-timeout") nil
                   #'tramp-timeout-session vec))
 
                ;; Make initial shell settings.
@@ -5192,7 +5191,7 @@ is meant to be used from `tramp-maybe-open-connection' 
only.  The
 function waits for output unless NOOUTPUT is set."
   (unless neveropen (tramp-maybe-open-connection vec))
   (let ((p (tramp-get-connection-process vec)))
-    (when (tramp-get-connection-property p "remote-echo" nil)
+    (when (tramp-get-connection-property p "remote-echo")
       ;; We mark the command string that it can be erased in the output buffer.
       (tramp-set-connection-property p "check-remote-echo" t)
       ;; If we put `tramp-echo-mark' after a trailing newline (which
@@ -5959,7 +5958,7 @@ If no corresponding command is found, nil is returned."
             (> size tramp-inline-compress-start-size))
     (with-tramp-connection-property (tramp-get-process vec) prop
       (tramp-find-inline-compress vec)
-      (tramp-get-connection-property (tramp-get-process vec) prop nil))))
+      (tramp-get-connection-property (tramp-get-process vec) prop))))
 
 (defun tramp-get-inline-coding (vec prop size)
   "Return the coding command related to PROP.
@@ -5979,7 +5978,7 @@ function cell is returned to be applied on a buffer."
     (let ((coding
           (with-tramp-connection-property (tramp-get-process vec) prop
             (tramp-find-inline-encoding vec)
-            (tramp-get-connection-property (tramp-get-process vec) prop nil)))
+            (tramp-get-connection-property (tramp-get-process vec) prop)))
          (prop1 (if (tramp-compat-string-search "encoding" prop)
                     "inline-compress" "inline-decompress"))
          compress)
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 528463c5a7..b717c4dcc3 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -748,7 +748,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
     (setq name (tramp-compat-file-name-concat dir name)))
   ;; If NAME is not a Tramp file, run the real handler.
   (if (not (tramp-tramp-file-p name))
-      (tramp-run-real-handler #'expand-file-name (list name nil))
+      (tramp-run-real-handler #'expand-file-name (list name))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
       ;; Tilde expansion if necessary.
@@ -1385,7 +1385,7 @@ component is used as the target of the symlink."
       (when tmpinput (delete-file tmpinput))
       ;; FIXME: Does connection-property "process-buffer" still exist?
       (unless outbuf
-       (kill-buffer (tramp-get-connection-property v "process-buffer" nil)))
+       (kill-buffer (tramp-get-connection-property v "process-buffer")))
       (when process-file-side-effects
        (tramp-flush-directory-properties v ""))
 
@@ -1700,7 +1700,7 @@ Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME 
YEAR)."
     (setq localname (or localname "/"))
     (with-tramp-file-property v localname "file-entries"
       (let* ((share (tramp-smb-get-share v))
-            (cache (tramp-get-connection-property v "share-cache" nil))
+            (cache (tramp-get-connection-property v "share-cache"))
             res entry)
 
        (if (and (not share) cache)
@@ -2029,7 +2029,7 @@ If ARGUMENT is non-nil, use it as argument for
                      (if (not (zerop (length user))) (concat user "@") "")
                      host (or share ""))
 
-           (let* ((coding-system-for-read nil)
+           (let* (coding-system-for-read
                   (process-connection-type tramp-process-connection-type)
                   (p (let ((default-directory
                              tramp-compat-temporary-file-directory)
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index 61bf165f30..d7c918fbc8 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -449,7 +449,7 @@ connection if a previous connection has died for some 
reason."
     (funcall orig-fun)))
 
 (add-function
- :around  (symbol-function #'shell-mode) #'tramp-sshfs-tolerate-tilde)
+ :around (symbol-function #'shell-mode) #'tramp-sshfs-tolerate-tilde)
 (add-hook 'tramp-sshfs-unload-hook
          (lambda ()
            (remove-function
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 9d5a02456e..b580987e91 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1384,7 +1384,8 @@ would require an immediate reread during filename 
completion, nil
 means to use always cached values for the directory contents."
   :type '(choice (const nil) (const t) integer))
 (make-obsolete-variable
- 'tramp-completion-reread-directory-timeout 'remote-file-name-inhibit-cache 
"27.2")
+ 'tramp-completion-reread-directory-timeout
+ 'remote-file-name-inhibit-cache "27.2")
 
 ;;; Internal Variables:
 
@@ -1501,7 +1502,7 @@ entry does not exist, return nil."
         (replace-regexp-in-string "^tramp-" "" (symbol-name param))))
     (if (tramp-connection-property-p vec hash-entry)
        ;; We use the cached property.
-       (tramp-get-connection-property vec hash-entry nil)
+       (tramp-get-connection-property vec hash-entry)
       ;; Use the static value from `tramp-methods'.
       (when-let ((methods-entry
                  (assoc
@@ -1837,7 +1838,7 @@ Unless DONT-CREATE, the buffer is created when it doesn't 
exist yet."
          ;; as indication, whether a connection is active.
          (tramp-set-connection-property
           vec "process-buffer"
-          (tramp-get-connection-property vec "process-buffer" nil))
+          (tramp-get-connection-property vec "process-buffer"))
          (setq buffer-undo-list t
                default-directory
                (tramp-make-tramp-file-name vec 'noloc))
@@ -1848,14 +1849,14 @@ Unless DONT-CREATE, the buffer is created when it 
doesn't exist yet."
 Unless DONT-CREATE, the buffer is created when it doesn't exist yet.
 In case a second asynchronous communication has been started, it is different
 from `tramp-get-buffer'."
-  (or (tramp-get-connection-property vec "process-buffer" nil)
+  (or (tramp-get-connection-property vec "process-buffer")
       (tramp-get-buffer vec dont-create)))
 
 (defun tramp-get-connection-name (vec)
   "Get the connection name to be used for VEC.
 In case a second asynchronous communication has been started, it is different
 from the default one."
-  (or (tramp-get-connection-property vec "process-name" nil)
+  (or (tramp-get-connection-property vec "process-name")
       (tramp-buffer-name vec)))
 
 (defun tramp-get-process (vec-or-proc)
@@ -2352,7 +2353,7 @@ without a visible progress reporter."
             ;; running, and when there is a minimum level.
            (when-let ((pr (and (null tramp-inhibit-progress-reporter)
                                (<= ,level (min tramp-verbose 3))
-                               (make-progress-reporter ,message nil nil))))
+                               (make-progress-reporter ,message))))
              (run-at-time 3 0.1 #'tramp-progress-reporter-update pr))))
        (unwind-protect
            ;; Execute the body.
@@ -3521,7 +3522,7 @@ Let-bind it when necessary.")
               ;; home directory.
              (tramp-get-home-directory vec)
             ;; Otherwise, just use the cached value.
-            (tramp-get-connection-property vec "~" nil))))
+            (tramp-get-connection-property vec "~"))))
     (when home-dir
       (setq home-dir
            (tramp-compat-funcall
@@ -3651,7 +3652,7 @@ Let-bind it when necessary.")
     (setq name (tramp-compat-file-name-concat dir name)))
   ;; If NAME is not a Tramp file, run the real handler.
   (if (not (tramp-tramp-file-p name))
-      (tramp-run-real-handler #'expand-file-name (list name nil))
+      (tramp-run-real-handler #'expand-file-name (list name))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
       (unless (tramp-run-real-handler #'file-name-absolute-p (list localname))
@@ -3881,7 +3882,7 @@ Let-bind it when necessary.")
       (let* ((o (tramp-dissect-file-name filename))
             (p (tramp-get-connection-process o))
             (c (and (process-live-p p)
-                    (tramp-get-connection-property p "connected" nil))))
+                    (tramp-get-connection-property p "connected"))))
        ;; We expand the file name only, if there is already a connection.
        (with-parsed-tramp-file-name
            (if c (expand-file-name filename) filename) nil
@@ -4567,7 +4568,7 @@ substitution.  SPEC-LIST is a list of char/value pairs 
used for
     (and ;; The method supports it.
          (tramp-get-method-parameter v 'tramp-direct-async)
         ;; It has been indicated.
-         (tramp-get-connection-property v "direct-async-process" nil)
+         (tramp-get-connection-property v "direct-async-process")
         ;; There's no multi-hop.
         (or (not (tramp-multi-hop-p v))
             (= (length (tramp-compute-multi-hops v)) 1))
@@ -4848,7 +4849,7 @@ support symbolic links."
 
       (prog1
          ;; Run the process.
-         (process-file-shell-command command nil buffer nil)
+         (process-file-shell-command command nil buffer)
        ;; Insert error messages if they were separated.
        (when error-file
          (with-current-buffer error-buffer
@@ -5073,8 +5074,7 @@ of."
       ;; Sometimes, the process returns a new password request
       ;; immediately after rejecting the previous (wrong) one.
       (unless (or tramp-password-prompt-not-unique
-                 (tramp-get-connection-property
-                  vec "first-password-request" nil))
+                 (tramp-get-connection-property vec "first-password-request"))
        (tramp-clear-passwd vec))
       (goto-char (point-min))
       (tramp-check-for-regexp proc tramp-process-action-regexp)
@@ -5318,7 +5318,7 @@ performed successfully.  Any other value means an error."
   "Lock PROC for other communication, and run BODY.
 Mostly useful to protect BODY from being interrupted by timers."
   (declare (indent 1) (debug t))
-  `(if (tramp-get-connection-property ,proc "locked" nil)
+  `(if (tramp-get-connection-property ,proc "locked")
        ;; Be kind for older Emacsen.
        (if (member 'remote-file-error debug-ignored-errors)
           (throw 'non-essential 'non-essential)
@@ -5371,7 +5371,7 @@ Erase echoed commands if exists."
     ;; Check whether we need to remove echo output.  The max length of
     ;; the echo mark regexp is taken for search.  We restrict the
     ;; search for the second echo mark to PIPE_BUF characters.
-    (when (and (tramp-get-connection-property proc "check-remote-echo" nil)
+    (when (and (tramp-get-connection-property proc "check-remote-echo")
               (re-search-forward
                tramp-echoed-echo-mark-regexp
                (+ (point) (* 5 tramp-echo-mark-marker-length)) t))
@@ -5387,7 +5387,7 @@ Erase echoed commands if exists."
          (delete-region begin (point))
          (goto-char (point-min)))))
 
-    (when (or (not (tramp-get-connection-property proc "check-remote-echo" 
nil))
+    (when (or (not (tramp-get-connection-property proc "check-remote-echo"))
              ;; Sometimes, the echo string is suppressed on the remote side.
              (not (string-equal
                    (substring-no-properties
@@ -5449,7 +5449,7 @@ The STRING is expected to use Unix line-endings, but the 
lines sent to
 the remote host use line-endings as defined in the variable
 `tramp-rsh-end-of-line'.  The communication buffer is erased before sending."
   (let* ((p (tramp-get-connection-process vec))
-        (chunksize (tramp-get-connection-property p "chunksize" nil)))
+        (chunksize (tramp-get-connection-property p "chunksize")))
     (unless p
       (tramp-error
        vec 'file-error "Can't send string to remote host -- not logged in"))
@@ -5487,7 +5487,7 @@ the remote host use line-endings as defined in the 
variable
   (unless (process-live-p proc)
     (let ((vec (process-get proc 'vector))
          (buf (process-buffer proc))
-         (prompt (tramp-get-connection-property proc "prompt" nil)))
+         (prompt (tramp-get-connection-property proc "prompt")))
       (when vec
        (tramp-message vec 5 "Sentinel called: `%S' `%s'" proc event)
         (tramp-flush-connection-properties proc)
@@ -5711,7 +5711,7 @@ VEC is used for tracing."
   "Check `file-attributes' caches for VEC.
 Return t if according to the cache access type ACCESS is known to
 be granted."
-  (let ((result nil)
+  (let (result
         (offset (cond
                  ((eq ?r access) 1)
                  ((eq ?w access) 2)
@@ -6055,7 +6055,7 @@ Consults the auth-source package."
         (key (tramp-make-tramp-file-name vec 'noloc))
         (method (tramp-file-name-method vec))
         (user (or (tramp-file-name-user-domain vec)
-                  (tramp-get-connection-property key "login-as" nil)))
+                  (tramp-get-connection-property key "login-as")))
         (host (tramp-file-name-host-port vec))
         (pw-prompt
          (or prompt
@@ -6078,8 +6078,7 @@ Consults the auth-source package."
         (setq tramp-password-save-function nil)
         ;; See if auth-sources contains something useful.
         (ignore-errors
-          (and (tramp-get-connection-property
-                vec "first-password-request" nil)
+          (and (tramp-get-connection-property vec "first-password-request")
                ;; Try with Tramp's current method.  If there is no
                ;; user name, `:create' triggers to ask for.  We
                ;; suppress it.
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 9a2f495eb8..68fd110ec0 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -52,9 +52,9 @@
     ;; Suppress message from `emacs-repository-get-branch'.  We must
     ;; also handle out-of-tree builds.
     (let ((inhibit-message t)
-         (debug-on-error nil)
          (dir (or (locate-dominating-file (locate-library "tramp") ".git")
-                  source-directory)))
+                  source-directory))
+         debug-on-error)
       ;; `emacs-repository-get-branch' has been introduced with Emacs 27.1.
       (with-no-warnings
        (and (stringp dir) (file-directory-p dir)
@@ -67,9 +67,9 @@
     ;; Suppress message from `emacs-repository-get-version'.  We must
     ;; also handle out-of-tree builds.
     (let ((inhibit-message t)
-         (debug-on-error nil)
          (dir (or (locate-dominating-file (locate-library "tramp") ".git")
-                  source-directory)))
+                  source-directory))
+         debug-on-error)
       (and (stringp dir) (file-directory-p dir)
           (executable-find "git")
           (emacs-repository-get-version dir))))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 63fd96cae8..a53fc7ec7a 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -6570,7 +6570,7 @@ Additionally, ls does not support \"--dired\"."
         ;; This fails for tramp-crypt.el, so we ignore that.
         (ignore-errors
           (insert-directory ert-remote-temporary-file-directory "-al"))
-        (not (tramp-get-connection-property tramp-test-vec "ls--dired" nil)))))
+        (not (tramp-get-connection-property tramp-test-vec "ls--dired")))))
 
 (defun tramp--test-share-p ()
   "Check, whether the method needs a share."
@@ -7141,13 +7141,13 @@ The values are derived from PROC.  Run BODY.
 This is needed in timer functions as well as process filters and sentinels."
   ;; FIXME: For tramp-sshfs.el, `processp' does not work.
   (declare (indent 1) (debug (processp body)))
-  `(let* ((v (tramp-get-connection-property ,proc "vector" nil))
-         (pname (tramp-get-connection-property v "process-name" nil))
-         (pbuffer (tramp-get-connection-property v "process-buffer" nil)))
+  `(let* ((v (tramp-get-connection-property ,proc "vector"))
+         (pname (tramp-get-connection-property v "process-name"))
+         (pbuffer (tramp-get-connection-property v "process-buffer")))
      (tramp--test-message
       "tramp--test-with-proper-process-name-and-buffer before %s %s"
-      (tramp-get-connection-property v "process-name" nil)
-      (tramp-get-connection-property v "process-buffer" nil))
+      (tramp-get-connection-property v "process-name")
+      (tramp-get-connection-property v "process-buffer"))
      (if (process-name ,proc)
         (tramp-set-connection-property v "process-name" (process-name ,proc))
        (tramp-flush-connection-property v "process-name"))
@@ -7157,8 +7157,8 @@ This is needed in timer functions as well as process 
filters and sentinels."
        (tramp-flush-connection-property v "process-buffer"))
      (tramp--test-message
       "tramp--test-with-proper-process-name-and-buffer changed %s %s"
-      (tramp-get-connection-property v "process-name" nil)
-      (tramp-get-connection-property v "process-buffer" nil))
+      (tramp-get-connection-property v "process-name")
+      (tramp-get-connection-property v "process-buffer"))
      (unwind-protect
         (progn ,@body)
        (if pname



reply via email to

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