summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-crypt.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2020-11-05 17:36:04 +0100
committerMichael Albinus <michael.albinus@gmx.de>2020-11-05 17:36:04 +0100
commit334e2ab440a466a40b7c28d26dfe4207c6bb95e8 (patch)
tree8e0aae8adb25189a8a5f940b35d87f172384c5ad /lisp/net/tramp-crypt.el
parentef5211d0aa3186fffa43639072fc3325a3003623 (diff)
downloademacs-334e2ab440a466a40b7c28d26dfe4207c6bb95e8.tar.gz
emacs-334e2ab440a466a40b7c28d26dfe4207c6bb95e8.tar.bz2
emacs-334e2ab440a466a40b7c28d26dfe4207c6bb95e8.zip
Still fixes for Tramp directory-files-*
* lisp/net/tramp.el (tramp-handle-directory-files): * lisp/net/tramp-adb.el (tramp-adb-handle-directory-files-and-attributes): Fix COUNT. * lisp/net/tramp-crypt.el (tramp-crypt-handle-directory-files): Implement COUNT. * lisp/net/tramp-gvfs.el (tramp-gvfs-dbus-byte-array-to-string): * lisp/net/tramp-integration.el (tramp-eshell-directory-change): Use `nbutlast'. * lisp/net/tramp-rclone.el (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file): Reorder cache flushing. (tramp-rclone-handle-directory-files): Use `tramp-compat-directory-files'. * lisp/net/tramp-sh.el (tramp-sh-handle-directory-files-and-attributes): Fix NOSORT and COUNT. * lisp/net/tramp-smb.el (tramp-smb-handle-directory-files): Fix NOSORT. * test/lisp/net/tramp-tests.el (tramp--test-share-p): New defun. (tramp-test05-expand-file-name-relative): Use it. (tramp-test16-directory-files) (tramp-test19-directory-files-and-attributes): Strengthen test. (tramp-test20-file-modes): Simplify check.
Diffstat (limited to 'lisp/net/tramp-crypt.el')
-rw-r--r--lisp/net/tramp-crypt.el9
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."