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

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

[elpa] externals/org 1b2d068: org-persist.el: Do not write global variab


From: ELPA Syncer
Subject: [elpa] externals/org 1b2d068: org-persist.el: Do not write global variables on buffer kill
Date: Thu, 28 Oct 2021 10:57:35 -0400 (EDT)

branch: externals/org
commit 1b2d06880f03c4e2063a9c91741935ea49144d2c
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-persist.el: Do not write global variables on buffer kill
    
    * lisp/org-persist.el (org-persist-write-all): Prevent writing global
    variables when BUFFER arg is provided.
    (org-persist-gc): Handle case when :persist-file is set to nil in the
    index.
    
    Fixes 
https://list.orgmode.org/DB9PR08MB66336CDF0F43DE3DB1D08649A3869@DB9PR08MB6633.eurprd08.prod.outlook.com/T/#m40fcc5ea8ba0ef52518a58713cf9ad3d1fffa33d
---
 lisp/org-persist.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index 47a31e0..fd6fed94 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -209,11 +209,12 @@ When BUFFER is `all', unregister VAR in all buffers."
   "Save all the persistent data."
   (unless (and buffer (not (buffer-file-name buffer)))
     (dolist (index org-persist--index)
-      (when (or (not (plist-get index :path))
-                (and (get-file-buffer (plist-get index :path))
-                     (or (not buffer)
-                         (equal (buffer-file-name buffer)
-                                (plist-get index :path)))))
+      (when (or (and (not (plist-get index :path))
+                     (not buffer))
+                (and (plist-get index :path)
+                     (get-file-buffer (plist-get index :path))
+                     (equal (buffer-file-name buffer)
+                            (plist-get index :path))))
         (org-persist-write (plist-get index :variable)
                 (when (plist-get index :path)
                   (get-file-buffer (plist-get index :path))))))))
@@ -272,9 +273,10 @@ When BUFFER is `all', unregister VAR in all buffers."
   (let (new-index)
     (dolist (index org-persist--index)
       (let ((file (plist-get index :path))
-            (persist-file (org-file-name-concat
-                           org-persist-directory
-                           (plist-get index :persist-file))))
+            (persist-file (when (plist-get index :persist-file)
+                            (org-file-name-concat
+                             org-persist-directory
+                             (plist-get index :persist-file)))))
         (when (and file persist-file)
           (if (file-exists-p file)
               (push index new-index)



reply via email to

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