emacs-diffs
[Top][All Lists]
Advanced

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

master 21c81f49e7b: Ensure, that Tramp uses GNU style emulation when cal


From: Michael Albinus
Subject: master 21c81f49e7b: Ensure, that Tramp uses GNU style emulation when calling ls-lisp
Date: Tue, 3 Oct 2023 04:03:04 -0400 (EDT)

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

    Ensure, that Tramp uses GNU style emulation when calling ls-lisp
    
    * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Reorganize.
    
    * lisp/net/tramp.el (ls-lisp-dirs-first, ls-lisp-emulation)
    (ls-lisp-ignore-case, ls-lisp-verbosity): Declare.
    (tramp-handle-insert-directory): Bind `ls-lisp-*' options.  Call
    `ls-lisp-set-options'.
---
 lisp/net/tramp-sh.el | 18 +++++++++---------
 lisp/net/tramp.el    | 16 +++++++++++++---
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 07f1cf24542..95c27626166 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2637,15 +2637,15 @@ The method used must be an out-of-band method."
 (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)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index aca2ebb8e8a..bff9a010c3b 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -67,7 +67,11 @@
 (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)
@@ -4159,7 +4163,7 @@ Let-bind it when necessary.")
          (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 ""))
@@ -4172,8 +4176,14 @@ Let-bind it when necessary.")
     (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))



reply via email to

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