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

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

[elpa] externals/denote 7d1bcfb81d: Fix: Trim denote-rename-buffer to av


From: ELPA Syncer
Subject: [elpa] externals/denote 7d1bcfb81d: Fix: Trim denote-rename-buffer to avoid "uninteresting buffers"
Date: Thu, 2 Nov 2023 03:57:54 -0400 (EDT)

branch: externals/denote
commit 7d1bcfb81d4317e5ddfffc63bd364c94d12a6620
Author: Vedang Manerikar <ved.manerikar@gmail.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Fix: Trim denote-rename-buffer to avoid "uninteresting buffers"
    
    I hit this bug when I did the following:
    
    1. Modify the default `denote-rename-buffer-format` from "%t" to
       "%s %t" to display signatures
    2. Open a Denote file which did not have a signature.
    3. Wonder why the buffer did not show up in buffer-listing functions,
       and why undo wouldn't work on it and so on.
    
    The answer is here:
    
https://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer-Names.html#Buffer-Names
    
        > Buffers that are ephemeral and generally uninteresting to the
        > user have names starting with a space, so that the list-buffers
        > and buffer-menu commands don't mention them (but if such a
        > buffer visits a file, it is mentioned). A name starting with
        > space also initially disables recording undo information; see
        > Undo.
    
    This commit trims the Buffer Name to ensure that there are no leading
    or trailing spaces.
---
 denote-rename-buffer.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/denote-rename-buffer.el b/denote-rename-buffer.el
index 3a5a0d2d77..03637ece77 100644
--- a/denote-rename-buffer.el
+++ b/denote-rename-buffer.el
@@ -92,14 +92,15 @@ buffer will be used, if available."
   "Parse the BUFFER through the `denote-rename-buffer-format'."
   (when-let ((file (buffer-file-name buffer))
              (type (denote-filetype-heuristics file)))
-    (format-spec denote-rename-buffer-format
-                 (list (cons ?t (denote-retrieve-title-value file type))
-                       (cons ?i (denote-retrieve-filename-identifier file))
-                       (cons ?d (denote-retrieve-filename-identifier file))
-                       (cons ?s (denote-retrieve-filename-signature file))
-                       (cons ?k (denote-retrieve-keywords-value-as-string file 
type))
-                       (cons ?% "%"))
-                 'delete)))
+    (string-trim
+     (format-spec denote-rename-buffer-format
+                  (list (cons ?t (denote-retrieve-title-value file type))
+                        (cons ?i (denote-retrieve-filename-identifier file))
+                        (cons ?d (denote-retrieve-filename-identifier file))
+                        (cons ?s (denote-retrieve-filename-signature file))
+                        (cons ?k (denote-retrieve-keywords-value-as-string 
file type))
+                        (cons ?% "%"))
+                  'delete))))
 
 (defun denote-rename-buffer (&optional buffer)
   "Rename current buffer or optional BUFFER with `denote-rename-buffer-format'.



reply via email to

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