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

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

[elpa] externals/denote cf35f02d47 2/9: Fix issue in denote--get-final-c


From: ELPA Syncer
Subject: [elpa] externals/denote cf35f02d47 2/9: Fix issue in denote--get-final-components-for-rewrite
Date: Tue, 26 Nov 2024 06:57:51 -0500 (EST)

branch: externals/denote
commit cf35f02d472ecf115e8884d422b5c292465e575d
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>

    Fix issue in denote--get-final-components-for-rewrite
    
    Calling push on sublist does not work on the first iteration of the
    loop.
---
 denote.el | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/denote.el b/denote.el
index 9453ebb3f1..9e2d406735 100644
--- a/denote.el
+++ b/denote.el
@@ -3176,13 +3176,17 @@ This is repeated until all missing components are 
added."
                 (cdr (seq-drop-while (lambda (x) (not (eq x component))) 
components-in-template)))
                (first-next-component-in-file
                 (seq-find (lambda (x) (memq x final-components)) 
next-components-in-template)))
-          ;; Insert before the existing element.
-          (let ((sublist final-components))
-            (while sublist
-              (if (not (eq (car sublist) first-next-component-in-file))
-                  (setq sublist (cdr sublist))
-                (push component sublist)
-                (setq sublist nil)))))))
+          ;; Insert before the existing element.  The intention is to
+          ;; modify final-components, but it does not work when push
+          ;; is called on sublist on the first iteration of the loop.
+          (if (eq (car final-components) first-next-component-in-file)
+              (push component final-components)
+            (let ((sublist final-components))
+              (while sublist
+                (if (not (eq (car sublist) first-next-component-in-file))
+                    (setq sublist (cdr sublist))
+                  (push component sublist)
+                  (setq sublist nil))))))))
     final-components))
 
 (defun denote-rewrite-front-matter (file title keywords signature date 
identifier file-type)



reply via email to

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