I use Emacs 27.2 and Org 9.4.6. Since a very recent update of Org, I noticed a strange change in the behavior of indentation. In my init file, I have set the variable org-adapt-indentation to 'headline-data; and I don't use org-indent-mode. Here is the (new?) behavior I noticed:

  1. Type some text which does not follow an empty line an hit TAB: nothing happens (which is the expected behavior).

  2. Type some text which does follow an empty line an hit TAB: this text gets indented according to the current headline level (why?).

Point 2. has an unpleasant side effect: when you still use the old template expansion mechanism for code blocks (the one provided by org-tempo.el, e.g. type <s and then hit TAB to expand a full source code block), those code blocks now get indented according to the headline level (because of TAB, I guess), which I'm sure was not the case until a very recent change.

A little screenshot to illustrate that: enter image description here

The Org documentation for org-adapt-indentation looks unclear to me, and I'm pretty sure that typing <s TAB triggers both the template expansion and the (unwanted) code block indentation is not the expected behavior.

Is it a bug, or am I missing something?

  • 1
    I don't know the answer, but I really liked the screenshot animation you illustrated your question with. Would you mind sharing how you did it?
    – nohans
    Commented Jul 5, 2021 at 15:33
  • 4
    It was recorded as an animated gif with Peek (github.com/phw/peek), and the keys were captured with Screenkey (gitlab.com/screenkey/screenkey)
    – Philopolis
    Commented Jul 6, 2021 at 8:49
  • 2
    I have the same bug with emacs 28.0.50 and org 9.4.6. An other reference for the supposed behavior of org-adapt-identation is the org-mode FAQ. Somebody, may be you, asked the question in org-mode mailing list. It is unanswered as far as today.
    – marcz
    Commented Jul 18, 2021 at 20:44
  • It's me, yep! ;-) Since then, I found other references to that, and some folks say that it's the expected behavior (which does not sounds very logical to me, and not even in accordance with the docstring). For instance: emacs.stackexchange.com/questions/55413/…
    – Philopolis
    Commented Jul 20, 2021 at 4:27


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.