diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 47a31e016..fd6fed945 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)