diff options
Diffstat (limited to 'lisp/net/tramp-crypt.el')
-rw-r--r-- | lisp/net/tramp-crypt.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index 286b60a48c2..4d34bbbeea6 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -668,7 +668,8 @@ absolute file names." (let (tramp-crypt-enabled) (delete-file (tramp-crypt-encrypt-file-name filename))))) -(defun tramp-crypt-handle-directory-files (directory &optional full match nosort) +(defun tramp-crypt-handle-directory-files + (directory &optional full match nosort count) "Like `directory-files' for Tramp files." (unless (file-exists-p directory) (tramp-error @@ -697,7 +698,11 @@ absolute file names." (replace-regexp-in-string (concat "^" (regexp-quote directory)) "" x)) result))) - (if nosort result (sort result #'string<))))) + (unless nosort + (setq result (sort result #'string<))) + (when (and (natnump count) (> count 0)) + (setq result (nbutlast result (- (length result) count)))) + result))) (defun tramp-crypt-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." |