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

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

[nongnu] elpa/hyperdrive d1b68b1a66 048/102: Add: (hyperdrive-entry-form


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive d1b68b1a66 048/102: Add: (hyperdrive-entry-format-alist) Consolidate entry formats
Date: Wed, 29 Nov 2023 04:00:52 -0500 (EST)

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

    Add: (hyperdrive-entry-format-alist) Consolidate entry formats
---
 hyperdrive-lib.el  | 15 ++++++------
 hyperdrive-vars.el | 72 ++++++++++++++++++++----------------------------------
 2 files changed, 35 insertions(+), 52 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 237d7eb19d..27fcde5459 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1364,33 +1364,34 @@ FORMAT may be a format string like the value of
                   `((?n . ,name)
                     (?p . ,path)
                     (?v . ,(if version
-                               (format hyperdrive-entry-version-format version)
+                               (format (alist-get 'version 
hyperdrive-format-alist)
+                                       version)
                              ""))
                     (?D . ,(if domains
-                               (format hyperdrive-entry-domains-format
+                               (format (alist-get 'domains 
hyperdrive-format-alist)
                                        (propertize (string-join domains ",")
                                                    'face 'hyperdrive-domain))
                              ""))
                     (?H . ,(hyperdrive--format-host hyperdrive :with-label t))
-                    (?k . ,(format hyperdrive-entry-public-key-short-format
+                    (?k . ,(format (alist-get 'short-key 
hyperdrive-format-alist)
                                    (concat (propertize (substring public-key 0 
6)
                                                        'face 
'hyperdrive-public-key)
                                            "…")))
-                    (?K . ,(format hyperdrive-entry-public-key-full-format
+                    (?K . ,(format (alist-get 'public-key 
hyperdrive-format-alist)
                                    (propertize public-key
                                                'face 'hyperdrive-public-key)))
                     (?N . ,(if nickname
-                               (format hyperdrive-entry-nickname-format
+                               (format (alist-get 'nickname 
hyperdrive-format-alist)
                                        (propertize nickname
                                                    'face 'hyperdrive-nickname))
                              ""))
                     (?P . ,(if petname
-                               (format hyperdrive-entry-petname-format
+                               (format (alist-get 'petname 
hyperdrive-format-alist)
                                        (propertize petname
                                                    'face 'hyperdrive-petname))
                              ""))
                     (?S . ,(if seed
-                               (format hyperdrive-entry-seed-format
+                               (format (alist-get 'seed 
hyperdrive-format-alist)
                                        (propertize seed
                                                    'face 'hyperdrive-seed))
                              ""))))
diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el
index b90a36b6b5..abf1b493c1 100644
--- a/hyperdrive-vars.el
+++ b/hyperdrive-vars.el
@@ -177,11 +177,12 @@ Specifiers:
 
 %n  Entry name
 %p  Entry path
-%v  Entry version (see `hyperdrive-entry-version-format')
+%H  Hyperdrive default host format (see `hyperdrive-default-host-format')
 
-%H Hyperdrive default host format (see
-   `hyperdrive-default-host-format')
+The format of the following specifiers can be configured using
+`hyperdrive-format-alist':
 
+%v  Entry version
 %D  Hyperdrive domains
 %k  Hyperdrive public key (short)
 %K  Hyperdrive public key (full)
@@ -193,7 +194,7 @@ Specifiers:
 (defvar hyperdrive-default-entry-format-without-version "[%H] %p"
   "Format string for displaying entries without displaying the version.
 The format of the following specifiers can be configured using
-`hyperdrive-entry-format-alist', which see.")
+`hyperdrive-format-alist', which see.")
 
 (defcustom hyperdrive-buffer-name-format "[%H] %n%v"
   "Format string for buffer names.
@@ -201,47 +202,28 @@ Specifiers are as in `hyperdrive-default-entry-format', 
which
 see."
   :type 'string)
 
-(defcustom hyperdrive-entry-version-format " (version:%s)"
-  "Format string for entry version.
-\"%s\" is replaced with the entry version.  Used in
-`hyperdrive-buffer-name-format', which see."
-  :type 'string)
-
-(defcustom hyperdrive-entry-domains-format "domains:%s"
-  "Format string for entry domains.
-\"%s\" is replaced with the entry domains.  Used in
-`hyperdrive-buffer-name-format', which see."
-  :type 'string)
-
-(defcustom hyperdrive-entry-nickname-format "nickname:%s"
-  "Format string for entry nickname.
-\"%s\" is replaced with the entry nickname  Used in
-`hyperdrive-buffer-name-format', which see."
-  :type 'string)
-
-(defcustom hyperdrive-entry-petname-format "petname:%s"
-  "Format string for entry petname.
-\"%s\" is replaced with the entry petname  Used in
-`hyperdrive-buffer-name-format', which see."
-  :type 'string)
-
-(defcustom hyperdrive-entry-public-key-full-format "public-key:%s"
-  "Format string for entry full public-key.
-\"%s\" is replaced with the entry's full public-key.  Used in
-`hyperdrive-buffer-name-format', which see."
-  :type 'string)
-
-(defcustom hyperdrive-entry-public-key-short-format "public-key:%s"
-  "Format string for entry public-key (short format).
-\"%s\" is replaced with the entry's short public-key.  Used in
-`hyperdrive-buffer-name-format', which see."
-  :type 'string)
-
-(defcustom hyperdrive-entry-seed-format "seed:%s"
-  "Format string for entry seed.
-\"%s\" is replaced with the entry seed  Used in
-`hyperdrive-buffer-name-format', which see."
-  :type 'string)
+(defcustom hyperdrive-format-alist '((version    . " (version:%s)")
+                                     (domains    . "domains:%s")
+                                     (nickname   . "nickname:%s")
+                                     (petname    . "petname:%s")
+                                     (public-key . "public-key:%s")
+                                     (short-key  . "public-key:%s")
+                                     (seed       . "seed:%s"))
+  "Alist mapping hyperdrive and hyperdrive entry metadata item to format 
string.
+Each metadata item may be one of:
+
+- petname
+- nickname
+- version
+- domains
+- public-key
+- short-key
+- seed
+
+In each corresponding format string, \"%s\" is replaced with the
+metadatum. Used in `hyperdrive-buffer-name-format', which see."
+  :type '(alist :key-type symbol :value-type string)
+  :options '(petname nickname version domains public-key short-key seed))
 
 ;;;;; Faces
 



reply via email to

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