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)
  • Nicolas-Rougier@alien.top
    cake
    OPB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

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

    • whudwl@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

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

      • Nicolas-Rougier@alien.top
        cake
        OPB
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

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