Hammer Hu <ham...@posteo.net> writes:

> Please change bug.el to
>
> (add-hook 'org-mode-hook #'org-modern-mode)
> (setq-default org-adapt-indentation t)
>
> Select the region and M-x indent-region <RET> multiple times.

Thanks!

A simpler reproducer:

1. /tmp/bug.org

#+begin_quote
foo
#+end_quote

2. emacs -Q -L /path/to/compat/ -L /path/to/org-modern/ -l compat -l org-modern 
/tmp/bug.org

3. M-x org-modern-mode

4. Move to the beginning of #+begin_quote line

5. M-: (indent-line-to 3) <RET>
6. M-: (indent-line-to 3) <RET>
7. <can repeat>

8. M-x org-modern-mode
9. Observe overindentation

The reason why this happens is the following:

1. indent-line-to tries hard to create indentation and move the
   beginning of visible text to column 3.
2. indent-line-to notices (at point (5)) that line is not indented at
   all.
3. It computes that it should insert "   " to indent to column 3 and
   inserts these spaces.
4. org-modern-mode notices modification and re-hides spaces
5. indent-line-to is fires one more time at point (6)
6. indent-line-to notices that line is indented, but the leading
   whitespace is invisible.
7. It computes that it should yet insert extra "    " to move the text
   to column 3 visually (because the existing spaces are hidden).
8. It inserts the extra spaces
9. org-modern-mode notices modification and re-hides added spaces.

I believe that it is org-modern's fault. Indentation works are it
supposed to and tried hard to align text visually to third column.
org-modern fights against.

Note that indenting visually is Emacs' convention that applies
everywhere.

Canceled.
Not an Org mode bug.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to