0

Hi I would like to use

C-c a m

To create a todo list that is filtered by tags.

If I have a tag like :Makeamilliondollars:

I would like to be able search for it using a wildcard.

Eg I would like to enter Makea

I tried

Makea*

and this does not work.

Looking at the docs: 11.3.3 Matching tags and properties https://orgmode.org/manual/Matching-tags-and-properties.html

The only example given for a wildcard search is:

For example, ‘work+{^boss.*}’ matches headlines that contain the tag ‘:work:’ and any tag starting with ‘boss’.

So I am wondering in my case do I need to use

{^Makea.*}

That seems like a lot of extra characters to type in each time I want to do a wildcard search.

Could someone tell me what the minimum additional characters are to do a wildcard search?

2
  • 1
    You can use completion: C-c a m Makea <TAB>
    – NickD
    Feb 14 at 20:25
  • Hi NickD, your suggestion works like a charm. Thank you very much for taking the time to help me, once again. Would you like to add it as an Answer so that I can accept it?
    – ironfish
    Feb 15 at 1:08
1

Org mode uses the standard Emacs minibuffer completion mechanism for tags: whenever a tag is expected (e.g. at the C-c a m prompt), you can type TAB to get a completion list. You can click on a completion to choose it (or, without a mouse, switch to the completion buffer, navigate to the completion of interest and press RET); or you can narrow down the selection by typing a letter or two and pressing another TAB: when you have reduced the choices to just one, type RET to choose it. E.g. if I say C-c a m and type TAB at the matching prompt, I might get a completion buffer with many tags:

drill     emacs     export  fedora  firewalld   git     html    latex   linux
nfs       noexport  org     pacc    project     python  rh      selinux  ssh    

Typing e TAB reduces the list to two: emacs export, and typing m TAB completes it to just emacs at which point I type RET and I am done: the tag emacs is selected.

At a more advanced level, there are ways to influence what tags are added to the completion list: by default, it's all the tags in the file (e.g. when you try to insert a tag on a headline), or all the tags in all the agenda files (that's what C-c a m uses); but you can use the variables org-tag-alist and org-tag-persisten-alist and you can also use in-buffer settings to modify the completion list. You can find the gory details here or, better, just say C-h i g (org)Setting tags to your emacs (that invokes the Info system in emacs - learning to use the Info system is highly recommended: you can use emacs to tell you (almost) all about emacs). Although I mention this for completeneess, you should probably not worry about it now. After you get comfortable with standard completion, you might want to come back and reread this paragraph.

The standard Emacs minibuffer completion mechanism is described here but, as above, you can also use Info to get to the same information inside your emacs: C-h i g (emacs)Completion - and BTW, you can use completion to get to the right place: say C-h i g (em TAB )Compl TAB and you don't have to type the whole thing (or even remember it). Completion is powerful!

In the future, you might want to investigate some other completion mechanisms that are available (John Kitchin mentions helm and ivy in his answer), but I would recommend that you leave them for later: you can spend years working with Emacs without feeling the need for any of these additional mechanisms.

1
  • Thanks again NickD!
    – ironfish
    Feb 15 at 13:22
1

That is the correct way to do it. Your only other approach is to use something like ivy or helm, which when you type C-c a m will offer you a list of tags that you can use completion on to narrow down.

6
  • There is tag completion in native Org mode: you don't need ivy or helm
    – NickD
    Feb 14 at 20:25
  • that makes sense in 2020 hindsight, since those to packages just redefine how that works. Feb 14 at 20:28
  • Hi John Kitchin, thanks very much for taking the time and thought to help me out.
    – ironfish
    Feb 15 at 0:31
  • Hi NickD, thanks once again for your help. Could you tell me a bit more about tag completion and how that should work? I am thinking eg when I type in Makea that it will auto-complete to Makeamilliondollars, but that is not happening for me......
    – ironfish
    Feb 15 at 0:34
  • Hi NickD, sorry, I just noticed your answer. I will try it shortly....
    – ironfish
    Feb 15 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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