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

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

[nongnu] elpa/hyperdrive 307b33362a 045/102: Change: (--format-entry) re


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive 307b33362a 045/102: Change: (--format-entry) replaces --entry-buffer-name
Date: Wed, 29 Nov 2023 04:00:51 -0500 (EST)

branch: elpa/hyperdrive
commit 307b33362a439003b3bacd18fecd7a75c8d136c9
Author: Adam Porter <adam@alphapapa.net>
Commit: Joseph Turner <joseph@ushin.org>

    Change: (--format-entry) replaces --entry-buffer-name
---
 hyperdrive-lib.el | 17 ++++++++++-------
 hyperdrive.el     |  4 +++-
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index d8a7675d5d..e0f7486246 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -549,7 +549,9 @@ echo area when the request for the file is made."
                           (not (hyperdrive-entry-version entry)))
                      ;; Entry is a writable file: create a new buffer
                      ;; that will be saved to its path.
-                     (if-let ((buffer (get-buffer 
(hyperdrive--entry-buffer-name entry))))
+                     (if-let ((buffer
+                               (get-buffer
+                                (hyperdrive--format-entry entry 
hyperdrive-buffer-name-format))))
                          ;; Buffer already exists: likely the user deleted the 
entry
                          ;; without killing the buffer.  Switch to the buffer 
and
                          ;; alert the user that the entry no longer exists.
@@ -1336,7 +1338,8 @@ In other words, this avoids the situation where a buffer 
called
 both point to the same content.
 
 Affected by option `hyperdrive-reuse-buffers', which see."
-  (let* ((buffer-name (hyperdrive--entry-buffer-name entry))
+  (let* ((buffer-name (hyperdrive--format-entry
+                       entry hyperdrive-buffer-name-format))
          (buffer
           (or (when (eq 'any-version hyperdrive-reuse-buffers)
                 (cl-loop for buffer in (buffer-list)
@@ -1368,15 +1371,15 @@ Affected by option `hyperdrive-reuse-buffers', which 
see."
   ;; TODO: This function is a workaround for bug#65797
   (lambda (buffer) (hyperdrive--buffer-visiting-entry-p buffer entry)))
 
-(defun hyperdrive--entry-buffer-name (entry)
-  "Return buffer name for ENTRY.
-Formatted according to `hyperdrive-buffer-name-format', which
-see."
+(defun hyperdrive--format-entry (entry format)
+  "Return ENTRY formatted according to FORMAT.
+FORMAT may be a format string like the value of
+`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
+    (format-spec format
                  ;; TODO(deprecate-28): Use lambdas in each specifier.
                  `((?n . ,name)
                    (?p . ,path)
diff --git a/hyperdrive.el b/hyperdrive.el
index 75425d0db7..02b3eb6ddb 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -494,7 +494,9 @@ use, see `hyperdrive-write'."
                   (setf (hyperdrive-entry-type entry) "text/plain; 
charset=utf-8")
                   (setq-local hyperdrive-current-entry entry)
                   (setf buffer-file-name nil)
-                  (rename-buffer (hyperdrive--entry-buffer-name entry) 'unique)
+                  (rename-buffer
+                   (hyperdrive--format-entry entry 
hyperdrive-buffer-name-format)
+                   'unique)
                   (set-buffer-modified-p nil)
                   ;; Update the visited file modtime so undo commands
                   ;; correctly set the buffer-modified flag.  We just



reply via email to

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