emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r104542: ange-ftp fixes for dired swi


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104542: ange-ftp fixes for dired switches not being just a single short option.
Date: Wed, 08 Jun 2011 23:07:11 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104542
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Wed 2011-06-08 23:07:11 -0700
message:
  ange-ftp fixes for dired switches not being just a single short option.
  
  * lisp/net/ange-ftp.el (ange-ftp-switches-ok): New function.
  (ange-ftp-get-files): Use it.
modified:
  lisp/ChangeLog
  lisp/net/ange-ftp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-09 05:33:26 +0000
+++ b/lisp/ChangeLog    2011-06-09 06:07:11 +0000
@@ -1,3 +1,8 @@
+2011-06-09  Glenn Morris  <address@hidden>
+
+       * net/ange-ftp.el (ange-ftp-switches-ok): New function.
+       (ange-ftp-get-files): Use it.
+
 2011-06-09  Alexander Klimov  <address@hidden>  (tiny change)
 
        * mail/sendmail.el (mail-recover-1, mail-recover):

=== modified file 'lisp/net/ange-ftp.el'
--- a/lisp/net/ange-ftp.el      2011-05-23 17:57:17 +0000
+++ b/lisp/net/ange-ftp.el      2011-06-09 06:07:11 +0000
@@ -2806,6 +2806,19 @@
   (and files (puthash (file-name-as-directory directory)
                      files ange-ftp-files-hashtable)))
 
+(defun ange-ftp-switches-ok (switches)
+  "Return SWITCHES (a string) if suitable for our use."
+  (and (stringp switches)
+       ;; We allow the A switch, which lists all files except "." and
+       ;; "..".  This is OK because we manually insert these entries
+       ;; in the hash table.
+       (string-match
+       "--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
+       (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
+       (not (string-match
+            "--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+       switches))
+
 (defun ange-ftp-get-files (directory &optional no-error)
   "Given a DIRECTORY, return a hashtable of file entries.
 This will give an error or return nil, depending on the value of
@@ -2817,30 +2830,12 @@
                          ;; This is an efficiency hack. We try to
                          ;; anticipate what sort of listing dired
                          ;; might want, and cache just such a listing.
-                         (if (and (boundp 'dired-actual-switches)
-                                  (stringp dired-actual-switches)
-                                  ;; We allow the A switch, which lists
-                                  ;; all files except "." and "..".
-                                  ;; This is OK because we manually
-                                  ;; insert these entries
-                                  ;; in the hash table.
-                                  (string-match
-                                   "[aA]" dired-actual-switches)
-                                  (string-match
-                                   "l" dired-actual-switches)
-                                  (not (string-match
-                                        "R" dired-actual-switches)))
-                             dired-actual-switches
-                           (if (and (boundp 'dired-listing-switches)
-                                    (stringp dired-listing-switches)
-                                    (string-match
-                                     "[aA]" dired-listing-switches)
-                                    (string-match
-                                     "l" dired-listing-switches)
-                                    (not (string-match
-                                          "R" dired-listing-switches)))
-                               dired-listing-switches
-                             "-al"))
+                         (or (and (boundp 'dired-actual-switches)
+                                  (ange-ftp-switches-ok dired-actual-switches))
+                             (and (boundp 'dired-listing-switches)
+                                  (ange-ftp-switches-ok
+                                   dired-listing-switches))
+                             "-al")
                          t no-error)
             (gethash directory ange-ftp-files-hashtable)))))
 


reply via email to

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