Matt Lundin <m...@imapmail.org> writes:

> When the agenda buffer is filtered by tag, I find that rescheduling an
> item (via org-agenda-do-date-later, org-agenda-schedule, etc.) often
> results in an infinite loop.
>
> I believe this loop occurs in the function org-agenda-show-new-time.
>
> Here are the steps I took to debug this:
>
> 1. I add a counter to the function:
>
>
> 2. I narrow an agenda diary buffer by tag (e.g., "home").
>
> 3. I reschedule an item.
>
> 4. Emacs hangs.
>
> 5. I hit C-g to stop the process.
>
> 6. I check the value of my-counter. The longer I let the process run,
> the higher the value of my-counter. E.g., letting it run for
> approximately ten seconds results in the following:
>
> my-counter's value is 32193
>

My one feeble attempt to reproduce this failed. Looking at the code

--8<---------------cut here---------------start------------->8---
      (while (not (bobp))
        (when (equal marker (org-get-at-bol 'org-marker))
          (org-move-to-column (- (window-width) (length stamp)) t)
          (org-agenda-fix-tags-filter-overlays-at (point))
          ...
          (beginning-of-line 1))
        (beginning-of-line 0)))))
--8<---------------cut here---------------end--------------->8---

let's assume we are not at the beginning of the buffer, so we don't exit
the loop that way.  If the when succeeds, we do a couple of things and
then do (beginning-of-line 1). This just takes us to the beginning of
the current line. But after the when is done, we do (beginning-of-line
0) which should take us to the previous line.  So we should be making
steady progress towards the beginning of the buffer and the loop should
terminate.

Since you can reproduce it (and you've already done the hard work of
figuring out where the inf loop is), maybe you can edebug the function
and step through it a couple of times to see what's happening.
-- 
Nick


Reply via email to