Hello,

I'm using font lock to have tags right aligned with the following code:

;; Right alignment (char wise)
(add-to-list 'font-lock-extra-managed-props 'display)
(font-lock-add-keywords 'org-mode
 `(("^\\*+.*?\\( \\)\\(:[[:alnum:]_@#%:]+:\\)$"
    (1 `(face nil
              display (space :align-to (- right 3
,(org-string-width (match-string 2)))))
       prepend))) t)

;; Right alignment (pixel wise)
;;(font-lock-add-keywords 'org-mode
;;   `(("^\\*+.*?\\( \\)\\(:[[:alnum:]_@#%:]+:\\)$"
;;      (1 `(face nil
;;                display (space :align-to (- right 3
;; (,(org-string-width (match-string 2) t)))))
;;         prepend))) t)

I've not tested it thoroughly but it seems to be working reasonably well on my machine. It is pretty similar to the code posted by Ihor Radchenko (thread on "variable-pitch-mode misaligns org-mode heading tags") and I wonder if there are any drawback with such techniques (too slow? does not work on all situations?)

Nicolas

--
Nicolas P. Rougier —— www.labri.fr/perso/nrougier
Institute of Neurodegenerative Diseases, Bordeaux

Reply via email to