From 18cf324f07ca0513a9bb75e2ae4c57e87c9ebb6c Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 22 Apr 2012 09:21:42 +0200 Subject: [PATCH] org-agenda.el: Fix bug in top-category filtering. * org-agenda.el (org-agenda-top-category-filter): New variable for storing the current top-category filter. (org-agenda-redo): Apply a top-category filter, if any. (org-agenda-filter-by-top-category) (org-agenda-filter-top-category-apply): Set `org-agenda-top-category-filter' to the right value. Thanks to John Wiegley for reporting this. --- lisp/org-agenda.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 88de507b3..cfa6ad5d0 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3179,6 +3179,7 @@ removed from the entry content. Currently only `planning' is allowed here." (defvar org-agenda-name nil) (defvar org-agenda-tag-filter nil) (defvar org-agenda-category-filter nil) +(defvar org-agenda-top-category-filter nil) (defvar org-agenda-tag-filter-while-redo nil) (defvar org-agenda-tag-filter-preset nil "A preset of the tags filter used for secondary agenda filtering. @@ -6419,6 +6420,7 @@ When this is the global TODO list, a prefix argument will be interpreted." (org-agenda-keep-modes t) (tag-filter org-agenda-tag-filter) (tag-preset (get 'org-agenda-tag-filter :preset-filter)) + (top-cat-filter org-agenda-top-category-filter) (cat-filter org-agenda-category-filter) (cat-preset (get 'org-agenda-category-filter :preset-filter)) (org-agenda-tag-filter-while-redo (or tag-filter tag-preset)) @@ -6438,6 +6440,7 @@ When this is the global TODO list, a prefix argument will be interpreted." (put 'org-agenda-category-filter :preset-filter cat-preset) (and (or tag-filter tag-preset) (org-agenda-filter-apply tag-filter 'tag)) (and (or cat-filter cat-preset) (org-agenda-filter-apply cat-filter 'category)) + (and top-cat-filter (org-agenda-filter-top-category-apply top-cat-filter)) (and cols (org-called-interactively-p 'any) (org-agenda-columns)) (org-goto-line line) (recenter window-line))) @@ -6474,7 +6477,8 @@ The category is that of the current line." (interactive "P") (if org-agenda-filtered-by-top-category (progn - (setq org-agenda-filtered-by-top-category nil) + (setq org-agenda-filtered-by-top-category nil + org-agenda-top-category-filter nil) (org-agenda-filter-show-all-cat)) (let ((cat (org-find-top-category (org-get-at-bol 'org-hd-marker)))) (if cat (org-agenda-filter-top-category-apply cat strip) @@ -6689,7 +6693,8 @@ If the line does not have an effort defined, return nil." (beginning-of-line 2))) (if (get-char-property (point) 'invisible) (org-agenda-previous-line)) - (setq org-agenda-filtered-by-top-category t)) + (setq org-agenda-top-category-filter category + org-agenda-filtered-by-top-category t)) (defun org-agenda-filter-hide-line (type) (let (ov) -- 2.11.4.GIT