I have a problem with the filtering function org-agenda-filter-by-regexp:

It just searches the headlines of the entries not the whole entry text.


 * title :work:

Searching for the tag 'work' gives the correct and only headline 'title' in the 'Org Agenda' buffer. But after the regexp-filtering with (= text) the headline disappears because(?) 'text' isn't part of the headline.

I know I can start with the function for 'Search for keywords' (usually C-c a s) and then filter by the tag 'work' but mostly I start with tag searching and then look for keywords.

The documentation says: "only show agenda entries matching the regular expression the user entered." But it seems that it searches only the headlines of the entries.

EDIT: Not a solution, just a suggestion. Maybe it helps somebody. If you want to search for a keyword "text" and you know it will have to many results you can add the tag as an additional keyword: :work: -- but in this case only the direct tag of the headline can be taken into account.

1 Answer 1


"Entry" is used ambiguously in the documentation:

  • an Org mode entry consists of a headline, scheduling information, optional drawers and the body of entry (text, possibly followed by subentries).

  • an agenda entry consists of some agenda information (the category, scheduling information, possibly some other things controlled by the variable org-agenda-prefix-format) and the headline from an Org mode entry.

IOW, the agenda does not display the full Org mode entry, just its headline, so there is no way to search directly the agenda buffer for text that occurs in the body of an Org mode entry.

But you can use C-c a / to use org-occur-in-agenda-files to search for text using a regular expression in all the files that the agenda uses, i.e. all the files in org-agenda-files.

EDIT: Try using a tag search (C-c a m <tag> RET) and then in the resulting buffer do M-x org-search-view RET {<regexp>} RET and see if that works for you. If it does, you might want to add a binding for org-search-view in the org-agenda-mode-map to make it easier to invoke - there is is very little left free, but Z was not defined in my case, so I use it here as an example:

(define-key org-agenda-mode-map (kbd "Z") #'org-search-view)

With this key binding, the work flow would be: C-c a m <tag> RET Z {<regexp>} RET.

EDIT 2: Unfortunately, as the OP points out in a comment, this does not work: the org-search-view is done from scratch, not in the context of the previous tag search.

  • Thanks. But as I mentioned I need the power of tags and the keywords. C-c a / is just for keywords.
    – rl1
    Commented Oct 27, 2020 at 18:12
  • Edited to add a possible workflow. I'd be interested to find out whether it works for you.
    – NickD
    Commented Oct 27, 2020 at 19:03
  • I don't understand what you mean: Of course it will work but it isn't what I'm looking for.
    – rl1
    Commented Oct 27, 2020 at 21:44
  • Sorry - I never pushed the edit. Now see if that workflow makes sense and whether it works.
    – NickD
    Commented Oct 27, 2020 at 21:52
  • No, unfortunately not. It starts a new agenda search - it ignores the tag search before.
    – rl1
    Commented Oct 28, 2020 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.