emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* bug report: agenda timeline crashes
@ 2012-02-21 19:57 Ilya Shlyakhter
  2012-02-22  2:43 ` Nick Dokos
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Shlyakhter @ 2012-02-21 19:57 UTC (permalink / raw)
  To: emacs-orgmode

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

thanks,
ilya

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

* Re: bug report: agenda timeline crashes
  2012-02-21 19:57 bug report: agenda timeline crashes Ilya Shlyakhter
@ 2012-02-22  2:43 ` Nick Dokos
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Dokos @ 2012-02-22  2:43 UTC (permalink / raw)
  To: Ilya Shlyakhter; +Cc: nicholas.dokos, emacs-orgmode

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))
	    (add-text-properties
	     (or (match-end 1) (match-end 0)) (match-end 0)
	     (list 'face (org-get-todo-face (match-string 2 x)))
	     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 ...)
      <body>
     )

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.

Nick

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

end of thread, other threads:[~2012-02-22  2:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-21 19:57 bug report: agenda timeline crashes Ilya Shlyakhter
2012-02-22  2:43 ` Nick Dokos

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