orgmode icon indicating copy to clipboard operation
orgmode copied to clipboard

Aligning tags

Open tott opened this issue 2 years ago • 3 comments

Does this feature exist in Emacs orgmode core?

N/A

Orgmode link

Is there any function that can be called to realign tags to the defined margin? When manually adding tags by just typing the keywords :TAG1:TAG2: or the like it's cumbersome to align them with the other tags. Would be great if there would be an easy way to realign tags in a document or marked area.

Feature value

Ease of use and better visuals

Additional context

No response

tott avatar Aug 09 '22 10:08 tott

I started working on this (twice), but I have not yet decided how it would work. Every time a tag is added via the corresponding mapping? On every save of the buffer? Will it affect the whole buffer or just the current tree the cursor is at?

Your suggestion sounds viable as well, have not thought about it. However, it does not respect heading-tree boundaries. Not sure if that makes things tricky, just wanted to mention it. While explicitly marking the affected area will prevent unnecessary checking of tags that are already aligned, I personally think it's a bit cumbersome.

We should find out if and how Emacs orgmode handles this, before we take any further steps.

jgollenz avatar Aug 09 '22 16:08 jgollenz

That was a quick one:

When called with a C-u prefix, all tags in the current buffer are aligned to that column, just to make things look nice. 
Tags are automatically realigned after promotion, demotion, and TODO state changes

(source)

jgollenz avatar Aug 09 '22 16:08 jgollenz

That sounds like a perfectly viable approach to me.

tott avatar Aug 09 '22 20:08 tott

I'll start working on this

jgollenz avatar Sep 13 '22 21:09 jgollenz

@tott this should now work. Thanks @kristijanhusak :slightly_smiling_face:

jgollenz avatar Sep 17 '22 10:09 jgollenz

Here are some docs about this: https://github.com/nvim-orgmode/orgmode/blob/master/DOCS.md#formatting

kristijanhusak avatar Sep 17 '22 13:09 kristijanhusak

Love it - works like a charm. Thanks!

tott avatar Sep 19 '22 14:09 tott