From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: probable caching bug? Date: Thu, 05 Dec 2013 16:47:51 +0100 Message-ID: <87a9gfuwns.fsf@gmail.com> References: <87pppcys45.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vob9P-0006Xw-D2 for emacs-orgmode@gnu.org; Thu, 05 Dec 2013 10:47:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vob9J-0006Ho-K3 for emacs-orgmode@gnu.org; Thu, 05 Dec 2013 10:47:39 -0500 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:54436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vob9J-0006Hi-AU for emacs-orgmode@gnu.org; Thu, 05 Dec 2013 10:47:33 -0500 Received: by mail-wi0-f173.google.com with SMTP id hn9so5736068wib.6 for ; Thu, 05 Dec 2013 07:47:32 -0800 (PST) In-Reply-To: <87pppcys45.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 05 Dec 2013 09:00:10 +0700") 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: Eric Abrahamsen Cc: emacs-orgmode@gnu.org Hello, Eric Abrahamsen writes: > While editing a plain list yesterday I noticed what I guess was a bug in > the caching mechanism. It looks like it, indeed. > The list item was wrapped to several lines, and I noticed that calling > C-e while on the last line gave me "wrong-type-argument > integer-or-marker-p nil". Trying to fill the item with M-q gave me > "user-error: An element cannot be parsed line 635". [...] Unfortunately, the source of the cache corruption may be totally unrelated to the action triggering the error. Thus, cache bugs are quite hard to reproduce. When hunting down one of them, I usually call the following function after each non-trivial buffer modification. (defun ngz-random-test (&optional n contextp) (save-excursion (dotimes (k (or n 100)) (goto-char (1+ (random (point-max)))) (let ((real-element (let (org-element-use-cache) (if contextp (org-element-context) (org-element-at-point))))) (or (equal real-element (if contextp (org-element-context) (org-element-at-point))) (message "`%s' at %d is corrupted." (org-element-type real-element) (org-element-property :begin real-element))))))) BTW, is your Org recent? I fixed a similar problem (i.e. cache corruption in lists) about two weeks ago in commit 4466af5c115b56377d7251e848860dc03212c583. Regards, -- Nicolas Goaziou