emacs-diffs
[Top][All Lists]
Advanced

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

emacs-28 007bf9a34c: Hide temporary FUSE files in Tramp


From: Michael Albinus
Subject: emacs-28 007bf9a34c: Hide temporary FUSE files in Tramp
Date: Sun, 15 May 2022 09:09:36 -0400 (EDT)

branch: emacs-28
commit 007bf9a34c52334434e5ee29928773f051e0f19e
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Hide temporary FUSE files in Tramp
    
    * lisp/net/tramp-fuse.el (tramp-fuse-remove-hidden-files): New defsubst.
    (tramp-fuse-handle-directory-files)
    (tramp-fuse-handle-file-name-all-completions): Use it.
---
 lisp/net/tramp-fuse.el | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el
index 17d419f853..54e7999e7a 100644
--- a/lisp/net/tramp-fuse.el
+++ b/lisp/net/tramp-fuse.el
@@ -44,6 +44,12 @@
     (delete-file (tramp-fuse-local-file-name filename) trash)
     (tramp-flush-file-properties v localname)))
 
+(defsubst tramp-fuse-remove-hidden-files (files)
+  "Remove hidden files from FILES."
+  (cl-remove-if
+   (lambda (x) (and (stringp x) (string-match-p "\\.fuse_hidden" x)))
+   files))
+
 (defun tramp-fuse-handle-directory-files
     (directory &optional full match nosort count)
   "Like `directory-files' for Tramp files."
@@ -75,7 +81,8 @@
                              result)))
            (setq result (cons item result))))
        ;; Return result.
-       (if nosort result (sort result #'string<))))))
+       (tramp-fuse-remove-hidden-files
+        (if nosort result (sort result #'string<)))))))
 
 (defun tramp-fuse-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for Tramp files."
@@ -92,20 +99,21 @@
 
 (defun tramp-fuse-handle-file-name-all-completions (filename directory)
   "Like `file-name-all-completions' for Tramp files."
-  (all-completions
-   filename
-   (delete-dups
-    (append
-     (file-name-all-completions
-      filename (tramp-fuse-local-file-name directory))
-     ;; Some storage systems do not return "." and "..".
-     (let (result)
-       (dolist (item '(".." ".") result)
-        (when (string-prefix-p filename item)
-          (catch 'match
-            (dolist (elt completion-regexp-list)
-              (unless (string-match-p elt item) (throw 'match nil)))
-            (setq result (cons (concat item "/") result))))))))))
+  (tramp-fuse-remove-hidden-files
+   (all-completions
+    filename
+    (delete-dups
+     (append
+      (file-name-all-completions
+       filename (tramp-fuse-local-file-name directory))
+      ;; Some storage systems do not return "." and "..".
+      (let (result)
+       (dolist (item '(".." ".") result)
+         (when (string-prefix-p filename item)
+           (catch 'match
+             (dolist (elt completion-regexp-list)
+               (unless (string-match-p elt item) (throw 'match nil)))
+             (setq result (cons (concat item "/") result)))))))))))
 
 (defun tramp-fuse-handle-file-readable-p (filename)
   "Like `file-readable-p' for Tramp files."



reply via email to

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