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

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

[nongnu] elpa/hyperdrive 09e4dba5b2 14/30: Tidy: (hyperdrive-dir-column-


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive 09e4dba5b2 14/30: Tidy: (hyperdrive-dir-column-headers) let-bind selected/arrow-after
Date: Wed, 6 Sep 2023 18:59:43 -0400 (EDT)

branch: elpa/hyperdrive
commit 09e4dba5b2cea492c0f3f995e2303d3fcd9685be
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Tidy: (hyperdrive-dir-column-headers) let-bind selected/arrow-after
---
 hyperdrive-dir.el | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index 2cf84ed072..123ebb7dd0 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -127,24 +127,20 @@ Columns are suffixed with up/down arrows according to
                                   'face 'hyperdrive-header-arrow))
                (headers))
     (pcase-dolist (`(,column . ,(map (:desc desc))) hyperdrive-dir-sort-fields)
-      (push (propertize
-             (concat (and (eq column sort-column)
-                          ;; For right-aligned columns, put the arrow before 
desc.
-                          (or (eq column 'size)
-                              (eq column 'mtime))
-                          arrow)
-                     (propertize desc 'face 'hyperdrive-column-header)
-                     (and (eq column sort-column)
-                          ;; For left-aligned columns, put the arrow after 
desc.
-                          (eq column 'name)
-                          arrow))
-             'keymap
-             (define-keymap
-               "<mouse-1>" (lambda (&optional _e)
-                             (interactive "e")
-                             (hyperdrive-dir-sort
-                              (hyperdrive-dir-toggle-sort-direction column 
hyperdrive-directory-sort)))))
-            headers))
+      (let ((selected (eq column sort-column))
+            ;; Put the arrow after desc, since the column is left-aligned.
+            (arrow-after (eq column 'name)))
+        (push (propertize
+               (concat (and selected (not arrow-after) arrow)
+                       (propertize desc 'face 'hyperdrive-column-header)
+                       (and selected arrow-after arrow))
+               'keymap
+               (define-keymap
+                 "<mouse-1>" (lambda (&optional _e)
+                               (interactive "e")
+                               (hyperdrive-dir-sort
+                                (hyperdrive-dir-toggle-sort-direction column 
hyperdrive-directory-sort)))))
+              headers)))
     (concat prefix "\n"
             (apply #'format (concat "%6s  " hyperdrive-timestamp-format-string 
"  %s")
                    (nreverse headers)))))



reply via email to

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