[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive dc54ccbfbf 12/30: Tidy: (hyperdrive-dir-column-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive dc54ccbfbf 12/30: Tidy: (hyperdrive-dir-column-headers) Reduce duplication |
Date: |
Wed, 6 Sep 2023 18:59:43 -0400 (EDT) |
branch: elpa/hyperdrive
commit dc54ccbfbfc6c539345db3fbfc40e7ebac886066
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Tidy: (hyperdrive-dir-column-headers) Reduce duplication
---
hyperdrive-dir.el | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index 6159f0068d..36d120dd94 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -120,24 +120,27 @@ arguments."
"Return column headers as a string with PREFIX.
Columns are suffixed with up/down arrows according to
`hyperdrive-sort-entries'."
- (pcase-let* ((`(,column . ,direction) hyperdrive-directory-sort)
+ (pcase-let* ((`(,sort-column . ,direction) hyperdrive-directory-sort)
;; TODO: Use ▲ and ▼ glyphs, but make sure that the
;; column headers are aligned correctly.
(arrow (propertize (if (eq direction :ascending) "^" "v")
'face 'hyperdrive-header-arrow))
- (size-header (propertize "Size" 'face
'hyperdrive-column-header))
- (mtime-header (propertize "Last Modified" 'face
'hyperdrive-column-header))
- (name-header (propertize "Name" 'face
'hyperdrive-column-header)))
- (pcase-exhaustive column
- ('size (cl-callf2 concat arrow size-header))
- ('mtime (cl-callf2 concat arrow mtime-header))
- ;; Put the arrow second so that the header doesn't move.
- ('name (cl-callf concat name-header arrow)))
+ (headers))
+ (pcase-dolist (`(,column . ,(map (:desc desc))) hyperdrive-dir-sort-fields)
+ (push (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))
+ headers))
(concat prefix "\n"
- (format (concat "%6s " hyperdrive-timestamp-format-string " %s")
- size-header
- mtime-header
- name-header))))
+ (apply #'format (concat "%6s " hyperdrive-timestamp-format-string
" %s")
+ (nreverse headers)))))
(defun hyperdrive-dir-complete-sort ()
"Return a value for `hyperdrive-directory-sort' selected with completion."
- [nongnu] elpa/hyperdrive ff71f006dc 02/30: Change: (-directory-sort) Use :ascending and :descending keywords, (continued)
- [nongnu] elpa/hyperdrive ff71f006dc 02/30: Change: (-directory-sort) Use :ascending and :descending keywords, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 736f2e9d03 01/30: Change: (hyperdrive--fill) Check writability based on Allow header, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive dbbe0ecd43 05/30: Add: (hyperdrive-time-greater-p) Inverse of time-less-p, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 6d41b67aab 04/30: Comment: Add TODO, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 838b34927c 03/30: Change: (hyperdrive-sort-entries) Rename BY argument to DIRECTION, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 5f1d617ae1 11/30: Change: (hyperdrive-dir-sort-fields) Add description, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 09e4dba5b2 14/30: Tidy: (hyperdrive-dir-column-headers) let-bind selected/arrow-after, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 57d02e33f4 15/30: Change: (hyperdrive-dir-column-headers) Add mouse-face, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 303109d76e 19/30: Fix: Typo, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 8d47207e21 21/30: Docs: Document clickable directory column headers, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive dc54ccbfbf 12/30: Tidy: (hyperdrive-dir-column-headers) Reduce duplication,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 80d68a0378 16/30: Change: Replace -timestamp-width with -timestamp-format-string, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive dc2488436d 17/30: Change: (hyperdrive-dir-column-headers) Fix column headers highlight, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive a39567f697 24/30: Change: (hyperdrive--fill) Use string-match-p, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 447994e8b2 13/30: Change: (hyperdrive-dir-column-headers) Clickable column headers, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive db30be6a57 28/30: Comment: Update TODO, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive bbd78c6361 23/30: Docs: Update customization option docs, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 53927eb0a9 25/30: Merge branch 'check-writablep', ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive fcda78fd06 30/30: Merge branch 'dir-sort-clickable', ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive 68ee5c5213 22/30: Meta: Update changelog, ELPA Syncer, 2023/09/06
- [nongnu] elpa/hyperdrive decf302b97 27/30: Fix: Require url, ELPA Syncer, 2023/09/06