this post was submitted on 27 Nov 2023
1 points (100.0% liked)

Emacs

313 readers
3 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

Just found a quick way to have tags always right aligned, taking advantage of font-lock and display property.

(add-to-list 'font-lock-extra-managed-props 'display)
(font-lock-add-keywords 'org-mode
  `(("^.*?\\( \\)\\(:[[:alnum:]_@#%:]+:\\)$"
     (1 `(face nil
          display (space :align-to (- right ,(length (match-string 2)) 3)))
        prepend))) t)
you are viewing a single comment's thread
view the rest of the comments
[–] Nicolas-Rougier@alien.top 1 points 11 months ago (2 children)

Weird since the regex includes a space before the first ":". As for multitag, it is working properly for me.

[–] whudwl@alien.top 1 points 11 months ago

AHH. I see, my :PROPERTIES: is not indented. my org-adapt-indentation is set to nil.

[–] llcc_reddit@alien.top 1 points 11 months ago (1 children)

I found out that it's the non-English characters in tags that trigger the bug.

[–] Nicolas-Rougier@alien.top 1 points 11 months ago

Nice. And since org-string-width can return pixel width, it might adapted to proportional font as well.