Subject: Re: bug#51459: 29.0.50; org-return and org-return-and-maybe-indent

From: Kévin Le Gouguec <[email-masked]>
Date: Thu, 28 Oct 2021 15:40:33 +0200

Andreas Röhler <[email-masked]> writes:

> When in init-file
>
> (add-hook 'org-mode-hook (lambda () (electric-indent-mode -1)))
> (setq org-adapt-indentation t)
>
> C-j would indent.
>
> However, IMO doesn't make sense to require these extra config in order
> to get a reasonable behavior.

And everything hinges on what one finds "reasonable".

As discussed in bug#51167, in the wake of electric-indent-mode being
honored in Org 9.4, plenty of people have come to emacs-orgmode to
express that they did not expect RET to indent.  Thus Org maintainers
chose to change the default value of org-adapt-indentation for Org 9.5.

Note that by default (electric-indent-mode t, org-adapt-indentation nil)
RET *does* indent in some specific scenarios, e.g. "- list item RET"
will indent (resp. with electric-indent-mode nil, "- list item C-j"),
because Org assumes that you want to add a paragraph to your list item.

To recap:

- electric-indent-mode is enabled by default in Org, as it is globally
  in Emacs: hence RET indents, C-j does not.

- org-adapt-indentation tells Org whether you want your documents to be
  hard-indented or not: starting with 9.5, they won't be by default.

> When calling C-u RET, get "org--newline: Wrong type argument:
> number-or-marker-p, (4)"

That does look like a bug, however.