From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [BUG] Infinite loop in org-agenda-show-new-time Date: Mon, 05 Aug 2013 13:13:15 -0400 Message-ID: <87siyojc2c.fsf@gmail.com> References: <87zjswb0vq.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6OLj-0004a4-CL for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 13:13:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V6OLd-0003k4-5z for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 13:13:39 -0400 Received: from plane.gmane.org ([80.91.229.3]:59731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V6OLc-0003jq-VV for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 13:13:33 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V6OLY-0004yn-IG for emacs-orgmode@gnu.org; Mon, 05 Aug 2013 19:13:28 +0200 Received: from pool-108-7-96-134.bstnma.fios.verizon.net ([108.7.96.134]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 05 Aug 2013 19:13:28 +0200 Received: from ndokos by pool-108-7-96-134.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 05 Aug 2013 19:13:28 +0200 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: emacs-orgmode@gnu.org Matt Lundin 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