1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-23 07:18:53 +00:00

Fix bad org-src interaction with org-persist

* lisp/org-macs.el (org-unique-local-variables): Do not copy over
`buffer-file-name'.  This may interact badly with `org-persist' and
`org-element' - `org-persist' assumes that all the buffers with a
given `buffer-file-name' are the same, which may not be true when
copying over variables into a temporary edit buffer (org-src).
* lisp/org-persist.el (org-persist-write:elisp): Add FIXME.

Reported-by: Akash Pal <akashpaul21@gmail.com>
Link: https://list.orgmode.org/orgmode/CA+6WspJ8J+iBzL+CQr5JTZUE5hhhHBrUunLw2naKpxwpv1DNqA@mail.gmail.com/
This commit is contained in:
Ihor Radchenko 2024-10-13 12:17:28 +02:00
parent b6dbf88810
commit 90945e16aa
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 14 additions and 1 deletions

View File

@ -672,7 +672,14 @@ ones and overrule settings in the other lists."
org-element--cache-diagnostics-ring-size
org-element--cache-sync-keys
org-element--cache-sync-requests
org-element--cache-sync-timer)
org-element--cache-sync-timer
;; FIXME: Avoid copying `buffer-file-name' - when closing a
;; temporary buffer, org-persist badly interacts with multiple
;; _different_ buffers with the same `buffer-file-name' and may
;; modify (via `org-element--cache-persist-before-write' by side
;; effect the cache in a _different_ buffer (whatever comes first
;; in `get-file-buffer').
buffer-file-name)
"List of local variables that cannot be transferred to another buffer.")
(defun org-get-local-variables ()

View File

@ -840,6 +840,12 @@ COLLECTION is the plist holding data collection."
(when (boundp (cadr container))
(symbol-value (cadr container))))
(`nil
;; FIXME: Here and in other places, we use `get-file-buffer'
;; assuming that all the buffers with the same
;; `buffer-file-name' are same. However, this may not
;; necessarily be the case in general and we may initiate
;; writing cache in one buffer, but `get-file-buffer' may then
;; return _another_ buffer (with the same `buffer-file-name').
(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.