emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 948b471756e 1/3: Require ls-lisp in Tramp only when needed


From: Michael Albinus
Subject: emacs-29 948b471756e 1/3: Require ls-lisp in Tramp only when needed
Date: Sat, 17 Jun 2023 12:16:36 -0400 (EDT)

branch: emacs-29
commit 948b471756e517166a6d8bbbcfda83e4b572d553
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Require ls-lisp in Tramp only when needed
    
    * lisp/net/tramp-compat.el (ls-lisp): Require only on MS Windows.
    (Bug#64124)
    
    * lisp/net/tramp-sh.el (ls-lisp-use-insert-directory-program): Declare.
    (tramp-sh-handle-insert-directory): Simplify.
    
    * lisp/net/tramp.el (ls-lisp-use-insert-directory-program): Declare.
    (tramp-handle-insert-directory): Require ls-lisp.  Simplify.
---
 lisp/net/tramp-compat.el | 4 +++-
 lisp/net/tramp-sh.el     | 3 ++-
 lisp/net/tramp.el        | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index f176476a73a..673c6679dbe 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -31,11 +31,13 @@
 
 (require 'auth-source)
 (require 'format-spec)
-(require 'ls-lisp) ;; Due to `tramp-handle-insert-directory'.
 (require 'parse-time)
 (require 'shell)
 (require 'subr-x)
 
+(when (memq system-type '(ms-dos windows-nt))
+  (require 'ls-lisp))
+
 (declare-function tramp-compat-rx "tramp")
 (declare-function tramp-error "tramp")
 (declare-function tramp-file-name-handler "tramp")
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 392a654df21..48ba3d09e3e 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -38,6 +38,7 @@
 (declare-function dired-compress-file "dired-aux")
 (declare-function dired-remove-file "dired-aux")
 (defvar dired-compress-file-suffixes)
+(defvar ls-lisp-use-insert-directory-program)
 ;; Added in Emacs 28.1.
 (defvar process-file-return-signal-string)
 (defvar vc-handled-backends)
@@ -2659,7 +2660,7 @@ The method used must be an out-of-band method."
     (access-file filename "Reading directory"))
   (with-parsed-tramp-file-name (expand-file-name filename) nil
     (if (and (featurep 'ls-lisp)
-            (not (symbol-value 'ls-lisp-use-insert-directory-program)))
+            (not ls-lisp-use-insert-directory-program))
        (tramp-handle-insert-directory
         filename switches wildcard full-directory-p)
       (when (stringp switches)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 7df455954d8..b46eeb8e374 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -63,6 +63,7 @@
 (declare-function file-notify-rm-watch "filenotify")
 (declare-function netrc-parse "netrc")
 (defvar auto-save-file-name-transforms)
+(defvar ls-lisp-use-insert-directory-program)
 
 ;; Reload `tramp-compat' when we reload `tramp-autoloads' of the GNU
 ;; ELPA package.
@@ -4181,6 +4182,7 @@ Let-bind it when necessary.")
 (defun tramp-handle-insert-directory
   (filename switches &optional wildcard full-directory-p)
   "Like `insert-directory' for Tramp files."
+  (require 'ls-lisp)
   (unless switches (setq switches ""))
   ;; Mark trailing "/".
   (when (and (directory-name-p filename)
@@ -4193,7 +4195,6 @@ Let-bind it when necessary.")
     (with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
       (let (ls-lisp-use-insert-directory-program start)
        ;; Silence byte compiler.
-       (ignore ls-lisp-use-insert-directory-program)
        (tramp-run-real-handler
         #'insert-directory
         (list filename switches wildcard full-directory-p))



reply via email to

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