tramp-devel
[Top][All Lists]
Advanced

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

Re: Help needed from XEmacs gurus (was: Invalid format character: ?m)


From: Kai Großjohann
Subject: Re: Help needed from XEmacs gurus (was: Invalid format character: ?m)
Date: Tue, 23 Jul 2002 11:53:08 +0200
User-agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (i686-pc-linux-gnu)

Daniel Serodio <address@hidden> writes:

> On Mon, 2002-07-22 at 16:28, Kai Großjohann wrote:
>> Daniel Serodio <address@hidden> writes:
>> 
>> > Signaling: (wrong-number-of-arguments (lambda (directory &optional full
>> > match nosort) "Like `directory-files' for tramp files." [...]) 5)
>> 
>> Okay.  Something called directory-files with five arguments, but Tramp
>> only accepts four.  What is the documentation of directory-files in
>> your XEmacs?
>
> `directory-files' is a built-in function
> (directory-files DIRECTORY &optional FULL MATCH NOSORT FILES-ONLY)

Please try the current CVS version or the following patch.

2002-07-23  Kai Großjohann  <address@hidden>

        (tramp-handle-directory-files): Handle fifth, XEmacs-specific,
        arg FILES-ONLY.

Index: lisp/tramp.el
===================================================================
RCS file: /cvsroot/tramp/tramp/lisp/tramp.el,v
retrieving revision 2.139
diff -u -r2.139 tramp.el
--- lisp/tramp.el       23 Jul 2002 09:38:24 -0000      2.139
+++ lisp/tramp.el       23 Jul 2002 09:50:51 -0000
@@ -2204,12 +2204,13 @@
 
 ;; Directory listings.
 
-(defun tramp-handle-directory-files (directory &optional full match nosort)
+(defun tramp-handle-directory-files (directory
+                                    &optional full match nosort files-only)
   "Like `directory-files' for tramp files."
   (with-parsed-tramp-file-name directory nil
     (when (tramp-ange-ftp-file-name-p multi-method method)
       (tramp-invoke-ange-ftp 'directory-files
-                            directory full match nosort))
+                            directory full match nosort files-only))
     (let (result x)
       (save-excursion
        (tramp-barf-unless-okay
@@ -2235,7 +2236,26 @@
                      result)
              (push x result))))
        (tramp-send-command multi-method method user host "cd")
-       (tramp-wait-for-output))
+       (tramp-wait-for-output)
+       ;; Remove non-files or non-directories if necessary.  Using
+       ;; the remote shell for this would probably be way faster.
+       ;; Maybe something could be adapted from
+       ;; tramp-handle-file-name-all-completions.
+       (when files-only
+         (let ((temp (nreverse result))
+               item)
+           (setq result nil)
+           (if (equal files-only t)
+               ;; files only
+               (while temp
+                 (setq item (pop temp))
+                 (when (file-regular-p item)
+                   (push item result)))
+             ;; directories only
+             (while temp
+               (setq item (pop temp))
+               (when (file-directory-p item)
+                 (push item result)))))))
       result)))
 
 ;; This function should return "foo/" for directories and "bar" for


kai
-- 
A large number of young women don't trust men with beards.  (BFBS Radio)



reply via email to

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