[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive b403a9c7a3 044/102: Add: (hyperdrive-buffer-nam
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive b403a9c7a3 044/102: Add: (hyperdrive-buffer-name-format) |
Date: |
Wed, 29 Nov 2023 04:00:51 -0500 (EST) |
branch: elpa/hyperdrive
commit b403a9c7a33466d4fcc2b2ccde2ca42d6fa519ab
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Add: (hyperdrive-buffer-name-format)
---
hyperdrive-lib.el | 35 ++++++++++++++++++++++++++--
hyperdrive-vars.el | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+), 2 deletions(-)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 78c7f21a4a..d8a7675d5d 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1369,8 +1369,39 @@ Affected by option `hyperdrive-reuse-buffers', which
see."
(lambda (buffer) (hyperdrive--buffer-visiting-entry-p buffer entry)))
(defun hyperdrive--entry-buffer-name (entry)
- "Return buffer name for ENTRY."
- (hyperdrive-entry-description entry :format-path 'name))
+ "Return buffer name for ENTRY.
+Formatted according to `hyperdrive-buffer-name-format', which
+see."
+ (pcase-let* (((cl-struct hyperdrive-entry hyperdrive name path version)
entry)
+ ((cl-struct hyperdrive domains public-key petname seed
+ (metadata (map ('name nickname))))
+ hyperdrive))
+ (format-spec hyperdrive-buffer-name-format
+ ;; TODO(deprecate-28): Use lambdas in each specifier.
+ `((?n . ,name)
+ (?p . ,path)
+ (?v . ,(if version
+ (format hyperdrive-entry-version-format version)
+ ""))
+ (?D . ,(if domains
+ (format hyperdrive-entry-domains-format
+ (string-join domains ","))
+ ""))
+ (?H . ,(hyperdrive--format-host
+ hyperdrive :with-label t :with-faces nil))
+ (?k . ,(format hyperdrive-entry-public-key-short-format
+ (concat (substring public-key 0 6) "…")))
+ (?K . ,(format hyperdrive-entry-public-key-full-format
+ public-key))
+ (?N . ,(if nickname
+ (format hyperdrive-entry-nickname-format
nickname)
+ ""))
+ (?P . ,(if petname
+ (format hyperdrive-entry-petname-format petname)
+ ""))
+ (?S . ,(if seed
+ (format hyperdrive-entry-seed-format seed)
+ ""))))))
(defun hyperdrive--entry-directory-p (entry)
"Return non-nil if ENTRY is a directory."
diff --git a/hyperdrive-vars.el b/hyperdrive-vars.el
index b5efc769ba..f5a5bb27b7 100644
--- a/hyperdrive-vars.el
+++ b/hyperdrive-vars.el
@@ -165,6 +165,73 @@ an existing buffer at the same version, or make a new
buffer."
:type '(choice (const :tag "Use an existing buffer at any version"
any-version)
(const :tag "Use an existing buffer at the same version"
same-version)))
+;;;;;; Entry formatting
+
+(defgroup hyperdrive-entry-format nil
+ "Formatting of entries for buffer names, etc."
+ :group 'hyperdrive)
+
+(defcustom hyperdrive-buffer-name-format "[%H] %n%v"
+ "Format string for buffer names.
+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')
+
+%D Hyperdrive domains
+%k Hyperdrive public key (short)
+%K Hyperdrive public key (full)
+%N Hyperdrive nickname
+%P Hyperdrive petname
+%S Hyperdrive seed"
+ :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)
+
;;;;; Faces
(defgroup hyperdrive-faces nil
- [nongnu] elpa/hyperdrive 4d9b8c09cc 025/102: Change: (hyperdrive-menu) Replace lambda with hyperdrive-up, (continued)
- [nongnu] elpa/hyperdrive 4d9b8c09cc 025/102: Change: (hyperdrive-menu) Replace lambda with hyperdrive-up, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 7fd3e0f471 033/102: Comment: Add TODO, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive b682fc8058 052/102: Change: (--entry-version-range-key) Don't pass :with-help-echo, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 299e100c03 026/102: Comment: Add TODO, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive b1cc39978b 091/102: Comment: Remove TODO, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 600c921605 081/102: Tidy: Rename "naming" to "format", ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 9c0cf70040 094/102: Fix: (h//format) Don't use lambdas in format-spec yet, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive fe986e53ee 079/102: Chore: Rebuild texi manual, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 89fb114bdd 093/102: Fix: Autoload for markdown-mode links, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive ab2fb6e8ea 009/102: Change: (-menu-hyperdrive) Place mirror commands in separate column, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive b403a9c7a3 044/102: Add: (hyperdrive-buffer-name-format),
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 60d37a34ec 029/102: Change: (-mirror-set-filter) Wording of formatted nil value, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive b2afbfaa60 046/102: Change: Replace -entry-description with --format-entry, etc., ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 214a060f75 001/102: Fix: (-mirror-read-predicate) Require match for predicate type, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 9d8de7ed67 006/102: Change: (-menu-set-nickname) No longer explicitly refresh transient, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 74b0eb400f 032/102: Fix/Docs: Reword as suggested by makeinfo, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 1f3eeca9dc 013/102: Change (-menu-hyperdrive) Add suffix for copying URL, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive e9b6b9f059 011/102: Add/Change: Improve transient support for mirroring, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 307b33362a 045/102: Change: (--format-entry) replaces --entry-buffer-name, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 780bd3d8e0 004/102: Fix/Change: (-menu-hyperdrive) Use new display-only child syntax, ELPA Syncer, 2023/11/29
- [nongnu] elpa/hyperdrive 1f7dfa3580 039/102: Fix: (hyperdrive-mirror-set-target) Validate target path, ELPA Syncer, 2023/11/29