Skip to content

Instantly share code, notes, and snippets.

@jwiegley
Created July 31, 2025 16:33
Show Gist options
  • Save jwiegley/25e18928eb17951409aa6654a727d3c4 to your computer and use it in GitHub Desktop.
Save jwiegley/25e18928eb17951409aa6654a727d3c4 to your computer and use it in GitHub Desktop.
*Prompt*: What is the best Emacs command for filtering items in the Org-mode agenda view?
*Response*:
#+begin_tool (find_functions :keyword ["org-agenda-filter" "org-agen ...)
(:name "find_functions" :args (:keyword ["org-agenda-filter" "org-agenda-filter-by" "org-agenda" "filter" "agenda" "org"]))
Functions containing '[org-agenda-filter org-agenda-filter-by org-agenda filter agenda org]':
org-agenda-filter-by-category Filter lines in the agenda buffer that have a specific category.
org-agenda-filter-by-effort Filter agenda entries by effort.
org-agenda-filter-by-regexp Filter agenda entries by a regular expressions.
org-agenda-filter-by-tag Keep only those lines in the agenda buffer that have a specific tag.
org-agenda-filter-by-top-headline Keep only those lines that are descendants from the same top headline.
org-agenda-mode Mode for time-sorted view on action items in Org files.
#+end_tool
The best Emacs command for filtering items in the Org-mode agenda view is =org-agenda-filter-by-tag=. It keeps only the lines in the agenda buffer that have a specific tag, allowing you to quickly narrow down to relevant tasks. Other useful filtering commands include =org-agenda-filter-by-category=, =org-agenda-filter-by-regexp=, and =org-agenda-filter-by-effort=, but tag filtering is typically the most common and powerful.
*Prompt*: What kind of options are accepted by `org-agenda-filter-by-tag`?
*Response*:
#+begin_tool (get_function_docstring :name "org-agenda ...)
(:name "get_function_docstring" :args (:name "org-agenda-filter-by-tag"))
Keep only those lines in the agenda buffer that have a specific tag.
The tag is selected with its fast selection letter, as configured.
With a ‘C-u’ prefix, apply the filter negatively, stripping all matches.
With a ‘C-u C-u’ prefix, add the new tag to the existing filter
instead of replacing it.
With a ‘C-u C-u C-u’ prefix, filter the literal tag, i.e. don’t
filter on all its group members.
A Lisp caller can specify CHAR. EXCLUDE means that the new tag
should be used to exclude the search - the interactive user can
also press ‘-’ or ‘+’ to switch between filtering and excluding.
(fn STRIP-OR-ACCUMULATE &optional CHAR EXCLUDE)
#+end_tool
=org-agenda-filter-by-tag= accepts:
- A single fast-selection character that you assigned in =org-tag-alist= / =org-tag-group-alist=.
- Prefix arguments:
- =C-u= → *exclude* (remove lines with that tag).
- =C-u C-u= → *accumulate* (add the tag to the current filter instead of replacing it).
- =C-u C-u C-u= → *literal* (filter on the exact tag, ignoring group members).
- A Lisp caller can supply the tag character directly (=CHAR=) and an optional =EXCLUDE= flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment