From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Possible cache problems Date: Sun, 14 Jun 2015 14:58:25 +0200 Message-ID: <87ioaqsaz2.fsf@nicolasgoaziou.fr> References: <20150602170921.GF2027@chitra.no-ip.org> <87d21dsvox.fsf@nicolasgoaziou.fr> <20150602212111.GA3455@chitra.no-ip.org> <874mmpssv8.fsf@nicolasgoaziou.fr> <20150606193853.GG3455@chitra.no-ip.org> <87h9qkv2kf.fsf@nicolasgoaziou.fr> <20150610084049.GB5260@chitra.no-ip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z47T7-00016B-TK for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 08:56:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z47T6-0000wv-To for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 08:56:57 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:58739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z47T6-0000wo-K0 for emacs-orgmode@gnu.org; Sun, 14 Jun 2015 08:56:56 -0400 In-Reply-To: <20150610084049.GB5260@chitra.no-ip.org> (Suvayu Ali's message of "Wed, 10 Jun 2015 10:40:49 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Suvayu Ali Cc: Emacs Org mode Suvayu Ali writes: > I was trying to edit the attr_latex line for the following table: > > #+attr_latex:=20 > | year | 2012 | 2018 | 2022 | 2028 | 2035 | > | =CE=B3(=C2=B0) | 7 | 4 | 1.3 | 0.9 | 0.6 | Fixed in 182ff104b77d1c4cd03a2749472d9da0c7733116. Thank you. This change requires a modification to `element-check-cache' function I sent you earlier, if you plan to use it again: --8<---------------cut here---------------start------------->8--- (defun element-check-cache (&rest ignore) (when (org-element--cache-active-p) (save-match-data (let ((cache (copy-tree org-element--cache t)) (requests (copy-tree org-element--cache-sync-requests t)) (buffer-contents (org-with-wide-buffer (buffer-string))) (translations (make-hash-table :test #'eq)) (structures (make-hash-table :test #'eq)) (keys (make-hash-table :test #'eq))) ;; Fix parents. (loop for key in (avl-tree-flatten org-element--cache) for value in (avl-tree-flatten cache) do (let ((struct (and (memq (org-element-type key) '(plain-list item)) (gethash (org-element-property :structu= re key) structures 'missing)))) (progn (puthash key value translations) (let ((k (gethash key org-element--cache-sync-keys))) (when k (puthash value k keys))) (puthash key (org-element-put-property value :parent (gethash (org-element-property :parent key) translations)) translations) (when (eq struct 'missing) (setq struct (puthash (org-element-property :structure key) (org-element-property :structure valu= e) structures))) (when struct (puthash key (org-element-put-property value :structure struct) translations))))) ;; Fix requests. (loop for original in org-element--cache-sync-requests for copy in requests do (aset copy 4 (gethash (aref original 4) translations))) (with-temp-buffer (let ((org-element-use-cache nil)) (insert buffer-contents)) (let ((org-inhibit-startup t)) (org-mode)) (setq org-element--cache cache org-element--cache-sync-requests requests org-element--cache-sync-keys keys) (org-element--cache-sync (current-buffer) (point-max)) (let ((seen '())) (avl-tree-mapc (lambda (element) (let ((beg (org-element-property :begin element)) (type (org-element-type element))) (let ((real (let (org-element-use-cache) (goto-char (if (memq type '(item table-row)) (1+ beg) beg)) (org-element-at-point)))) (cond ((member real seen) (message "=3D=3D=3D=3D=3D=3D\nWARNING. Two entries for the sam= e element\n\n %s" element)) ((not (equal real element)) (message "=3D=3D=3D=3D=3D=3D\nWARNING. Corrupted element (%s) = at %d\n\nReal:\ %s\n\nCached: %s\n\nLast request: %s" (org-element-type element) beg real element (car requ= ests))) (t (push real seen)))))) org-element--cache)))))))--8<---------------cut here----------= -----end--------------->8--- Regards,