emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102584: Smarter initialization for d


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102584: Smarter initialization for dired-use-ls-dired (Bug#7546).
Date: Sat, 04 Dec 2010 17:10:12 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102584
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2010-12-04 17:10:12 -0500
message:
  Smarter initialization for dired-use-ls-dired (Bug#7546).
  
  * lisp/dired.el (dired-use-ls-dired): Set default to a special
  "unspecified" value.
  (dired-insert-directory): When called the first time, check
  whether "ls --dired" succeeds and set dired-use-ls-dired (Bug#7546).
modified:
  lisp/ChangeLog
  lisp/dired.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-12-04 01:58:06 +0000
+++ b/lisp/ChangeLog    2010-12-04 22:10:12 +0000
@@ -1,3 +1,10 @@
+2010-12-04  Chong Yidong  <address@hidden>
+
+       * dired.el (dired-use-ls-dired): Set default to a special
+       "unspecified" value.
+       (dired-insert-directory): When called the first time, check
+       whether "ls --dired" succeeds and set dired-use-ls-dired (Bug#7546).
+
 2010-12-04  Tak Ota  <address@hidden>
 
        * replace.el: Add "collect" feature to occur.

=== modified file 'lisp/dired.el'
--- a/lisp/dired.el     2010-11-27 20:04:57 +0000
+++ b/lisp/dired.el     2010-12-04 22:10:12 +0000
@@ -80,8 +80,11 @@
       "/etc/chown")))
   "Name of chown command (usually `chown' or `/etc/chown').")
 
-(defvar dired-use-ls-dired (not (not (string-match "gnu" 
system-configuration)))
-  "Non-nil means Dired should use `ls --dired'.")
+(defvar dired-use-ls-dired 'unspecified
+  "Non-nil means Dired should use \"ls --dired\".
+The special value of `unspecified' means to check explicitly, and
+save the result in this variable.  This is performed the first
+time `dired-insert-directory' is called.")
 
 (defvar dired-chmod-program "chmod"
   "Name of chmod command (usually `chmod').")
@@ -1057,7 +1060,14 @@
   (let ((opoint (point))
        (process-environment (copy-sequence process-environment))
        end)
-    (if (or dired-use-ls-dired (file-remote-p dir))
+    (if (or (if (eq dired-use-ls-dired 'unspecified)
+               ;; Check whether "ls --dired" gives exit code 0, and
+               ;; save the answer in `dired-use-ls-dired'.
+               (setq dired-use-ls-dired
+                     (eq (call-process insert-directory-program nil nil nil 
"--dired")
+                         0))
+             dired-use-ls-dired)
+           (file-remote-p dir))
        (setq switches (concat "--dired " switches)))
     ;; We used to specify the C locale here, to force English month names;
     ;; but this should not be necessary any more,


reply via email to

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