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

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

[nongnu] elpa/helm 6c07b3fc35 1/2: Avoid calling twice file-attributes i


From: ELPA Syncer
Subject: [nongnu] elpa/helm 6c07b3fc35 1/2: Avoid calling twice file-attributes in helm-ff-properties
Date: Fri, 14 Oct 2022 12:58:57 -0400 (EDT)

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

    Avoid calling twice file-attributes in helm-ff-properties
    
    Add new function helm-file-attributes-dired-line and use it.
---
 helm-files.el |  3 +--
 helm-utils.el | 23 +++++++++++++----------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/helm-files.el b/helm-files.el
index 5d9ffe9ddd..7569f6cf6a 100644
--- a/helm-files.el
+++ b/helm-files.el
@@ -3738,8 +3738,7 @@ to avoid an unnecessary call to `file-truename'."
   "Show file properties of CANDIDATE in a tooltip or message."
   (require 'helm-external) ; For `helm-get-default-program-for-file'.
   (helm-aif (helm-file-attributes candidate)
-      (let* ((dired-line         (helm-file-attributes
-                                  candidate :dired t :human-size t))
+      (let* ((dired-line         (helm-file-attributes-dired-line it t))
              (type               (cl-getf it :type))
              (mode-type          (cl-getf it :mode-type))
              (owner              (cl-getf it :uid))
diff --git a/helm-utils.el b/helm-utils.el
index 7e16aeb932..eca1574945 100644
--- a/helm-utils.el
+++ b/helm-utils.el
@@ -755,16 +755,7 @@ you have in `file-attributes'."
               (gid-change  (cl-getf all :gid-change))
               (inode       (cl-getf all :inode))
               (device-num  (cl-getf all :device-num))
-              (dired       (concat
-                            (helm-split-mode-file-attributes
-                             (cl-getf all :mode) t) " "
-                            (number-to-string (cl-getf all :links)) " "
-                            (cl-getf all :uid) ":"
-                            (cl-getf all :gid) " "
-                            (if human-size
-                                (helm-file-human-size (cl-getf all :size))
-                              (int-to-string (cl-getf all :size))) " "
-                            (cl-getf all :modif-time)))
+              (dired       (helm-file-attributes-dired-line all human-size))
               (human-size (helm-file-human-size (cl-getf all :size)))
               (mode-type  (cl-getf modes :mode-type))
               (mode-owner (cl-getf modes :user))
@@ -773,6 +764,18 @@ you have in `file-attributes'."
               (octal      (cl-getf modes :octal))
               (t          (append all modes))))))
 
+(defun helm-file-attributes-dired-line (all &optional human-size)
+  (format "%s %s %s:%s %s %s"
+   (helm-split-mode-file-attributes
+    (cl-getf all :mode) t)
+   (number-to-string (cl-getf all :links))
+   (cl-getf all :uid)
+   (cl-getf all :gid)
+   (if human-size
+       (helm-file-human-size (cl-getf all :size))
+     (int-to-string (cl-getf all :size)))
+   (cl-getf all :modif-time)))
+
 (defun helm-split-mode-file-attributes (str &optional string)
   "Split mode file attributes STR into a proplist.
 If STRING is non--nil return instead a space separated string."



reply via email to

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