emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Ilya Shlyakhter <ilya_shl@alum.mit.edu>
Cc: nicholas.dokos@hp.com, emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: bug report: agenda timeline crashes
Date: Tue, 21 Feb 2012 21:43:46 -0500	[thread overview]
Message-ID: <30509.1329878626@alphaville> (raw)
In-Reply-To: Message from Ilya Shlyakhter <ilya_shl@alum.mit.edu> of "Tue, 21 Feb 2012 14:57:17 EST." <CACfYvRb3yRNqH5FkEMP156jSLwO62hh0HZH6fe__5qwKpOwh9g@mail.gmail.com>

Ilya Shlyakhter <ilya_shl@alum.mit.edu> wrote:

> In the head revision, if the org file has headlines that start with a
> timestamp, the command to create a timeline of the file (C-a L)
> crashes.
> * things
> *** <2011-10-06 Thu 22:24>
>     some text
> mapcar: Args out of range: #("  " 0 2 (org-category "mt3" tags nil
> org-highest-priority 65 org-lowest-priority 69 time-of-day 2224 ...)),
> 0, 37

Confirmed. The culprit seems to be some not-so-robust code in
org-agenda-highlight-todo. Here's the code:

--8<---------------cut here---------------start------------->8---
      (let ((pl (text-property-any 0 (length x) 'org-heading t x)))
	  (setq re (get-text-property 0 'org-todo-regexp x))
	  (when (and re
		     (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
					  x (or pl 0)) pl))
	     (or (match-end 1) (match-end 0)) (match-end 0)
	     (list 'face (org-get-todo-face (match-string 2 x)))
	    (when (match-end 1)
	      (setq x (concat (substring x 0 (match-end 1))
			      (format org-agenda-todo-keyword-format
				      (match-string 2 x))
			      (org-add-props " " (text-properties-at 0 x))
			      (substring x (match-end 3)))))))
--8<---------------cut here---------------end--------------->8---

The problem is that pl is nil in this case and so is the
value of

      (string-match (concat "\\(\\.*\\)" re "\\( +\\)") x (or pl 0))

but they compare equal, so the body of the

    (when (and re ...)

is evaluated with disastrous results: the string-match has failed so it
has not set any matches for (match-end ...) to find. In this case,
(match-end 1) evaluated to 36 (that's in a 3-character string :-).

AFAICT, the whole body should be skipped in the case when pl is nil:

	(let ((pl ...))
	  (when pl
            (setq re (...)
	    (when (and re (...))

But it's not clear to me whether this is the only bug.


      reply	other threads:[~2012-02-22  2:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 19:57 bug report: agenda timeline crashes Ilya Shlyakhter
2012-02-22  2:43 ` Nick Dokos [this message]

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:

  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=30509.1329878626@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ilya_shl@alum.mit.edu \


* 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


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