From 2ae5cf85e6f7c020fcba965dd99d1fd00dcf8e21 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 24 Feb 2014 00:05:53 +0100 Subject: [PATCH] org-element: Add checks relative to cache * lisp/org-element.el (org-element--cache-put, org-element-context): Check if cache is active before trying to access it. --- lisp/org-element.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 7afce6710..34cf85ef0 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -5010,9 +5010,8 @@ the cache." (defun org-element--cache-put (element &optional data) "Store ELEMENT in current buffer's cache, if allowed. When optional argument DATA is non-nil, assume is it object data -relative to ELEMENT and store it in the objects cache. This -function does nothing if `org-element-use-cache' is nil." - (when org-element-use-cache +relative to ELEMENT and store it in the objects cache." + (when (org-element--cache-active-p) (if data (puthash element data org-element--cache-objects) (when org-element--cache-sync-requests ;; During synchronization, first build an appropriate key for @@ -5773,7 +5772,8 @@ Providing it allows for quicker computation." (let* ((restriction (org-element-restriction type)) (parent element) (candidates 'initial) - (cache (gethash element org-element--cache-objects)) + (cache (and (org-element--cache-active-p) + (gethash element org-element--cache-objects))) objects-data next) (prog1 (catch 'exit -- 2.11.4.GIT