1

I have been reading about the fast tag selection interface in the manual, and I would like to use it, but only in some cases.

When I set tags for some kind of topics grouping, I am fine using the completion minibuffer, I still have too many tags to make a letter selection practical. It also depends a lot on the context; mostly, I am tagging tasks or general notes, the former having far fewer 'topic' tags.

I have however a few tags that I use for maintenance purposes or status indication,like 'DRAFT', 'WIP', 'REFILE', etc... In those cases, the fast selection interface combined for mutually exclusive group tags is exactly what I need.

I would rather not set the TAGS keyword in all of my files (I also use org-roam so I have a lot!), and I am trying to simply keep my settings as is, to invoke the tag completion interface as I always have, and add a custom wrapper function (with a different binding) to bring up the fast tag selection interface with a custom set of tag candidates when I need it.

I have tried to wrap org-set-tags-commands in a let containing the appropriate configuration (using the documentation example for testing), but it is not working:

(let ((org-use-fast-tag-selection t)
      (org-complete-tags-always-offer-all-agenda-tags nil)
      (org-tag-alist '((:startgroup . nil)
                       ("@work" . ?w) ("@home" . ?h)
                       ("@tennisclub" . ?t)
                       (:endgroup . nil)
                       )))
  (org-set-tags-command))

I also tried using org-tag-persistent-alist instead, with the same result. All variables in the let take effect, but the tag list and groups seem to be ignored.

== EDIT ==

The opposite of what I was doing works fine:

  1. Set org-tag-alist globally in the config file
  2. Wrap the following in a function:
(let ((org-use-fast-tag-selection nil)
      (org-complete-tags-always-offer-all-agenda-tags t)
  (org-set-tags-command))

This allows me to achieve more or less what I intended to do, but it does not allow me to assign customized sets of tag candidates under arbitrary conditions.

I will leave the question unanswered in case someone knows a way to achieve that part.

1
  • Not sure if it's going to work, but try setting org-current-tag-alist instead of org-tag-alist.
    – NickD
    Commented Oct 10 at 2:01

1 Answer 1

1

The problem is that org-set-tags-command does not consult either org-tag-alist or org-persistent-tag-alist. Instead, it consults org-current-tag-alist which is constructed out of the other two at buffer initialization time. So try this function instead:

(defun my/org-set-tags-command ()
  (interactive)
  (let ((org-use-fast-tag-selection t)
        (org-complete-tags-always-offer-all-agenda-tags nil)
        (org-current-tag-alist '((:startgroup . nil)
                                 ("@work" . ?w)
                                 ("@home" . ?h)
                                 ("@tennisclub" . ?t)
                                 (:endgroup . nil)
                                 )))
    (org-set-tags-command)))

BTW, org-current-tag-alist is automatically made buffer-local.

1
  • Thank you, it is exactly what I was looking for.
    – lyndhurst
    Commented Oct 11 at 6:01

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.