(defun tramp-sh-handle-insert-directory
(filename switches &optional wildcard full-directory-p)
"Like `insert-directory' for Tramp files."
- (unless switches (setq switches ""))
- ;; Check, whether directory is accessible.
- (unless wildcard
- (access-file filename "Reading directory"))
- (with-parsed-tramp-file-name (expand-file-name filename) nil
- (if (and (featurep 'ls-lisp)
- (not ls-lisp-use-insert-directory-program))
- (tramp-handle-insert-directory
- filename switches wildcard full-directory-p)
+ (if (and (featurep 'ls-lisp)
+ (not ls-lisp-use-insert-directory-program))
+ (tramp-handle-insert-directory
+ filename switches wildcard full-directory-p)
+ (unless switches (setq switches ""))
+ ;; Check, whether directory is accessible.
+ (unless wildcard
+ (access-file filename "Reading directory"))
+ (with-parsed-tramp-file-name (expand-file-name filename) nil
(let ((dired (tramp-get-ls-command-with v "--dired")))
(when (stringp switches)
(setq switches (split-string switches)))
(declare-function file-notify-rm-watch "filenotify")
(declare-function netrc-parse "netrc")
(defvar auto-save-file-name-transforms)
+(defvar ls-lisp-dirs-first)
+(defvar ls-lisp-emulation)
+(defvar ls-lisp-ignore-case)
(defvar ls-lisp-use-insert-directory-program)
+(defvar ls-lisp-verbosity)
(defvar tramp-prefix-format)
(defvar tramp-prefix-regexp)
(defvar tramp-method-regexp)
(tramp-error v 'file-error "Unsafe backup file name"))))))
(defun tramp-handle-insert-directory
- (filename switches &optional wildcard full-directory-p)
+ (filename switches &optional wildcard full-directory-p)
"Like `insert-directory' for Tramp files."
(require 'ls-lisp)
(unless switches (setq switches ""))
(access-file filename "Reading directory"))
(with-parsed-tramp-file-name (expand-file-name filename) nil
(with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
- (let (ls-lisp-use-insert-directory-program start)
- ;; Silence byte compiler.
+ ;; We bind `ls-lisp-emulation' to nil (which is GNU).
+ ;; `ls-lisp-set-options' modifies `ls-lisp-ignore-case',
+ ;; `ls-lisp-dirs-first' and `ls-lisp-verbosity', so we bind them
+ ;; as well. We don't want to use `insert-directory-program'.
+ (let (ls-lisp-emulation ls-lisp-ignore-case ls-lisp-dirs-first
+ ls-lisp-verbosity ls-lisp-use-insert-directory-program start)
+ ;; Set proper options based on `ls-lisp-emulation'.
+ (tramp-compat-funcall 'ls-lisp-set-options)
(tramp-run-real-handler
#'insert-directory
(list filename switches wildcard full-directory-p))