From 4800fd8b7c797d2197288754288e757ad03660ee Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Tue, 2 Dec 2008 16:53:25 +0100 Subject: [PATCH] Fix bugs in implementation and documentation of the mapping API. There were bugs in the mapping API, pointed to by Samuel Wales: Manual says: The following example counts the number of entries with TODO keyword WAITING, in all agenda files. (length (org-map-entries t "/+WAITING" nil 'agenda)) Org says invalid function for the string. First of all, the example in the manual was wrong, the "nil" should be gone. Second, the mapping function did not return all results in a list, so that `length' could not count them. This patch fixes these issues. --- doc/ChangeLog | 4 ++++ doc/org.texi | 2 +- lisp/ChangeLog | 4 ++++ lisp/org.el | 7 ++++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 200735047..91c4b9328 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2008-12-02 Carsten Dominik + + * org.texi (Using the mapping API): Fix bug in mapping example. + 2008-11-29 Carsten Dominik * org.texi (Property searches): Document new special values for diff --git a/doc/org.texi b/doc/org.texi index e3e148564..b04cbdd93 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -9830,7 +9830,7 @@ The following example counts the number of entries with TODO keyword @code{WAITING}, in all agenda files. @lisp -(length (org-map-entries t "/+WAITING" nil 'agenda)) +(length (org-map-entries t "/+WAITING" 'agenda)) @end lisp @node History and Acknowledgments, Main Index, Hacking, Top diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b4ef4b728..b00e4e03c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2008-12-02 Carsten Dominik + + * org.el (org-map-entries): Return all values. + 2008-11-29 Carsten Dominik * org.el (org-matcher-time): Recognize more special values. diff --git a/lisp/org.el b/lisp/org.el index 2745ebd51..dfabe4e0a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -9897,7 +9897,7 @@ the scanner. The following items can be given here: (org-agenda-skip-function (car (org-delete-all '(comment archive) skip))) (org-tags-match-list-sublevels t) - matcher pos file + matcher pos file res org-todo-keywords-for-agenda org-done-keywords-for-agenda org-todo-keyword-alist-for-agenda @@ -9906,7 +9906,7 @@ the scanner. The following items can be given here: (cond ((eq match t) (setq matcher t)) ((eq match nil) (setq matcher t)) - (t (setq matcher (if match (org-make-tags-matcher match) t)))) + (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t)))) (when (eq scope 'tree) (org-back-to-heading t) @@ -9939,7 +9939,8 @@ the scanner. The following items can be given here: (save-restriction (widen) (goto-char (point-min)) - (org-scan-tags func matcher)))))))) + (setq res (append res (org-scan-tags func matcher))))))) + res))) ;;;; Properties -- 2.11.4.GIT