emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/helm 13c4171217: Show symlink dirs icons


From: ELPA Syncer
Subject: [nongnu] elpa/helm 13c4171217: Show symlink dirs icons
Date: Mon, 28 Feb 2022 00:58:25 -0500 (EST)

branch: elpa/helm
commit 13c4171217ad4d657d2cf1c1f46c2d7778504b32
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Show symlink dirs icons
---
 helm-files.el | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index d4ca178ab7..523b457927 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -89,7 +89,9 @@
 (declare-function dired-async-processes "ext:dired-async.el")
 (declare-function all-the-icons-icon-for-file "ext:all-the-icons.el")
 (declare-function all-the-icons-octicon "ext:all-the-icons.el")
+(declare-function all-the-icons-match-to-alist "ext:all-the-icons.el")
 
+(defvar all-the-icons-dir-icon-alist)
 (defvar term-char-mode-point-at-process-mark)
 (defvar term-char-mode-buffer-read-only)
 (defvar recentf-list)
@@ -4103,14 +4105,24 @@ If SKIP-BORING-CHECK is non nil don't filter boring 
files."
 (defun helm-ff-get-icon (disp file)
   "Get icon from all-the-icons for FILE.
 Arg DISP is the display part of the candidate."
-  (let ((icon (cond ((helm-ff--is-dir-from-disp disp)
-                     ;; We could use `all-the-icons-icon-for-dir' which shows
-                     ;; additional stuff e.g. icon for git dir etc... but it
-                     ;; looks more costly (additional tests like
-                     ;; file-symlink-p, file-exists-p etc...).
-                     (all-the-icons-octicon "file-directory"))
-                    ((helm-ff--is-file-from-disp disp)
-                     (all-the-icons-icon-for-file file)))))
+  (let ((icon (helm-acond (;; Non symlink directories.
+                           (helm-ff--is-dir-from-disp disp)
+                           (all-the-icons-octicon "file-directory"))
+                          (;; All files, symlinks may be symlink directories.
+                           (helm-ff--is-file-from-disp disp)
+                           ;; Detect symlink directories. We must call
+                           ;; `file-directory-p' here but it is
+                           ;; limited to symlinks, so it should not
+                           ;; degrade too much performances.
+                           (if (and (eq it 'helm-ff-symlink)
+                                    (file-directory-p file))
+                               (let* ((icon (all-the-icons-match-to-alist
+                                             (helm-basename file)
+                                             all-the-icons-dir-icon-alist))
+                                      (args (cdr icon)))
+                                 (apply #'all-the-icons-octicon
+                                        "file-symlink-directory" (cdr args)))
+                             (all-the-icons-icon-for-file file))))))
     (when icon (concat icon " "))))
 
 (defun helm-ff--is-dir-from-disp (disp)



reply via email to

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