3

If I place %^g in my capture template, org will prompt for tags, with completion. But typically, I like to brainstorm on relevant tags, after I finish writing my ideas.

Is there some way to get tag completion by running org-set-tags from within org-capture?

Thanks!

1 Answer 1

3

In the capture window you can use standard Org commands. So at any point you could hit C-c C-q (the default binding for org-set-tags-command) to add tags.

Refer to the Setting Tags section in the Org manual for more details about tag completion.

Update:

As noted in the comments, this doesn't quite work. By default tag completion is derived from the current buffer, and the capture buffer is narrowed so that there are no tags to choose from. (You could widen the buffer, but that's clunky.)

You can use org-capture-hook to set the available tags for the capture buffer.

For example you can use Org's global set of tags with this:

(add-hook 'org-capture-mode-hook
          (lambda ()
            (setq-local org-tag-alist (org-global-tags-completion-table))))

This will let you picks tags from any of your org agenda files. If you only want to see tags for the capture file, try this instead:

(add-hook 'org-capture-mode-hook
          (lambda ()
            (save-restriction
              (widen)
              (setq-local org-tag-alist (org-get-buffer-tags)))))
5
  • Hmm. I tried this, but no tags show up when I attempt completion...
    – Adam
    Dec 2, 2016 at 16:46
  • You're right -- sorry about that! I've updated the answer with one approach to setting the tags available for completion.
    – glucas
    Dec 2, 2016 at 17:04
  • Thank you, thank you, thank you! @glucas you are now officially my "goto org-mode expert"!
    – Adam
    Dec 2, 2016 at 20:27
  • Glad to help! I ended up adding that capture hook to my configuration as well. :-)
    – glucas
    Dec 2, 2016 at 20:29
  • Hey @glucas, thanks for the help. I sent you a message on Twitter, so check your account. I have some code you may find useful. Cheers!
    – Adam
    Dec 2, 2016 at 20:47

Your Answer

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

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