emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: probable caching bug?
Date: Thu, 05 Dec 2013 16:47:51 +0100	[thread overview]
Message-ID: <87a9gfuwns.fsf@gmail.com> (raw)
In-Reply-To: <87pppcys45.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Thu, 05 Dec 2013 09:00:10 +0700")

Hello,

Eric Abrahamsen <eric@ericabrahamsen.net> 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

  reply	other threads:[~2013-12-05 15:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-05  2:00 probable caching bug? Eric Abrahamsen
2013-12-05 15:47 ` Nicolas Goaziou [this message]
2013-12-06  1:59   ` Eric Abrahamsen
2013-12-06 15:30     ` Nicolas Goaziou
2013-12-07  1:58       ` Eric Abrahamsen
2013-12-07  9:19         ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a9gfuwns.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).