diff options
author | Karl Fogel <kfogel@red-bean.com> | 2012-03-01 00:45:05 +0000 |
---|---|---|
committer | David Maus <dmaus@ictsoc.de> | 2012-03-04 20:13:05 +0100 |
commit | 1749db14fbe198d14bbd7f987042640c3fd626df (patch) | |
tree | 97368bb10efbacb74300bbd6be4bd72131af1d6f | |
parent | b549c6006511150a93bb97a539d400ab3ade4b75 (diff) | |
download | org-mode-1749db14fbe198d14bbd7f987042640c3fd626df.tar.gz |
org-agenda: Handle case of heading w/ date but no keyword
* lisp/org-agenda.el (org-agenda-highlight-todo): Handle the case of a
heading that has a date but no todo keyword.
This is a fix for the args-out-of-range bug discussed in these threads:
http://thread.gmane.org/gmane.emacs.orgmode/52621
http://thread.gmane.org/gmane.emacs.orgmode/52793
http://thread.gmane.org/gmane.emacs.orgmode/52786
http://thread.gmane.org/gmane.emacs.orgmode/52810
The discussions involved Ilya Shlyakhter, James Atwood, Nick Dokos,
and myself, and the subject headers are:
bug report: agenda timeline crashes
Bug report: weekly agenda and blank, timestamped headers
org-agenda-list (from git) giving "args-out-of-range error"
TINYCHANGE
-rw-r--r-- | lisp/org-agenda.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index d46f2ef..8837828 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5868,8 +5868,18 @@ could bind the variable in the options section of a custom command.") (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 + ;; Test `pl' because if there's no heading content, + ;; there's no point matching to highlight. Note + ;; that if we didn't test `pl' first, and there + ;; happened to be no keyword from `org-todo-regexp' + ;; on this heading line, then the `equal' comparison + ;; afterwards would spuriously succeed in the case + ;; where `pl' is nil -- causing an args-out-of-range + ;; error when we try to add text properties to text + ;; that isn't there. + pl (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)") - x (or pl 0)) pl)) + x pl) pl)) (add-text-properties (or (match-end 1) (match-end 0)) (match-end 0) (list 'face (org-get-todo-face (match-string 2 x))) |