]> git.eshelyaron.com Git - emacs.git/commitdiff
Require ls-lisp in Tramp only when needed
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 17 Jun 2023 16:15:09 +0000 (18:15 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 17 Jun 2023 16:15:09 +0000 (18:15 +0200)
* 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
lisp/net/tramp-sh.el
lisp/net/tramp.el

index f176476a73a2e170a564140faae03b79f7a169a8..673c6679dbe55aca480aceb254cda2b1ca80bfdc 100644 (file)
 
 (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")
index 392a654df21f5cd7fcf4e78e5c0bb508d845ed3e..48ba3d09e3e33166228a643a8d0aa909a1ef7eff 100644 (file)
@@ -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)
index 7df455954d8bd3ee510d58d994735b3c0f35ac68..b46eeb8e3740a781a5856f44cf4c7956871c8314 100644 (file)
@@ -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))