Jean Louis <bugs@gnu.support> writes: > Indentation in fundamental mode: > > ** HereRET > I come here. > But only if I start indenting > Like hereRET > Then I continue here
Hi Jean, My understanding of electric-indent-mode is that it tries to make "RET" equivalent to "insert newline; indent according to major mode rules". E.g. in c-mode, when point is after the brace: if (condition) { RET will move point to column 2, while C-j will just insert a newline and stay at column 0. Likewise in python-mode, when point is after the colon: def foobar(): RET will insert a newline and move point to column 4; C-j will stay at column 0. Your counter-example in fundamental-mode only shows that there are no "smart indentation" rules in this mode; hitting TAB more than once keeps on inserting horizontal space unconditionally instead of snapping to the "correct" indentation level. I've used Emacs's programming language modes for years before finally trying out Org, where I noticed that the keys were swapped: RET was the "plain dumb newline" key, and C-j was the "smart newline-then-indent" key. IIUC this was how the rest of Emacs behaved before electric-indent-mode became enabled by default. I personally found the difference infuriating. Everywhere else in Emacs, - C-m and <Return> do smart indentation, - C-j ≡ ^J ≡ (insert "\N{LINE FEED (LF)}") The changes in Org 9.4 aimed to make Org consistent with this "new" convention, so that hitting RET immediately indents paragraphs below a heading (as if the user hit TAB right after inserting a newline), and a user wishing to "just insert some vertical space" can just whale on C-j. FWIW, what I wonder about is /why/ Org hard-indents section bodies by default (org-indent-mode, which I use, soft-indents instead using overlays). IIUC this can be toggled off by setting org-adapt-indentation to nil; FWIW this is what the .dir-locals.el file at the root of Org's repository does… I haven't read this whole thread thoroughly; I've had trouble staying on top of Emacs's mailing lists this week. Apologies if I've missed something, and thanks for your patience.