Here is one approach to hide tags in folded view, and show them in any expanded view.
(defun org-toggle-tag-visibility (state)
"Run in `org-cycle-hook'."
(message "%s" state)
(cond
;; global cycling
((memq state '(overview contents showall))
(org-map-entries
(lambda ()
(let ((tagstring (nth 5 (org-heading-components)))
start end)
(when tagstring
(save-excursion
(beginning-of-line)
(re-search-forward tagstring)
(setq start (match-beginning 0)
end (match-end 0)))
(cond
((memq state '(overview contents))
(outline-flag-region start end t))
(t
(outline-flag-region start end nil))))))))
;; local cycling
((memq state '(folded children subtree))
(save-restriction
(org-narrow-to-subtree)
(org-map-entries
(lambda ()
(let ((tagstring (nth 5 (org-heading-components)))
start end)
(when tagstring
(save-excursion
(beginning-of-line)
(re-search-forward tagstring)
(setq start (match-beginning 0)
end (match-end 0)))
(cond
((memq state '(folded children))
(outline-flag-region start end t))
(t
(outline-flag-region start end nil)))))))))))
(add-hook 'org-cycle-hook 'org-toggle-tag-visibility)
org-agenda-finalize-hook
that goes through the near final product and redacts it using a regexp\\(:[[:alnum:]_@#%:]+:\\)
; or, (2), modifyorg-agenda-format-item
to structure the data before it gets inserted into the buffer. No one, except me, likes to modify the source . . . so option two only applies to the very brave or stubborn souls. I don't know of any adverse consequences to either approach off the top of my head, but it may behoove you to wait for someone like .. [insert name if I can think of it].org-set-font-lock-defaults
, somewhere after all the faces are applied, to create a semi-permanent hiding of tags. Absent additional details regarding how a potential toggle would work in the context of this question, I am unable to comment on that approach (even though I wrote up the solution in the linked thread). Please give some thought as to what circumstances would trigger toggling on and off, including, but not limited to, how far and wide spread the toggle is -- e.g., just the subtree or the whole buffer in one-fell swoop.org-set-font-lock-defaults
. I was thinking about adding the setting to org-mode'svisibility cycling
to toggle tag hiding on/off...