emacs-devel
[Top][All Lists]
Advanced

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

Re: empty-directory predicate, native implementation


From: Arthur Miller
Subject: Re: empty-directory predicate, native implementation
Date: Thu, 15 Oct 2020 16:01:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Michael Albinus <michael.albinus@gmx.de> writes:

>>> - Adapt the file name handlers. These are ange-ftp-directory-files,
>>>   ange-ftp-directory-files-and-attributes, tramp-handle-directory-files,
>>>   tramp-handle-directory-files-and-attributes,
>>>   tramp-adb-handle-directory-files-and-attributes,
>>>   tramp-crypt-handle-directory-files,
>>>   tramp-rclone-handle-directory-files,
>>>   tramp-sh-handle-directory-files-and-attributes,
>>>   tramp-smb-handle-directory-files.

Sorry to bother, just one question: I am looking at ange-ftp, and see no
'nosort' and 'id-format' arguments passed in ange-ftp-directory-files:

(defun ange-ftp-directory-files (directory &optional full match &rest v19-args)

Are those (and count) taken care of as "rest" together with &rest
v19-args or should I specify them as it is done in 
ange-ftp-directory-and-attributes:

(defun ange-ftp-directory-files-and-attributes
  (directory &optional full match nosort id-format)


Would this work:

(defun ange-ftp-directory-files (directory &optional full match
                                           nosort id-format count
                                           &rest v19-args)
  (setq directory (expand-file-name directory))
  (if (ange-ftp-ftp-name directory)
      (progn
        (ange-ftp-barf-if-not-directory directory)
        (let ((tail (ange-ftp-hash-table-keys
                     (ange-ftp-get-files directory)))
              files f)
          (setq directory (file-name-as-directory directory))
          (while tail
            (setq f (car tail)
                  tail (cdr tail))
            (if (or (not match) (string-match-p match f))
                (setq files
                      (cons (if full (concat directory f) f) files))))
          (nreverse files)))
    (apply 'ange-ftp-real-directory-files directory full match nosort
                                           id-format count v19-args))) 

(defun ange-ftp-directory-files-and-attributes
  (directory &optional full match nosort id-format count)
  (setq directory (expand-file-name directory))
  (if (ange-ftp-ftp-name directory)
      (mapcar
       (lambda (file)
         (cons file (file-attributes (expand-file-name file directory))))
       (ange-ftp-directory-files directory full match nosort))
    (ange-ftp-real-directory-files-and-attributes
     directory full match nosort id-format count)))

Can I remove either &rest v19-version, or nosort through count?



reply via email to

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