emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Infinite loop in org-agenda-show-new-time
@ 2013-08-05 15:42 Matt Lundin
  2013-08-05 17:13 ` Nick Dokos
  0 siblings, 1 reply; 27+ messages in thread
From: Matt Lundin @ 2013-08-05 15:42 UTC (permalink / raw)
  To: Org Mode

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:

--8<---------------cut here---------------start------------->8---
(defun org-agenda-show-new-time (marker stamp &optional prefix)
  "Show new date stamp via text properties."
  ;; We use text properties to make this undoable
  (let ((inhibit-read-only t))
    (setq stamp (concat prefix " => " stamp " "))
    (setq my-counter 0) ;; <-- my addition
    (save-excursion
      (goto-char (point-max))
      (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))
	  (setq my-counter (1+ my-counter)) ;; <-- also my addition
          (if (featurep 'xemacs)
	      ;; Use `duplicable' property to trigger undo recording
              (let ((ex (make-extent nil nil))
                    (gl (make-glyph stamp)))
                (set-glyph-face gl 'secondary-selection)
                (set-extent-properties
                 ex (list 'invisible t 'end-glyph gl 'duplicable t))
                (insert-extent ex (1- (point)) (point-at-eol)))
            (add-text-properties
             (1- (point)) (point-at-eol)
	     (list 'display (org-add-props stamp nil
			      'face 'secondary-selection))))
	  (beginning-of-line 1))
	(beginning-of-line 0)))))
--8<---------------cut here---------------end--------------->8---

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:

--8<---------------cut here---------------start------------->8---
my-counter's value is 32193

Documentation:
Not documented as a variable.
--8<---------------cut here---------------end--------------->8---

Without C-g the number will keep increasing indefinitely.

Thanks,
Matt

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2020-02-17 22:53 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-05 15:42 [BUG] Infinite loop in org-agenda-show-new-time Matt Lundin
2013-08-05 17:13 ` Nick Dokos
2013-08-05 20:14   ` Matt Lundin
2013-08-05 22:05     ` Nick Dokos
2013-08-06 17:36       ` Matt Lundin
2013-08-06 21:35         ` Nick Dokos
2013-08-06 22:45           ` Nick Dokos
2013-08-14 15:19             ` Matt Lundin
2013-08-14 15:38               ` Nick Dokos
2013-08-10 15:06         ` Nick Dokos
2013-08-14 15:15           ` Matt Lundin
2013-08-14 15:45             ` Nick Dokos
2013-08-23  9:58               ` Carsten Dominik
2013-08-23 12:07                 ` Nick Dokos
2019-12-26 19:37                   ` Andrew Hyatt
2020-02-01  9:32                     ` Bastien
2020-02-02 15:19                       ` Andrew Hyatt
2020-02-03 19:04                         ` Bastien
2020-02-04 19:25                           ` Andrew Hyatt
2020-02-04 23:38                             ` Bastien
2020-02-05 16:34                               ` Andrew Hyatt
2020-02-05 19:50                               ` Matthew Lundin
2020-02-11  7:56                                 ` Bastien
2020-02-14  3:27                                   ` Andrew Hyatt
2020-02-14 10:02                                     ` Bastien
2020-02-17 19:20                                       ` Andrew Hyatt
2020-02-17 22:53                                         ` Bastien

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).