* 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.
(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")
(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)
(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)
(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.
(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)
(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))