Org-mode mailing list
 help / color / mirror / Atom feed
From: Nicolas Goaziou <>
To: "Kévin Le Gouguec" <>
Cc: Emacs developers <>,
	Org Mode list <>,
	Juri Linkov <>
Subject: Re: Reconciling org-mode idiosyncrasies with Emacs core
Date: Mon, 04 May 2020 16:50:42 +0200
Message-ID: <> (raw)
In-Reply-To: <> (=?utf-8?Q?=22K=C3=A9vin?= Le Gouguec"'s message of "Mon, 04 May 2020 12:45:24 +0200")


Kévin Le Gouguec <> writes:

> I took a stab at making RET obey electric-indent-mode in org-mode.

Thank you!

> I've got something working; I'd like to ask for a review before moving
> on to Changelog and ORG-NEWS entries (and tackling C-j… and maybe
> writing a few unit tests?).

Tests for `org-return' (named "test-org/return") are in the
"test-org.el" file in the "testing/lisp" directory. We only need to test
if electric-indent-mode has an effect, but only in regular cases.

> Here's the patch, with some additional comments below:

It looks good.

> - INTERACTIVE is what makes 'newline' run 'post-self-insert-hook' (thus
>   triggering indentation through electric-indent-mode),

OK. I thought it was necessary to call

> - ARG wasn't strictly necessary, but it seemed harmless to add it, and
>   it allows inserting multiple newlines, thus removing one more "Org
>   idiosyncrasy".

Good idea.

> I felt that introducing org--newline made the code clearer, but I can
> understand if it seems too trivial to keep.

No, that's fine.

> I took the liberty of using
> this function in the "list item" case too, otherwise there's no way to
> indent the trailing text.

I'm not sure what you mean. It would be a regression if you didn't use
the function there, too, wouldn't it?

> (Out of curiosity, could it be argued that this is solving a "bug" in
> org-mode and, as such, could be committed to Emacs core first, then
> backported to the org-mode repository?  I don't feel strongly either
> way, I wouldn't want to make things more complicated for Org
> maintainers.)

I cannot speak for the Emacs side, but it should land in Org 9.4, not
Org 9.3.6.

It is a very visible change, one that every Org user is going to face.
This requires a new ORG-NEWS entry. Those only appear in new minor+
releases. Therefore, if you apply it in Emacs 27.1, the change will be
announced nowhere.

> Now for C-j, in order to minimize breakage (for anyone calling
> org-return-indent from Lisp code) and simplify disabling the new
> behaviour (by simply turning off electric-indent-mode in Org), should we
> bind C-j to a new function?  E.g.:
> (defun org-return-and-maybe-indent ()
>   (interactive)
>   (org-return (not electric-indent-mode)))

I think so. Then we can mark `org-return-indent' as obsolete and suggest
to call `org-return' instead.


Nicolas Goaziou

  reply	other threads:[~2020-05-04 15:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
     [not found] ` <20200426172206.GC18629@ACM>
     [not found]   ` <>
     [not found]     ` <20200427102311.GA4976@ACM>
     [not found]       ` <>
     [not found]         ` <>
     [not found]           ` <>
     [not found]             ` <>
     [not found]               ` <>
     [not found]                 ` <>
2020-04-29 12:30                   ` Nicolas Goaziou
2020-05-04 10:45                     ` Kévin Le Gouguec
2020-05-04 14:50                       ` Nicolas Goaziou [this message]
2020-05-04 16:14                         ` Kévin Le Gouguec
2020-05-06 14:54                           ` [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode (was: Reconciling org-mode idiosyncrasies with Emacs core) Kévin Le Gouguec
2020-05-07 10:48                             ` [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode Nicolas Goaziou
2020-05-07 12:03                               ` Kévin Le Gouguec
2020-05-07 12:21                                 ` Nicolas Goaziou
2020-05-07 16:45                                   ` Kévin Le Gouguec
2020-05-07 16:50                                     ` Kévin Le Gouguec
2020-05-07 19:38                                       ` Nicolas Goaziou
2020-05-24  6:25                                         ` Bastien
2020-05-07 13:53                             ` Stefan Monnier
2020-05-07 15:33                               ` Kévin Le Gouguec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ \
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:

AGPL code for this site: git clone