From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com> To: Juri Linkov <juri@linkov.net> Cc: Org Mode list <emacs-orgmode@gnu.org>, Emacs developers <emacs-devel@gnu.org> Subject: Re: Reconciling org-mode idiosyncrasies with Emacs core Date: Mon, 04 May 2020 18:14:54 +0200 Message-ID: <87ftcfekxt.fsf@gmail.com> (raw) In-Reply-To: <874ksv4uv1.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Mon, 04 May 2020 16:50:42 +0200") Nicolas Goaziou <mail@nicolasgoaziou.fr> writes: > 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. Thanks for the pointer! (I forgot to mention that AFAICT, all current tests pass with this patch.) >> - 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 > `electric-newline-and-maybe-indent'. Nope; took me some time to piece everything together, but the logic (as of 24.4) seems to be - RET runs `newline': if electric-indent-mode is disabled, then it's a dumb newline, otherwise electric-indent-post-self-insert-function kicks in *if run interactively*; - C-j runs `electric-newline-and-maybe-indent': it's meant to be the "smart newline" command when electric-indent-mode is disabled, otherwise it shrugs and just inserts a newline. >> 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? The "list-item" case currently calls `newline-and-indent' unconditionally, because the condition for that cond branch starts with (and indent …). Therefore, to make this case work with electric-indent-mode, I had to tweak the condition; I just wanted to bring attention to this change, since it was not as "mechanical" as for the "at-headline" and "default" branches. > 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. Right. Org master it is, then. >> 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. Alright. I'll try to follow-up with this additional command, tests, and changelog/news entries in the next few days. Thank you for the review!
next prev parent reply other threads:[~2020-05-04 16:51 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CADwFkm=qkNCWA40ieZ9Dv-gbk6xAzjG16sOa64GT+Zbv9pCC_A@mail.gmail.com> [not found] ` <20200426172206.GC18629@ACM> [not found] ` <87y2qhnc9a.fsf@gmail.com> [not found] ` <20200427102311.GA4976@ACM> [not found] ` <87mu6xtano.fsf@gmail.com> [not found] ` <87k120ohsq.fsf@mail.linkov.net> [not found] ` <87blnbir01.fsf@nicolasgoaziou.fr> [not found] ` <87o8rbmbfa.fsf@mail.linkov.net> [not found] ` <87k11yftqo.fsf@nicolasgoaziou.fr> [not found] ` <87pnbqo74t.fsf_-_@gmail.com> 2020-04-29 12:30 ` Nicolas Goaziou 2020-05-04 10:45 ` Kévin Le Gouguec 2020-05-04 14:50 ` Nicolas Goaziou 2020-05-04 16:14 ` Kévin Le Gouguec [this message] 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: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://orgmode.org * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87ftcfekxt.fsf@gmail.com \ --to=kevin.legouguec@gmail.com \ --cc=emacs-devel@gnu.org \ --cc=emacs-orgmode@gnu.org \ --cc=juri@linkov.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * 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 https://orgmode.org/list/0 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/ https://orgmode.org/list \ emacs-orgmode@gnu.org public-inbox-index list Example config snippet for mirrors. Newsgroups are available over NNTP: nntp://news.yhetil.org/yhetil.emacs.orgmode nntp://news.gmane.io/gmane.emacs.orgmode AGPL code for this site: git clone https://public-inbox.org/public-inbox.git