aboutsummaryrefslogtreecommitdiff
path: root/working/org-element-cache-persist-bug/hostile-c-repro.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-30 17:48:06 -0500
committerCraig Jennings <c@cjennings.net>2026-07-30 17:48:06 -0500
commit00f44f46f65a96bb84271faa7f4ed7965fc44d5e (patch)
treea61cc9cbaabb03400cf64e1787e98fb226e3f3a9 /working/org-element-cache-persist-bug/hostile-c-repro.el
parentce223dc63c4901603e66aab0ebc8934791260c89 (diff)
downloaddotemacs-00f44f46f65a96bb84271faa7f4ed7965fc44d5e.tar.gz
dotemacs-00f44f46f65a96bb84271faa7f4ed7965fc44d5e.zip
docs: keep the org-element cache reproduction evidenceHEADmain
Twelve scripts plus a README covering the persist-write cache corruption: the no-dirvish root cause, the buffer-list ordering dependency, a faithful replay of the file-manager preview path, and the two fixes I tried and reverted. The README says which scripts are weak evidence and why, so the next reader doesn't rebuild an argument on the one whose control varied three things at once. Also holds the upstream bug report and its reproduction, verified to run standalone under emacs -Q.
Diffstat (limited to 'working/org-element-cache-persist-bug/hostile-c-repro.el')
-rw-r--r--working/org-element-cache-persist-bug/hostile-c-repro.el32
1 files changed, 32 insertions, 0 deletions
diff --git a/working/org-element-cache-persist-bug/hostile-c-repro.el b/working/org-element-cache-persist-bug/hostile-c-repro.el
new file mode 100644
index 00000000..17627e63
--- /dev/null
+++ b/working/org-element-cache-persist-bug/hostile-c-repro.el
@@ -0,0 +1,32 @@
+;;; -*- lexical-binding: t -*-
+(setq org-persist-directory (expand-file-name "hostile-c-persist" default-directory))
+(require 'org)
+(require 'org-element)
+(require 'org-persist)
+(let* ((f (expand-file-name "hostile-c-real.org" default-directory)))
+ (with-temp-file f (insert "* Head one\nbody\n* Head two\n"))
+ ;; 1. the REAL buffer, as Craig has open
+ (let ((real (find-file-noselect f)))
+ (with-current-buffer real (org-element-at-point (point-max)))
+ (princ (format "real registered: %S\n"
+ (and (org-persist--find-index
+ `(:container ,(org-persist--normalize-container
+ `((elisp org-element--cache) (version ,org-element-cache-version)))
+ :associated ,(org-persist--normalize-associated real)))
+ t)))
+ ;; 2. dirvish preview: second org buffer claiming the same file name
+ (let ((prev (get-buffer-create "PREVIEW :: hostile-c-real.org")))
+ (with-current-buffer prev
+ (insert-file-contents f)
+ (setq buffer-file-name f)
+ (delay-mode-hooks (org-mode))
+ ;; the commit's hook
+ (setq-local org-element-cache-persistent nil)
+ ;; 3. anything that resets the cache in this live preview buffer
+ (org-element-cache-reset))
+ (princ (format "real registered AFTER preview reset: %S\n"
+ (and (org-persist--find-index
+ `(:container ,(org-persist--normalize-container
+ `((elisp org-element--cache) (version ,org-element-cache-version)))
+ :associated ,(org-persist--normalize-associated real)))
+ t))))))