From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= Newsgroups: gmane.emacs.orgmode,gmane.emacs.devel Subject: Re: [PATCH] Make RET and C-j obey `electric-indent-mode' in org-mode Date: Thu, 07 May 2020 18:50:30 +0200 Message-ID: <87v9l7pu3t.fsf@gmail.com> References: <20200426172206.GC18629@ACM> <87y2qhnc9a.fsf@gmail.com> <20200427102311.GA4976@ACM> <87mu6xtano.fsf@gmail.com> <87k120ohsq.fsf@mail.linkov.net> <87blnbir01.fsf@nicolasgoaziou.fr> <87o8rbmbfa.fsf@mail.linkov.net> <87k11yftqo.fsf@nicolasgoaziou.fr> <87pnbqo74t.fsf_-_@gmail.com> <87ees6fp8r.fsf@nicolasgoaziou.fr> <87y2q89dx7.fsf@gmail.com> <874ksv4uv1.fsf@nicolasgoaziou.fr> <87ftcfekxt.fsf@gmail.com> <877dxpazbo.fsf_-_@gmail.com> <87ftcc9g27.fsf@nicolasgoaziou.fr> <87wo5ogdfl.fsf@gmail.com> <874kss9bqx.fsf@nicolasgoaziou.fr> <87368br8wi.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="128049"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Emacs developers To: Org Mode list Original-X-From: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Thu May 07 18:51:04 2020 Return-path: Envelope-to: geo-emacs-orgmode@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jWjjj-000XCd-N3 for geo-emacs-orgmode@m.gmane-mx.org; Thu, 07 May 2020 18:51:03 +0200 Original-Received: from localhost ([::1]:52020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWjji-0000Zq-P0 for geo-emacs-orgmode@m.gmane-mx.org; Thu, 07 May 2020 12:51:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWjjG-0000Yh-Kc; Thu, 07 May 2020 12:50:34 -0400 Original-Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:44904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jWjjF-0006lh-N8; Thu, 07 May 2020 12:50:34 -0400 Original-Received: by mail-wr1-x444.google.com with SMTP id y4so7209502wrm.11; Thu, 07 May 2020 09:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=dPT0xlgrMci3ajJBE8F+WYdetl5fl6Xu9GLWF9c3f0M=; b=T+K9ZYFi1rvKbiwCblWDgRj2QE6mNF7z9ehlKu8/iHI72TWgHdJmzwb7LkhmgYbffh /0z5C6d/CUZyic2cfgogS0Gs5eaAR2GgeMPySPlNOxBJq8DgPmG6A5qBxB8cjH4xFIzs UF2G8U2CmnWBiRWvhHdiX7J+QATHdni2GMrRAx2mZPP+SBt10S+37SiZPZV5A+XWxkwp LPBA3CwtnYFz7DVr1sEipjCni+BaYwunJYHvgvixrYZjEN1vKUcj75RUQm9ThEKNf7A6 ldOPArObkhwrkOkKfBryxeeuyE20F4KIS/2P+RzKCY6Sti15aard00x+QdEf19RGMPnh TW7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=dPT0xlgrMci3ajJBE8F+WYdetl5fl6Xu9GLWF9c3f0M=; b=XtRpL4LO2sy6LuLMnRIp5hhsjXBmKHYdlDXUzzHROqEtaaKfMPvj6lmvmzvJd5r7Gc fH1NZBtWa4wh0/ot1xhKZeKuEU0LTBsoNZKt5l0dvKjqCMSDgtx1BakMXGmIRklGjEQk 3DQByoz8zZUI5jsUV/W1n2EwAw/4nUTCuPjnNkiWp0s5/slzJOYC9nwAppL1JOZ9IrIt x4bAcw5wPmSpVl9zf8hgtBNzGcT7WgXI8MFU6ERLm7iIQQZPoDtnhoqoaPMQxnsveAaW 5dDiPzCli+FIgPMGrmfREddIQs6A8b/EsFWDvVRHxij7h0VtXIIv6eGNfFiISw9rUcaq THkA== X-Gm-Message-State: AGi0PuaJs3FYJtqIN9JVQ1h0qkC0N0y13IdaHlzhJmuLCllEA0uv84RV QRVFAr6L5gnOUucPeA2LuYOfGKauTabrwQ== X-Google-Smtp-Source: APiQypJX9DNQD+CqZqknl1aDNjEkZ4iby4J027ixEGGyOwHZSHdxbcMY9IV38kD4EQFuaWO2HDYy6A== X-Received: by 2002:adf:bc41:: with SMTP id a1mr7526124wrh.302.1588870231750; Thu, 07 May 2020 09:50:31 -0700 (PDT) Original-Received: from my-little-tumbleweed (200.143.13.109.rev.sfr.net. [109.13.143.200]) by smtp.gmail.com with ESMTPSA id q184sm8971298wma.25.2020.05.07.09.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 09:50:31 -0700 (PDT) In-Reply-To: <87368br8wi.fsf@gmail.com> (=?utf-8?Q?=22K=C3=A9vin?= Le Gouguec"'s message of "Thu, 07 May 2020 18:45:33 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=kevin.legouguec@gmail.com; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-orgmode" Xref: news.gmane.io gmane.emacs.orgmode:128909 gmane.emacs.devel:249191 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable K=C3=A9vin Le Gouguec writes: > (I hope I got that right.) Except I forgot the explanatory comment, and I left a typo in the docstring. Ahem. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 2b35535fa..caaf5ce58 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -102,6 +102,12 @@ is nil)." (defun org-time-convert-to-list (time) (seconds-to-time (float-time time)))) +;; `newline-and-indent' did not take a numeric argument before 27.1. +(if (version< emacs-version "27") + (defsubst org-newline-and-indent (&optional _arg) + (newline-and-indent)) + (defalias 'org-newline-and-indent #'newline-and-indent)) + ;;; Emacs < 26.1 compatibility diff --git a/lisp/org.el b/lisp/org.el index 8ad437a20..142bfb999 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17649,12 +17649,12 @@ call `open-line' on the very first character." (defun org--newline (indent arg interactive) "Call `newline-and-indent' or just `newline'. -If INDENT is non-nil, call `newline-and-indent' to indent -unconditionally; otherwise, call `newline' with ARG and -INTERACTIVE, which can trigger indentation if +If INDENT is non-nil, call `newline-and-indent' with ARG (if +supported) to indent unconditionally; otherwise, call `newline' +with ARG and INTERACTIVE, which can trigger indentation if `electric-indent-mode' is enabled." (if indent - (newline-and-indent) + (org-newline-and-indent arg) (newline arg interactive))) (defun org-return (&optional indent arg interactive) --=-=-=--