1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-24 07:20:29 +00:00

Revert `org-agenda-filter-by-category' to non-prompting state

This commit is contained in:
Carsten Dominik 2019-09-02 08:07:58 +02:00
parent f230b730c5
commit 7ee4cb0245
2 changed files with 35 additions and 16 deletions

View File

@ -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.

View File

@ -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.