From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: bug report: agenda timeline crashes Date: Tue, 21 Feb 2012 21:43:46 -0500 Message-ID: <30509.1329878626@alphaville> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S02BM-0005xl-AZ for emacs-orgmode@gnu.org; Tue, 21 Feb 2012 21:43:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S02BL-0002hc-33 for emacs-orgmode@gnu.org; Tue, 21 Feb 2012 21:43:52 -0500 Received: from g4t0017.houston.hp.com ([15.201.24.20]:42924) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S02BK-0002ep-QC for emacs-orgmode@gnu.org; Tue, 21 Feb 2012 21:43:51 -0500 In-Reply-To: Message from Ilya Shlyakhter of "Tue, 21 Feb 2012 14:57:17 EST." 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: Ilya Shlyakhter Cc: nicholas.dokos@hp.com, emacs-orgmode Ilya Shlyakhter 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 ...) ) 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