]> git.eshelyaron.com Git - emacs.git/commitdiff
* dired.el (dired-sort-toggle): Some ls implementations only allow
authorGlenn Morris <rgm@gnu.org>
Thu, 18 Oct 2012 03:50:15 +0000 (20:50 -0700)
committerGlenn Morris <rgm@gnu.org>
Thu, 18 Oct 2012 03:50:15 +0000 (20:50 -0700)
a single option string.

Fixes: debbugs:12666
lisp/ChangeLog
lisp/dired.el

index 398b058a87463b6b52e7dc14d53215b6214290e6..e799ead207b5204c9f723500e95dccff5eada1e3 100644 (file)
@@ -1,5 +1,8 @@
 2012-10-18  Glenn Morris  <rgm@gnu.org>
 
+       * dired.el (dired-sort-toggle): Some ls implementations only allow
+       a single option string.  (Bug#12666)
+
        * minibuffer.el (completion-cycle-threshold): Doc fix.
 
 2012-10-17  Kenichi Handa  <handa@gnu.org>
index a17e180533917cfc77750da1c0f558c0bbf94957..a4bc16caebf7b19b936bc7eaac2a37daa704284f 100644 (file)
@@ -3546,8 +3546,15 @@ With a prefix argument, edit the current listing switches instead."
        (setq dired-actual-switches
              (replace-match "" t t dired-actual-switches 3))))
     ;; Now, if we weren't sorting by date before, add the -t switch.
+    ;; Some simple-minded ls implementations (eg ftp servers) only
+    ;; allow a single option string, so try not to add " -t" if possible.
     (unless sorting-by-date
-      (setq dired-actual-switches (concat dired-actual-switches " -t"))))
+      (setq dired-actual-switches
+            (concat dired-actual-switches
+                    (if (string-match-p "\\`-[[:alnum:]]+\\'"
+                                        dired-actual-switches)
+                        "t"
+                      " -t")))))
   (dired-sort-set-mode-line)
   (revert-buffer))