diff options
author | Bastien Guerry <bzg@altern.org> | 2013-04-05 18:17:26 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2013-04-05 19:46:02 +0200 |
commit | 889b7e507c7a6f22772c79a531ad4a5726d5f29a (patch) | |
tree | 8d177babfd7143f4af3d0cb1b0c3e0761166ea17 | |
parent | 428f12841fa0c36b08498128e2eb75bc4a4f3d5b (diff) | |
download | org-mode-889b7e507c7a6f22772c79a531ad4a5726d5f29a.tar.gz |
org-agenda.el (org-agenda-get-todos): Set `todo-state' earlier so that we can skip false-positives in time
* org-agenda.el (org-agenda-get-todos): Set `todo-state'
earlier so that we can skip false-positives in time.
For example, when searching for a TODO headline with "* NEXT bla"
in a buffer where (1) there is such a headline but (2) "NEXT" is
not in the list of known TODO keywords, then we skip this match.
The earlier behavior threw an error.
-rw-r--r-- | lisp/org-agenda.el | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index e40a56a..196b635 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5333,7 +5333,7 @@ the documentation of `org-diary'." "\\|") "\\)")) (t org-not-done-regexp)))) marker priority category category-pos level tags todo-state ts-date ts-date-type - ee txt beg end inherited-tags) + ee txt beg end inherited-tags todo-state-end-pos) (goto-char (point-min)) (while (re-search-forward regexp nil t) (catch :skip @@ -5341,6 +5341,10 @@ the documentation of `org-diary'." (beginning-of-line) (org-agenda-skip) (setq beg (point) end (save-excursion (outline-next-heading) (point))) + (unless (and (setq todo-state (org-get-todo-state)) + (setq todo-state-end-pos (match-end 2))) + (goto-char end) + (throw :skip nil)) (when (org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item end) (goto-char (1+ beg)) (or org-agenda-todo-list-sublevels (org-end-of-subtree 'invisible)) @@ -5388,8 +5392,7 @@ the documentation of `org-diary'." tags (org-get-tags-at nil (not inherited-tags)) level (make-string (org-reduced-level (org-outline-level)) ? ) txt (org-agenda-format-item "" txt level category tags t) - priority (1+ (org-get-priority txt)) - todo-state (org-get-todo-state)) + priority (1+ (org-get-priority txt))) (org-add-props txt props 'org-marker marker 'org-hd-marker marker 'priority priority 'org-category category @@ -5399,7 +5402,7 @@ the documentation of `org-diary'." 'type (concat "todo" ts-date-type) 'todo-state todo-state) (push txt ee) (if org-agenda-todo-list-sublevels - (goto-char (match-end 2)) + (goto-char todo-state-end-pos) (org-end-of-subtree 'invisible)))) (nreverse ee))) |