[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org ffec2db731 3/9: org-persist-write:elisp: Allow buff
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org ffec2db731 3/9: org-persist-write:elisp: Allow buffer-local/global elisp container scope |
Date: |
Thu, 29 Dec 2022 04:58:01 -0500 (EST) |
branch: externals/org
commit ffec2db731ff71a9a2b84ad3eaa06b62c66d70e3
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-persist-write:elisp: Allow buffer-local/global elisp container scope
* lisp/org-persist.el (org-persist-read:index): Allow setting where
the elisp container value is taken from: locally, from buffer, or from
a global variable.
---
lisp/org-persist.el | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index 961a2b1ca2..60088af9ee 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -632,16 +632,29 @@ COLLECTION is the plist holding data collection."
(defun org-persist-write:elisp (container collection)
"Write elisp CONTAINER according to COLLECTION."
- (if (and (plist-get (plist-get collection :associated) :file)
- (get-file-buffer (plist-get (plist-get collection :associated)
:file)))
- (let ((buf (get-file-buffer (plist-get (plist-get collection
:associated) :file))))
- ;; FIXME: There is `buffer-local-boundp' introduced in Emacs 28.
- ;; Not using it yet to keep backward compatibility.
- (condition-case nil
- (buffer-local-value (cadr container) buf)
- (void-variable nil)))
- (when (boundp (cadr container))
- (symbol-value (cadr container)))))
+ (let ((scope (nth 2 container)))
+ (pcase scope
+ ((pred stringp)
+ (when-let ((buf (or (get-buffer scope)
+ (get-file-buffer scope))))
+ ;; FIXME: There is `buffer-local-boundp' introduced in Emacs 28.
+ ;; Not using it yet to keep backward compatibility.
+ (condition-case nil
+ (buffer-local-value (cadr container) buf)
+ (void-variable nil))))
+ (`local
+ (when (boundp (cadr container))
+ (symbol-value (cadr container))))
+ (`nil
+ (if-let ((buf (and (plist-get (plist-get collection :associated) :file)
+ (get-file-buffer (plist-get (plist-get collection
:associated) :file)))))
+ ;; FIXME: There is `buffer-local-boundp' introduced in Emacs 28.
+ ;; Not using it yet to keep backward compatibility.
+ (condition-case nil
+ (buffer-local-value (cadr container) buf)
+ (void-variable nil))
+ (when (boundp (cadr container))
+ (symbol-value (cadr container))))))))
(defalias 'org-persist-write:version #'ignore)
- [elpa] externals/org updated (5549357bf2 -> a9c0d4cde2), ELPA Syncer, 2022/12/29
- [elpa] externals/org e8cb52bd3e 1/9: org-persist-read: Attempt to write newly register data before reading, ELPA Syncer, 2022/12/29
- [elpa] externals/org f8428d0f3e 2/9: org-fold-core--isearch-show: Small refactoring, ELPA Syncer, 2022/12/29
- [elpa] externals/org 14bfe2841c 5/9: org-persist: Use `list-data-mode' for stored data, ELPA Syncer, 2022/12/29
- [elpa] externals/org 13e78df46a 6/9: * lisp/org-persist.el: Update commentary, ELPA Syncer, 2022/12/29
- [elpa] externals/org a97b378ee5 4/9: org-persist-read: Do not return related containers by default, ELPA Syncer, 2022/12/29
- [elpa] externals/org ffec2db731 3/9: org-persist-write:elisp: Allow buffer-local/global elisp container scope,
ELPA Syncer <=
- [elpa] externals/org b86989c8df 8/9: Merge branch 'bugfix', ELPA Syncer, 2022/12/29
- [elpa] externals/org a9c0d4cde2 9/9: org-occur-in-agenda-files: Respect agenda restriction, ELPA Syncer, 2022/12/29
- [elpa] externals/org dedf1cc21f 7/9: org-persist: Add more normalizations and new `elisp-data' container, ELPA Syncer, 2022/12/29