summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-03-23 13:42:29 +0100
committerBastien Guerry <bzg@altern.org>2012-03-23 13:42:29 +0100
commiteb7f7159c9fb0a08bac802a9a2fbe0bd74ea7dab (patch)
treec9a72186d62135b79c9557251954ba52b2bb7719
parent1581b16c786816843d384f3751012fc6a61c3604 (diff)
parent532a1ac40ad55fc092f65167eef360467c967b9d (diff)
downloadorg-mode-eb7f7159c9fb0a08bac802a9a2fbe0bd74ea7dab.tar.gz
Merge branch 'hotfix-7.8.06'
-rw-r--r--contrib/lisp/org-contacts.el6
-rw-r--r--lisp/org-clock.el1
-rw-r--r--lisp/org-crypt.el16
-rw-r--r--lisp/org.el44
4 files changed, 49 insertions, 18 deletions
diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index bdd9996..b6d9e50 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -143,7 +143,8 @@ This overrides `org-email-link-description-format' if set."
(defun org-contacts-filter (&optional name-match tags-match)
"Search for a contact maching NAME-MATCH and TAGS-MATCH.
If both match values are nil, return all contacts."
- (let ((tags-matcher
+ (let* (todo-only
+ (tags-matcher
(if tags-match
(cdr (org-make-tags-matcher tags-match))
t))
@@ -161,7 +162,8 @@ If both match values are nil, return all contacts."
(error "File %s is no in `org-mode'" file))
(org-scan-tags
'(add-to-list 'markers (set-marker (make-marker) (point)))
- `(and ,contacts-matcher ,tags-matcher ,name-matcher))))
+ `(and ,contacts-matcher ,tags-matcher ,name-matcher)
+ todo-only)))
(dolist (marker markers result)
(org-with-point-at marker
(add-to-list 'result
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 46d9af8..5fca941 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2441,6 +2441,7 @@ TIME: The sum of all time spend in this tree, in minutes. This time
(tags (plist-get params :tags))
(properties (plist-get params :properties))
(inherit-property-p (plist-get params :inherit-props))
+ todo-only
(matcher (if tags (cdr (org-make-tags-matcher tags))))
cc range-text st p time level hdl props tsp tbl)
diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el
index f60c61e..7e7ba30 100644
--- a/lisp/org-crypt.el
+++ b/lisp/org-crypt.el
@@ -237,16 +237,20 @@ See `org-crypt-disable-auto-save'."
(defun org-encrypt-entries ()
"Encrypt all top-level entries in the current buffer."
(interactive)
- (org-scan-tags
- 'org-encrypt-entry
- (cdr (org-make-tags-matcher org-crypt-tag-matcher))))
+ (let (todo-only)
+ (org-scan-tags
+ 'org-encrypt-entry
+ (cdr (org-make-tags-matcher org-crypt-tag-matcher))
+ todo-only)))
(defun org-decrypt-entries ()
"Decrypt all entries in the current buffer."
(interactive)
- (org-scan-tags
- 'org-decrypt-entry
- (cdr (org-make-tags-matcher org-crypt-tag-matcher))))
+ (let (todo-only)
+ (org-scan-tags
+ 'org-decrypt-entry
+ (cdr (org-make-tags-matcher org-crypt-tag-matcher))
+ todo-only)))
(defun org-crypt-use-before-save-magic ()
"Add a hook to automatically encrypt entries before a file is saved to disk."
diff --git a/lisp/org.el b/lisp/org.el
index 9f70ebb..3c01c1a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12821,7 +12821,7 @@ obtain a list of properties. Building the tags list for each entry in such
a file becomes an N^2 operation - but with this variable set, it scales
as N.")
-(defun org-scan-tags (action matcher &optional todo-only start-level)
+(defun org-scan-tags (action matcher todo-only &optional start-level)
"Scan headline tags with inheritance and produce output ACTION.
ACTION can be `sparse-tree' to produce a sparse tree in the current buffer,
@@ -12831,7 +12831,9 @@ this case the return value is a list of all return values from these calls.
MATCHER is a Lisp form to be evaluated, testing if a given set of tags
qualifies a headline for inclusion. When TODO-ONLY is non-nil,
-only lines with a TODO keyword are included in the output.
+only lines with a not-done TODO keyword are included in the output.
+This should be the same variable that was scoped into
+and set by `org-make-tags-matcher' when it constructed MATCHER.
START-LEVEL can be a string with asterisks, reducing the scope to
headlines matching this string."
@@ -13001,8 +13003,6 @@ headlines matching this string."
(if (member x org-use-tag-inheritance) x nil))
tags)))))
-(defvar todo-only) ;; dynamically scoped
-
(defun org-match-sparse-tree (&optional todo-only match)
"Create a sparse tree according to tags string MATCH.
MATCH can contain positive and negative selection of tags, like
@@ -13049,9 +13049,29 @@ instead of the agenda files."
(org-agenda-files))))))))
(defun org-make-tags-matcher (match)
- "Create the TAGS/TODO matcher form for the selection string MATCH."
- ;; todo-only is scoped dynamically into this function, and the function
- ;; may change it if the matcher asks for it.
+ "Create the TAGS/TODO matcher form for the selection string MATCH.
+
+The variable `todo-only' is scoped dynamically into this function; it will be
+set to t if the matcher restricts matching to TODO entries,
+otherwise will not be touched.
+
+Returns a cons of the selection string MATCH and the constructed
+lisp form implementing the matcher. The matcher is to be
+evaluated at an Org entry, with point on the headline,
+and returns t if the entry matches the
+selection string MATCH. The returned lisp form references
+two variables with information about the entry, which must be
+bound around the form's evaluation: todo, the TODO keyword at the
+entry (or nil of none); and tags-list, the list of all tags at the
+entry including inherited ones. Additionally, the category
+of the entry (if any) must be specified as the text property
+'org-category on the headline.
+
+See also `org-scan-tags'.
+"
+ (declare (special todo-only))
+ (unless (boundp 'todo-only)
+ (error "org-make-tags-matcher expects todo-only to be scoped in"))
(unless match
;; Get a new match request, with completion
(let ((org-last-tags-completion-table
@@ -13168,6 +13188,9 @@ instead of the agenda files."
(setq matcher (if todomatcher
(list 'and tagsmatcher todomatcher)
tagsmatcher))
+ (when todo-only
+ (setq matcher (list 'and '(member todo org-not-done-keywords)
+ matcher)))
(cons match0 matcher)))
(defun org-op-to-function (op &optional stringp)
@@ -13881,7 +13904,8 @@ a *different* entry, you cannot use these techniques."
org-done-keywords-for-agenda
org-todo-keyword-alist-for-agenda
org-drawers-for-agenda
- org-tag-alist-for-agenda)
+ org-tag-alist-for-agenda
+ todo-only)
(cond
((eq match t) (setq matcher t))
@@ -13914,7 +13938,7 @@ a *different* entry, you cannot use these techniques."
(progn
(org-prepare-agenda-buffers
(list (buffer-file-name (current-buffer))))
- (setq res (org-scan-tags func matcher nil start-level)))
+ (setq res (org-scan-tags func matcher todo-only start-level)))
;; Get the right scope
(cond
((and scope (listp scope) (symbolp (car scope)))
@@ -13935,7 +13959,7 @@ a *different* entry, you cannot use these techniques."
(save-restriction
(widen)
(goto-char (point-min))
- (setq res (append res (org-scan-tags func matcher))))))))))
+ (setq res (append res (org-scan-tags func matcher todo-only))))))))))
res)))
;;;; Properties