emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 514e3a9cd2 08/13: org-export: Suppress cache persis


From: ELPA Syncer
Subject: [elpa] externals/org 514e3a9cd2 08/13: org-export: Suppress cache persistence in buffer copies during export
Date: Fri, 7 Oct 2022 01:57:51 -0400 (EDT)

branch: externals/org
commit 514e3a9cd26e150f6ee7251433e14701b62f7e98
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-export: Suppress cache persistence in buffer copies during export
    
    * lisp/org-element.el (org-element-cache-reset): Add new optional
    argument that suppresses all persistence-related calculations.
    * lisp/org-table.el (org-element-cache-reset):
    * lisp/org.el (org-element-cache-reset): Update function signature.
    * lisp/ox.el (org-export--generate-copy-script): Do not try to use
    cache persistence in throwaway buffer copies.
    
    Reported-by: Rudolf Adamkovič <salutis@me.com>
    Link: https://list.orgmode.org/m2zgef774u.fsf@me.com/T/#t
---
 lisp/org-element.el | 8 +++++---
 lisp/org-table.el   | 2 +-
 lisp/org.el         | 2 +-
 lisp/ox.el          | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 7ce2eb2ceb..7b26e877e3 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -7238,16 +7238,18 @@ Each element indicates the latest 
`org-element--cache-change-tic' when
 change did not contain gaps.")
 
 ;;;###autoload
-(defun org-element-cache-reset (&optional all)
+(defun org-element-cache-reset (&optional all no-persistance)
   "Reset cache in current buffer.
 When optional argument ALL is non-nil, reset cache in all Org
-buffers."
+buffers.
+When optional argument NO-PERSISTANCE is non-nil, do not try to update
+the cache persistence in the buffer."
   (interactive "P")
   (dolist (buffer (if all (buffer-list) (list (current-buffer))))
     (with-current-buffer (or (buffer-base-buffer buffer) buffer)
       (when (and org-element-use-cache (derived-mode-p 'org-mode))
         ;; Only persist cache in file buffers.
-        (when (buffer-file-name)
+        (when (and (buffer-file-name) (not no-persistance))
           (when (not org-element-cache-persistent)
             (org-persist-unregister 'org-element--headline-cache 
(current-buffer))
             (org-persist-unregister 'org-element--cache (current-buffer)))
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 5362b5f8f4..a65abf850e 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -59,7 +59,7 @@
 (declare-function org-element-parse-buffer "org-element" (&optional 
granularity visible-only))
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
-(declare-function org-element-cache-reset "org-element" (&optional all))
+(declare-function org-element-cache-reset "org-element" (&optional all 
no-persistence))
 (declare-function org-entry-get "org" (pom property &optional inherit 
literal-nil))
 (declare-function org-export-create-backend "ox" (&rest rest) t)
 (declare-function org-export-data-with-backend "ox" (data backend info))
diff --git a/lisp/org.el b/lisp/org.el
index 075b6397f4..640493d224 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -168,7 +168,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
 (declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
 (declare-function org-element-at-point-no-context "org-element" (&optional 
pom))
 (declare-function org-element-cache-refresh "org-element" (pos))
-(declare-function org-element-cache-reset "org-element" (&optional all))
+(declare-function org-element-cache-reset "org-element" (&optional all 
no-persistence))
 (declare-function org-element-cache-map "org-element" (func &rest keys))
 (declare-function org-element-contents "org-element" (element))
 (declare-function org-element-context "org-element" (&optional element))
diff --git a/lisp/ox.el b/lisp/ox.el
index 65c0b39167..5142700c13 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -2671,7 +2671,7 @@ The function assumes BUFFER's major mode is `org-mode'."
           (when str (erase-buffer) (insert str))
           ;; Make org-element-cache not complain about changed buffer
           ;; state.
-          (org-element-cache-reset)
+          (org-element-cache-reset nil 'no-persistence)
          ;; Narrowing.
           (when narrowing
            (apply #'narrow-to-region narrowing))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]