How can one enable org-indent-mode
(or otherwise indent content to Org headings) while still maintaining a consistent visual fill column?
Asked
Active
Viewed 258 times
3

Matthew Piziak
- 5,958
- 3
- 29
- 77
-
Does this still happen? I tried replicating this in 2022 with org-mode + org-indent-mode + visual-fill-column-mode, and I didn't see the undesired overflow. – g-gundam Oct 15 '22 at 16:17
-
@g-gundam This happens for me in Org 9.5.5 on Emacs 28.1. – Matthew Piziak Oct 15 '22 at 23:56
2 Answers
0
One way of achieving this behavior is to disable org-indent-mode
and set org-adapt-indentation
to t
. The side effect of this configuration is that spaces will be added to Org file, where org-indent-mode
only acts at render time.

Matthew Piziak
- 5,958
- 3
- 29
- 77
0
The only way I found to do this is by overriding the function that returns the fill column.
(defun current-fill-column ()
"Return the fill-column to use for this line.
Subtracts right margin and org indentation level from fill-column"
(let ((indent-level (if (bound-and-true-p org-indent-mode)
(* org-indent-indentation-per-level
(org-current-level))
0))
(margin (or (get-text-property (point) 'right-margin) 0)))
(- fill-column indent-level margin)))
This probably misses some edge cases, since the original function is more complex, but this is working for my purposes so far.