deprecated's answer is very good, but it didn't quite work for me. I'm currently on Emacs 24.4 and org 8.2.4, and advising org-indent-initialize
didn't do anything. I had to redefine the function with the changed indent character, and that worked. Maybe when I upgrade to Emacs 24.5 and org 8.3 the advising will work.
But I also had to make a few other adjustments, because I use different size variable-width fonts for different heading levels, which means that a level-1 heading's *
is not the same width as a level-2's, and so on.
So I also had to do this:
- Set the faces
org-hide
(used to indent headline lines) and org-indent
(used to indent non-headline lines) to make sure they use the same font at the same size.
- Set the variable
org-indent-boundary-character
to *
instead of the default
(a space). This is the character that is inserted after the indentation characters but before the content. I'm not sure if changing this is a necessity, but it seems to help consistency. It might depend on the font you're using, sizes, etc.
Doing those things in addition to making the change to org-indent-initialize
as deprecated provided seems to have done it. I end up with a buffer looking like this:
You can see that, as the headline level goes down, the indentation doesn't line up perfectly with the heading text. I think that's because of using smaller fonts for lower-level headings, and I don't think there's an easy way to fix that. It might be possible to do something with text-properties like line-prefix
and wrap-prefix
, because those can be set to images and special characters, but that would probably be complicated and slow. If you use the same font size for all heading levels, this probably won't be an issue.
Anyway, this is probably good enough. :)
P.S. As requested, here are my org-level
faces. These are copied from custom-set-faces
, but if you don't use customize
you can set them outside of it.
'(org-level-1 ((t (:inherit variable-pitch :foreground "#cb4b16" :weight bold :height 1.3))))
'(org-level-2 ((t (:inherit variable-pitch :foreground "#859900" :weight bold :height 1.2))))
'(org-level-3 ((t (:inherit variable-pitch :foreground "#268bd2" :weight bold :height 1.15))))
'(org-level-4 ((t (:inherit variable-pitch :foreground "#b58900" :weight bold :height 1.1))))
'(org-level-5 ((t (:inherit variable-pitch :foreground "#2aa198" :weight bold))))
'(org-level-6 ((t (:inherit variable-pitch :foreground "#6c71c4" :weight bold))))
'(org-level-7 ((t (:inherit variable-pitch :foreground "#d33682" :weight bold))))
'(org-level-8 ((t (:inherit variable-pitch :foreground "#dc322f" :weight bold))))
org-indent
are not really there, they are justline-prefix
properties, so they can be replaced by any other character so long as it is invisible.SPC
chars but with text (or overlay) property that imposes a face that (by default) has a monospaced font. Maybe an Org enhancement request is in order. ;-)