From 358a7ba0f6f601ea49fb22dc05e36f4a258c7db4 Mon Sep 17 00:00:00 2001 From: Joseph Mingrone Date: Sat, 4 Apr 2026 19:26:56 -0300 Subject: [PATCH] lisp/net/tramp.el: Fix performance regression with completions * lisp/net/tramp.el (tramp-skeleton-file-name-all-completions): Use `file-directory-p' directly instead of calling `file-symlink-p' and file-truename first. Since `file-directory-p' already follows symlinks, symlinked directories are handled correctly without the extra indirection. --- lisp/net/tramp.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 03089dffb55..b38d502e8b1 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3027,16 +3027,14 @@ BODY is the backend specific code." (format "file-name-all-completions-%s" tramp-fnac-add-trailing-slash) - ;; Mark symlinked directories. Other - ;; directories are already marked. + ;; Mark directories, including symlinks to + ;; directories. (mapcar (lambda (x) (let ((f (file-name-concat ,directory x))) (if (and tramp-fnac-add-trailing-slash (not (string-suffix-p "/" x)) - (file-directory-p - (if (file-symlink-p f) - (file-truename f) f))) + (file-directory-p f)) (concat x "/") x))) ;; Some storage systems do not return "." and "..". (seq-union