From: Tom <adatgyujto@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [BUG] Changing TODO states sometimes modifies the scheduling of the next heading
Date: Sun, 3 Apr 2011 06:46:11 +0000 (UTC) [thread overview]
Message-ID: <loom.20110403T080954-467@post.gmane.org> (raw)
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.
next reply other threads:[~2011-04-03 6:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-03 6:46 Tom [this message]
2011-04-03 8:35 ` [BUG] Changing TODO states sometimes modifies the scheduling of the next heading Tom
2011-04-03 13:37 ` Matt Lundin
2011-04-03 14:09 ` [BUG] Changing TODO states sometimes modifies the schedulingof " Tom
2011-04-03 16:42 ` Matt Lundin
2011-04-03 17:49 ` Tom
2011-04-04 20:25 ` Tom
2011-07-20 8:28 ` Nicolas Goaziou
2011-07-21 19:25 ` Tom
2011-07-22 7:31 ` Bastien
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=loom.20110403T080954-467@post.gmane.org \
--to=adatgyujto@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).