A small experiment to play with pixelwise centering of org-headings in a buffer. OBS: this is just an experiment, the purpose is not to propose a final product, but just to illustrate an idea.
It means there are probably lots of places where it will break. I have put it together just as a small demo, to showcase it is possible to do text alignement in Emacs. With other words, this is not an application to use on every day basis.
There is a small video showing how it works in practice:
Either clone this repo or just download ‘org-cebter-headings.el’.
Put org-center-headings.el somewhere in Emacs load-path. From there you have option to either:
M-x package-install-file RET org-center-headings.el RET
or just require file in your init file somewhere.
Really none, should be compatible with Emacs 22.1 but package.el does not recognize requirements older than Emacs 24.1.
Place cursor on a line with org-heading and type
M-x org-center-headings-center
to center a heading, or
M-x org-center-headings-remove-centering
to remove the center alignement.
This introduces also experimental formatting string for headings: ‘<>’ (without quotes). It should be placed after space that follows leading stars in a heading. The string is used together with a minor mode org-center-headings-mode to control wich headings will be centered. Alternatively it is possible to bypass the format string and center all headings in a buffer by setting value of:
org-center-headings-formatted-only
to nil.
As a small plus, there is also a minor mode to hide the format string used to center headings.
GPL v3. For details, see the atached license file.