[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 0526acd16f 22/31: org-persist-register: New optiona
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 0526acd16f 22/31: org-persist-register: New optional keyword to force immidiate write |
Date: |
Sat, 29 Jan 2022 04:58:12 -0500 (EST) |
branch: externals/org
commit 0526acd16f7fc529b902ea04daffc1f2256aa4ee
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>
org-persist-register: New optional keyword to force immidiate write
* lisp/org-persist.el: Update commentary.
(org-persist-register): Add new keyword `write-immediately' to write
the newrly registerd container to disk immediately.
---
lisp/org-persist.el | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index bff1a094ee..d4b74b52af 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -42,11 +42,9 @@
;; 3. Temporarily cache a file, including TRAMP path to disk:
;; (org-persist-write '("file") "/path/to/file")
;; 4. Cache file or URL while some other file exists.
-;; (org-persist-register '("url"
"https://static.fsf.org/common/img/logo-new.png") '(:file "/path to the other
file") :expiry 'never)
-;; (org-persist-write '("url"
"https://static.fsf.org/common/img/logo-new.png") '(:file "/path to the other
file"))
+;; (org-persist-register '("url"
"https://static.fsf.org/common/img/logo-new.png") '(:file "/path to the other
file") :expiry 'never :write-immediately t)
;; or, if the other file is current buffer file
-;; (org-persist-register '("url"
"https://static.fsf.org/common/img/logo-new.png") (current-buffer) :expiry
'never)
-;; (org-persist-write '("url"
"https://static.fsf.org/common/img/logo-new.png") (current-buffer))
+;; (org-persist-register '("url"
"https://static.fsf.org/common/img/logo-new.png") (current-buffer) :expiry
'never :write-immediately t)
;; 5. Cache value of a Elisp variable to disk. The value will be
;; saved and restored automatically (except buffer-local
;; variables).
@@ -674,7 +672,11 @@ COLLECTION is the plist holding data collectin."
;;;; Public API
-(cl-defun org-persist-register (container &optional associated &rest misc &key
inherit &key (expiry org-persist-default-expiry) &allow-other-keys)
+(cl-defun org-persist-register (container &optional associated &rest misc
+ &key inherit
+ &key (expiry org-persist-default-expiry)
+ &key (write-immediately nil)
+ &allow-other-keys)
"Register CONTAINER in ASSOCIATED to be persistent across Emacs sessions.
Optional key INHERIT makes CONTAINER dependent on another container.
Such dependency means that data shared between variables will be
@@ -683,6 +685,8 @@ Optional key EXPIRY will set the expiry condition of the
container.
It can be `never', nil - until end of session, a number of days since
last access, or a function accepting a single argument - collection.
EXPIRY key has no effect when INHERIT is non-nil.
+Optional key WRITE-IMMEDIATELY controls whether to save the container
+data immediately.
MISC will be appended to CONTAINER."
(unless org-persist--index (org-persist--load-index))
(setq container (org-persist--normalize-container container))
@@ -699,6 +703,7 @@ MISC will be appended to CONTAINER."
(let ((collection (org-persist--get-collection container associated misc)))
(when (and expiry (not inherit))
(when expiry (plist-put collection :expiry expiry))))
+ (when write-immediately (org-persist-write container associated))
(when (or (bufferp associated) (bufferp (plist-get associated :buffer)))
(with-current-buffer (if (bufferp associated)
associated
- [elpa] externals/org f0e0716f54 28/31: org-element: Use new cache container format, (continued)
- [elpa] externals/org f0e0716f54 28/31: org-element: Use new cache container format, ELPA Syncer, 2022/01/29
- [elpa] externals/org 19a383d9f4 29/31: org-persist-write-all: Speed up writing, ELPA Syncer, 2022/01/29
- [elpa] externals/org ac5742f296 31/31: Merge branch 'feature/org-persist-new-tidy', ELPA Syncer, 2022/01/29
- [elpa] externals/org 38a681fdae 05/31: org-element-cache-reset: Do not persist caches for non-file buffers, ELPA Syncer, 2022/01/29
- [elpa] externals/org 8821ff5811 09/31: org-persist-read: Do not try to read non-existing containers, ELPA Syncer, 2022/01/29
- [elpa] externals/org 4ec57a9453 16/31: org-persist: Update commentary, ELPA Syncer, 2022/01/29
- [elpa] externals/org ec787fb218 19/31: org-persist: Implement "file" and "url" containers linked to other file, ELPA Syncer, 2022/01/29
- [elpa] externals/org 6a5874bb26 25/31: org-persist-write: Overwrite existing copy if write is requested, ELPA Syncer, 2022/01/29
- [elpa] externals/org 0e18c617cf 24/31: org-persist-write:index: Return index path on write, ELPA Syncer, 2022/01/29
- [elpa] externals/org eca678195b 23/31: org-persist-write: Return the written value on success, ELPA Syncer, 2022/01/29
- [elpa] externals/org 0526acd16f 22/31: org-persist-register: New optional keyword to force immidiate write,
ELPA Syncer <=
- [elpa] externals/org caccec2c54 26/31: org-persist: Use symbols as container names, ELPA Syncer, 2022/01/29
- [elpa] externals/org 7014675226 30/31: org-mode: Fix cache loading order, ELPA Syncer, 2022/01/29
- [elpa] externals/org 1c79af13df 04/31: org-persist-gc: Fix when expiry is days and data is freshly created, ELPA Syncer, 2022/01/29