emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [BUG] Changing TODO states sometimes modifies the scheduling of the


From: Tom
Subject: [O] [BUG] Changing TODO states sometimes modifies the scheduling of the next heading
Date: Sun, 3 Apr 2011 06:46:11 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

I have a heading where the scheduling changed misteriuosly. It is
set to repeat weekly and I found it jumped to the next week
without me touching it at all. I set up a background watcher and
after a week it detected when the unwanted change happens.

I could not yet create a simple org file to reproduce the
problem, but I found the problematic part in the code. It happens
when I change the TODO state of a heading with repeating
scheduling. When org modifies the scheduling of the heading
according to the repeat period it also modifies the scheduling of
the heading under it.

Here's the buggy part of the code:


(defun org-auto-repeat-maybe (done-word)
...
    (while (re-search-forward
              re (save-excursion (outline-next-heading) (point)) t)


http://repo.or.cz/w/org-mode.git/blob/HEAD:/lisp/org.el#l11546


The problem is the bound for the search is determined within the
while loop. The problem occurs when the scheduling of the heading
is changed and cursor is put on the beginning of the next line
after that. If that next line happens to be the next heading line
then the (outline-next-heading) call in the re-search-forward
skips over the next heading, setting the bound of the search to
the end of it, so the search includes the contents of the next
heading too, so its scheduling is also modified behind the user's
back.

The solution is simple: determine the bound of the search (the
end of the heading) before the while loop and use that value in
re-search-forward, instead of computing it within the loop.





reply via email to

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