From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WHIKMFgxomB4gQEAgWs5BA (envelope-from ) for ; Mon, 17 May 2021 11:03:20 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sJmjK1gxomArYAAAbx9fmQ (envelope-from ) for ; Mon, 17 May 2021 09:03:20 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0696B1B344 for ; Mon, 17 May 2021 11:03:20 +0200 (CEST) Received: from localhost ([::1]:57752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1liZ9i-0002UF-6i for larch@yhetil.org; Mon, 17 May 2021 05:03:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liZ9L-0002U6-Al for emacs-orgmode@gnu.org; Mon, 17 May 2021 05:02:55 -0400 Received: from mout02.posteo.de ([185.67.36.66]:44659) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1liZ9H-0004eS-82 for emacs-orgmode@gnu.org; Mon, 17 May 2021 05:02:55 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 01311240100 for ; Mon, 17 May 2021 11:02:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.eu; s=2017; t=1621242169; bh=y6GoiAUCqNpdFCMq9plRLzcVPdPh8PVHMRY79lbkcbQ=; h=Subject:To:Cc:From:Date:From; b=lLJut423xAeUH/k3cENmFId3HpbauuTkL5a+wrDAVH+EYXFS9h1c45epiGfce1T/6 O5A8Xpq6RWt87Tnios6ml2Xv/lJaB5rzImJQR1uUoiOeLAkyb/Zt8a0jscXOLWV9Pv /tCHHFBP/TuluqhIgSayhfhjH6tNg3djddQQZrCpp4+tO1xPDhgxxcoJdM3M6bYpnV EYLeP/h6Y2itsLpD4eae0cozJBcVS2mWWIO6zp4gv8Xsfx0M2CdsjulYiWe9z+2pDp 4X+UNz/LZSnRilJaMVwUWocOYK6LNqD73bMBcutZQlYdjneZI1g81aXHLbZIWsvgWh s+qt+dhfGmrCg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FkCp02VK6z9rxG; Mon, 17 May 2021 11:02:48 +0200 (CEST) Subject: Re: begin_src Indentation in org 9.4.4, 9.4.5 To: Bastien References: <5DCBAF63-0E88-44AC-B892-1260F37E7E00@manicmind.earth> <36FAF062-87B9-4023-B354-6358E42F87CB@manicmind.earth> <7EFD6F4A-1BCF-4576-B115-3FE42D9C2552@manicmind.earth> <87fsyyars4.fsf@localhost> <87zgwwfc7f.fsf@gnu.org> From: =?UTF-8?Q?S=c3=a9bastien_Miquel?= Message-ID: <6da18e3f-08a1-1ab6-93c7-6243c685a55f@posteo.eu> Date: Mon, 17 May 2021 09:02:47 +0000 MIME-Version: 1.0 In-Reply-To: <87zgwwfc7f.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: fr Received-SPF: pass client-ip=185.67.36.66; envelope-from=sebastien.miquel@posteo.eu; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: , Reply-To: sebastien.miquel@posteo.eu Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1621242200; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=CT/eMeW3IuZxpnbNl9Rx03tHbrRmiQ3gMmt4HE1f4/0=; b=Ubz+7zMUF9oejYzv7Pj5G/yJHJWvdNZExjfYjwc5DwEjlzMizITI47UZKS+c4KIihJFo0c xxj48ZC1giFFi+Y0eWCCr9CQm9Aj/l5jCf7dZj4J/WCpO1YdKI8vWcov3cfq9Qr+3dUnLr F7PGyXrd3JIrrmKyGIenrg6ed51M62wk1RGaWbvrujYSfK4ASk5hNlqDUwajlBo7fGIbYG uouwqgIi57TD26kJz9KKDeeE63owdj12PMfLvEWQA2I12HpN4XJhraG/uJlYLg/0u5GGRW e3/EhMiVRwfIaqJEO7mpLHWMHw55/f3HWJmHv71hzl9bbU5Pj4cbrbMtW1EWKA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1621242200; a=rsa-sha256; cv=none; b=MARAuo1rbRyzEVJtdXHXfew/oPFSBNKJof4f1d8hfJdcir6HNrNe5JjBzYoCL9VpjQOIKs ayLIyOxXtJTDDQDn8lMlSOAVsW2YNTI0gow0CieaRbPA4B9Y0I4s+fZMCYjE0PE+E7BNYP vSQ1AspKLRHU4EAy0jAZgMj9sW4X4lXO6oJa35u6sQTGEFCRQB1g/QeHXZ9dfgMIegJivj S6agDM/GzVrgv3IpJylUa/2uCs+KSz0TYP9wpGcf6/j2dSgtNFa73/FgNU/BxGixM877Ux TyigiCWTUVqCW9BeJN3cqjvh6xCDKPlzuXNIJDd3ly1h6I5WqRhODMqNz7dcmg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=lLJut423; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=lLJut423; dmarc=pass (policy=none) header.from=posteo.eu; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 0696B1B344 X-Spam-Score: -1.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: oqp+ROrSylgb Hi Bastien, The commit `bfda3cc7df31fa79222efb4c190618c3c85a3d04` breaks automatic (electric) indentation  in src blocks for all configurations. Here's what happens with the original issue. When you press `RET` after the first ~hello hi~, the result is that the first line is indented by two spaces, and the second (where the point is) isn't.  - since ~electric-indent-mode~ is on, ~org-return~ is called with    `indent` set to `t`.  - Since ~org-src-tab-acts-natively~ is `t`, indentation is done by    calling `tab` in a src edit buffer, which by itself, does nothing.  - The observed indentation comes from ~org-src--contents-for-write-back~.    Since ~org-src--content-indentation~ is 2 and ~org-src--preserve-indentation~    is ~nil~, this functions further indents each *non blank* line by 2. At this point, the first line is indented, cursor is at bol. Note that you cannot indent your current empty line with `tab`. You can either indent it manually, or call ~org-edit-special~. When you write your second line, then press `RET`, ~org-src--contents-for-write-back~ will add an additional two spaces, producing the reported result. I think a reasonable fix is to have ~org-src--contents-for-write-back~ also indent blank lines. To do this, you need only remove following line from its definition. : (unless (eolp)        ;ignore blank lines With this done and `bfda3cc7df31fa79222efb4c190618c3c85a3d04` reverted, the original issue is fixed, and the behaviour is better: when you press `RET` to enter a newline in a src block, it is automatically indented. The downside is that, unless ~org-src--preserve-indentation~ is `t`, when editing a src block, every empty line will be indented with spaces (according to ~org-edit-src-content-indentation~ + the indentation of the #+begin_src line). I think this is reasonable, but perhaps some might disagree. Regards, -- Sébastien Miquel