[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/helm f2e6d91c94 2/2: Make helm-ff-valid-symlink-p returns
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/helm f2e6d91c94 2/2: Make helm-ff-valid-symlink-p returns the truename of file |
Date: |
Sat, 5 Mar 2022 05:58:10 -0500 (EST) |
branch: elpa/helm
commit f2e6d91c943d7ba0c69fbfc832a9e88fecd124b9
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>
Make helm-ff-valid-symlink-p returns the truename of file
---
helm-files.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/helm-files.el b/helm-files.el
index 3558f383f9..3c0a4c09a4 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -3695,13 +3695,16 @@ Note that only existing directories are saved here."
(abbreviate-file-name sel)))))))
(add-hook 'helm-exit-minibuffer-hook 'helm-files-save-file-name-history)
-(defun helm-ff-valid-symlink-p (file)
+(defun helm-ff-valid-symlink-p (file &optional link)
+ "Returns the truename of FILE if it exists.
+If we already know the truename of FILE we can pass it with LINK arg
+to avoid an unnecessary call to `file-truename'."
(helm-aif (condition-case-unless-debug nil
;; `file-truename' send error
;; on cyclic symlinks (Bug#692).
- (file-truename file)
+ (or link (file-truename file))
(error nil))
- (file-exists-p it)))
+ (and (file-exists-p it) it)))
(defun helm-get-default-mode-for-file (filename)
"Return the default mode to open FILENAME."
@@ -3746,8 +3749,7 @@ Note that only existing directories are saved here."
(format "True name: '%s'\n"
(cond ((string-match "^\\.#" (helm-basename candidate))
"Autosave symlink")
- ((helm-ff-valid-symlink-p candidate)
- (file-truename candidate))
+ ((helm-ff-valid-symlink-p candidate))
(t "Invalid Symlink"))))
(format "Owner: %s: %s\n" owner owner-right)
(format "Group: %s: %s\n" group group-right)