diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2019-09-02 08:07:58 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2019-09-03 15:47:39 +0200 |
commit | 7ee4cb02450279c3d4bdfa2700691d2e1847f967 (patch) | |
tree | 81db049d4522a861adc35a3d3c2a05830066a7a0 | |
parent | f230b730c5b37cb8039134dc04a566fe63f484cc (diff) | |
download | org-mode-7ee4cb02450279c3d4bdfa2700691d2e1847f967.tar.gz |
Revert `org-agenda-filter-by-category' to non-prompting state
-rw-r--r-- | doc/org-manual.org | 30 | ||||
-rw-r--r-- | lisp/org-agenda.el | 21 |
2 files changed, 35 insertions, 16 deletions
diff --git a/doc/org-manual.org b/doc/org-manual.org index 59c4193..d0d545e 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -9085,10 +9085,10 @@ filter types. - {{{kbd(<)}}} (~org-agenda-filter-by-category~) :: #+findex: org-agenda-filter-by-category - Prompt for a category, defaulting to the category of the item at - point, and show only entries with this category. Pressing - {{{kbd(<)}}} again removes this filter. When called with a prefix - argument exclude the category of the item at point from the agenda. + Filter by category of the line at point, and show only entries with + this category. Pressing {{{kbd(<)}}} again removes this filter. + When called with a prefix argument exclude the category of the item + at point from the agenda. - {{{kbd(=)}}} (~org-agenda-filter-by-regexp~) :: @@ -9125,12 +9125,20 @@ filter types. condition. With two universal prefix arguments, it clears effort filters, which can be accumulated. +- {{{kbd(^)}}} (~org-agenda-filter-by-top-headline~) :: + + #+findex: org-agenda-filter-by-top-headline + Filter the current agenda view and only display items that fall + under the same top-level headline as the current entry. So this + simulated the effect of restricting the agenda creation to this + tree. + - {{{kbd(/)}}} (~org-agenda-filter~) :: #+findex: org-agenda-filter - This is the unified interface to all four filter methods described - above. At the prompt, specify different filter elements in a single - string, with full completion support. For example, + This a the unified interface to four of the five filter methods + described above. At the prompt, specify different filter elements + in a single string, with full completion support. For example, #+begin_example +work-John+<0:10-/plot/ @@ -9148,14 +9156,6 @@ filter types. the front of the string, the new filter elements are added to the active ones. -- {{{kbd(^)}}} (~org-agenda-filter-by-top-headline~) :: - - #+findex: org-agenda-filter-by-top-headline - Filter the current agenda view and only display items that fall - under the same top-level headline as the current entry. So this - simulated the effect of restricting the agenda creation to this - tree. - - {{{kbd(|)}}} (~org-agenda-filter-remove-all~) :: Remove all filters in the current agenda view. diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 94a28fc..f4ad23f 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7464,7 +7464,26 @@ With a prefix argument, do so in all agenda buffers." "Return the category of the agenda line." (org-get-at-bol 'org-category)) - +(defun org-agenda-filter-by-category (strip) + "Filter lines in the agenda buffer that have a specific category. +The category is that of the current line. +Without prefix argument, keep only the lines of that category. +With a prefix argument, exclude the lines of that category." + (interactive "P") + (if (and org-agenda-filtered-by-category + org-agenda-category-filter) + (org-agenda-filter-show-all-cat) + (let ((cat (org-no-properties (org-get-at-eol 'org-category 1)))) + (cond + ((and cat strip) + (org-agenda-filter-apply + (push (concat "-" cat) org-agenda-category-filter) 'category)) + (cat + (org-agenda-filter-apply + (setq org-agenda-category-filter + (list (concat "+" cat))) 'category)) + (t (error "No category at point")))))) + (defun org-agenda-filter-by-category (strip) "Filter lines in the agenda buffer that have a specific category. The category is that of the current line. |