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:45:33 +0200 Message-ID: <87368br8wi.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> 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="105315"; 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:46:07 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 1jWjex-000RIn-Nq for geo-emacs-orgmode@m.gmane-mx.org; Thu, 07 May 2020 18:46:07 +0200 Original-Received: from localhost ([::1]:46530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jWjew-0005uP-NJ for geo-emacs-orgmode@m.gmane-mx.org; Thu, 07 May 2020 12:46:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWjeW-0005tt-Vi; Thu, 07 May 2020 12:45:41 -0400 Original-Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:34210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jWjeT-0002yN-Sz; Thu, 07 May 2020 12:45:40 -0400 Original-Received: by mail-wr1-x443.google.com with SMTP id y3so7242930wrt.1; Thu, 07 May 2020 09:45:37 -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=HvB7Rs1g+n05flQNsWy5xQnZE9890fQgewAx0kv1Fig=; b=A95JkM2oNkmFdbXT1B8M37Li67Wb9VSWFPT9HRmnXjB/G/AV8yIOTpbQjZx6T0cNAG oo9IxY4YdkYsSMiMWPcIRUYhiFrc7kWUuxHRHYV9Z7Ts3lEQFDPYXAfIMh2/JDKJpaJ1 m/Lh3VOhbZLuWRA4WKLrGWRXqcj31wUE9cJu2SgI+4VyzWbyhfmJLRAP5EfwMpgTKiRS gH2YFBDxWMJQfS5miZSSRI+iywVlkUk06grxeDs4swqN3vhQW3+o4aiYBlz8qliP6bzx AaqQCRAno2WZCdNl3b7jle0gr2VKnjyak3ZJ88GzLQyyvRhJkBOHNMUaLyCDN+cGQXMD n1zQ== 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=HvB7Rs1g+n05flQNsWy5xQnZE9890fQgewAx0kv1Fig=; b=KFhImNbniqdV/GKod7OoeU6JnnR9EzjIchZi/ebiyElGeFWTE+CRshAYPmzAKCg3Fj V1eJnH3ofNHDW5WbcyS2N6kSXGFJDv6yijwLCJ/YL/XMAtDKBecp2pV8IAVYHYN9XTx+ TfzaQ0mCKbdIgKl0BDiBqr1G/CAYNV2UPMjlaFTNUTRilMcP2z7vQDbG3QkuUTqNIBGC ckZP8VGuq0ADuKt9K74UdW3owu9fQRozCrVMYjD4MvDX66t1hsAZ6Bgv19hUQqiAdDE9 oXtKge7rZpUTc7qlWM7HkTd+WK//qkouzmnus7swjypxO9Sk2qa9v4OJ7tTsJHjtTl6R 0cAA== X-Gm-Message-State: AGi0PuaZsYSVp7Wh0OJWAHujKUpiY6Yn43pLvpZZPkenBsTeCIkYCyuP 5hCPRdLgqkAEZqeLzz3GmFuECp0YCsJrIg== X-Google-Smtp-Source: APiQypJijsbtyHsH+BRoANGaALGGWKxCnKcX81azBcTcdkahRk5ab0Qlg145s5Ykd1hgNcUprxNgfQ== X-Received: by 2002:adf:a74b:: with SMTP id e11mr15093433wrd.99.1588869935712; Thu, 07 May 2020 09:45:35 -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 t4sm4028501wmf.33.2020.05.07.09.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 09:45:34 -0700 (PDT) In-Reply-To: <874kss9bqx.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of "Thu, 07 May 2020 14:21:26 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=kevin.legouguec@gmail.com; helo=mail-wr1-x443.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, URIBL_BLOCKED=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:128908 gmane.emacs.devel:249190 Archived-At: --=-=-= Content-Type: text/plain Nicolas Goaziou writes: > AFAICT, `newline-and-indent' doesn't accept any argument. Keeping it > introduces a build warning and test failures. Hence the removal. > > Since you were calling it with an argument I assume this may be > a novelty in Emacs 27. Wow, you're right. That caught me off-guard. > However Org still supports Emacs 24.4. If that's > the case, we need an additional compatibility layer to support both > cases. WDYT? I don't know if we want to jump through these hoops for a feature that people have done without so far? FWIW though, the following patch seems to work ("make test" works with both 26.3 and 28.0 on my end): --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=newline-and-indent-compat.patch diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 2b35535fa..ed12b9d18 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -102,6 +102,11 @@ is nil)." (defun org-time-convert-to-list (time) (seconds-to-time (float-time time)))) +(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..57e78599f 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) --=-=-= Content-Type: text/plain (I hope I got that right.) > Meanwhile, I fixed the docstring. Thanks! And thanks again. --=-=-=--