I would like to change the way tags are displayed in the org-mode buffer from this:
* Headline :tag1:tag2:tag3:
to this:
* Headline tag1
tag2
tag3
So basically, the changes I'm looking for are:
Start tags immediately after the headline.
Hide the :
characters
Add a space in-between each tag, so that long lists of tags will wrap properly in visual line mode
Remove default bold formatting of tags and add a highlight
So far, I've been able to change the font face and add a highlight by customizing the Org Tag
property. As a temp/hack, I made the :
characters invisible by turning on hi-lock-mode
and then Mx highlight-phrase [RET] : [RET] org-hide [RET]
. But this only hides the colon—it doesn't actually create a real space. So tags still won't wrap properly in visual line mode
. Also, this hides all colons, everywhere, not just the ones that separate tags.
Perhaps another option is to add the space but leave the colon?
* Headline :tag1
:tag2
:tag3
I've been auditioning this with the solarized-light theme. Here's a screenshot:
Any ideas, comments? Thanks!
As mentioned by @lawlist, the (setq org-tags-column 0)
puts the tags immediately after headline.
To hide the colons associated with tags, I tried the approach suggested by @Tobias, by setting the display property of :
. Putting this snippet in .emacs
or init.el
seems to work for me.
(font-lock-add-keywords 'org-mode
'(("^\\*+ "
":" nil nil
(0 (put-text-property (match-beginning 0) (match-end 0) 'display " ")))))
I was referring to the (matcher . anchored-highlighter)
format of setting a Search-based Fontification :
"^\\\\*+ "
part first matches an org heading ":"
searches for :
:
with a space, according to the doc on display specs that replaces the texts A screenshot (note I didn't set org-tags-column 0
so it aligns right, and the font coloring are set by customize-face RET org-tag RET
):
What you ask for could be solved if:
To ask on the Org ML?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.