From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 8O7nM+jHomTVUAEASxT56A (envelope-from ) for ; Mon, 03 Jul 2023 15:06:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 0GvbM+jHomTF8gAA9RJhRA (envelope-from ) for ; Mon, 03 Jul 2023 15:06:48 +0200 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 DBA8419C42 for ; Mon, 3 Jul 2023 15:06:47 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="q5Ope/Ue"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688389608; a=rsa-sha256; cv=none; b=MiQ8DhgVA0zjnB9B50sI0SzkRnRxzhBTPZ7LUBhAvKZsYK90ovRS8+yyYaPiv3+B4OXEk9 NpJPnqKTWYxLZcWZ2DrhvHoXuvGT7nVLbBfR1+XLOHKr+m6jMr4G6x4zB9Ny29aHxSSJvs 1maTAYutE9b4b1lTlRQ6pLLRo0KSkyGhibOW/A2S55p13lUPGVeOdjwjjLQ2/IVAicgPbk 7IAqKun2YoyRolQgAqZaj3nLU5an5oM/+tg3UNtFAY7zW+G0KCAKNis+MjPsbgd+yx9s+h +8kdhetMJSMrhj8m5YWymuxCvisSiohClcZnJw/WSqbkjeI8m7zPrDoL6/N23A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b="q5Ope/Ue"; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688389608; h=from:from:sender:sender: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=l6wUUOvnyEaDMaJH8Q4lhhBtXi9NOnOO3R1SRQ0D+LE=; b=pjTgMroz9G5W6f+gWC73y6FSHdA7gfXklURS+BTDUCPDysQm/JLrXBettXP+HnMerqP74F miRlEzMHVg85AXpnDzahIUZUVl8oKzKup52DEWSmQh/xDqyqkHY2/K17nPFwSraLlU/eOf PWZMsaWkdGaKqfneSUATwwXxvjb+kXlzgb2EXC9Kr7l7joD1OXtChHeWHW9ZHQo+LBLPaT 1YKFMxDYxztDEFoMpuzCrRLWa91IJU4iKFB7x+UtVFZmOkp+MAhOgWsOypi6F8o8QOBlCX FnflBtZ4I5ypok9fnHCl/sd/aIuO/AFMKq+zCoshDZ3LKWrlN5WTaEYPKTi3Hw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGJFi-0008IO-SS; Mon, 03 Jul 2023 09:06:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGJFU-0008HW-AX for emacs-orgmode@gnu.org; Mon, 03 Jul 2023 09:05:50 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qGJFR-0004BL-Lz for emacs-orgmode@gnu.org; Mon, 03 Jul 2023 09:05:48 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 73228240101 for ; Mon, 3 Jul 2023 15:05:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1688389543; bh=ARFFDqdm+tqpmws7/aTS5/22w6t/VSlw42945i2bl2E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=q5Ope/UeKCs5qYoZydAYjBRzViZfJgl6xlMG+cjt+esQVkJEMlPaqQvo81Y+WlaTk K/kAFTSQtT8QPzlZ3DFRLodxwLLKRXDPxTpJY5wwI6C58xWHPuAfvGfxdFdxP/Z4F1 Bg70q7dTuzkZneLdx3aZB2sS4woRo0cltR8286etBVJw1m3NaYWxmLaz6XGBMFKp6p ebm2rsauVxbL7YNdKQLkf/ceo9K1/Sij8j2DUIHQ5SL7xPALo8omt/1SuPtzKWTYOA 7BDLzZgW42UBxNYUXz6qJAK1l8efctW5p0jpNn+aDDdKezC9JZ+F7B/XUVfgvKbu7m //l4nmeZm3Ktg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QvmPf5P4xz9rxL; Mon, 3 Jul 2023 15:05:42 +0200 (CEST) From: Ihor Radchenko To: sebastien.miquel@posteo.eu Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] Source block indentation does not work properly for yaml-mode [9.6.6 ( @ /home/user/.emacs.d/elpa/org-9.6.6/)] In-Reply-To: <8d6dd95e-5bce-44c3-638a-52351b69cc66@posteo.eu> References: <87ttva8chx.fsf@localhost> <8d8642c9-ced3-b254-0f49-f7b9c06311ff@posteo.eu> <87352p9g13.fsf@localhost> <87zg4vsof6.fsf@localhost> <37d86bbf-c0e2-6337-efc2-cdf63dbf4580@posteo.eu> <87sfamsb7m.fsf@localhost> <274bbd61-790d-8e19-d3a0-0793126c3bb0@posteo.eu> <87cz1itp8k.fsf@localhost> <1a97917c-bbab-4d7f-b629-0c84807448f2@posteo.eu> <87a5wmtmug.fsf@localhost> <87o7l0vt5z.fsf@localhost> <1d145455-2047-2b7a-8222-8eadc2529c8c@posteo.eu> <87edltqiox.fsf@localhost> <87sfa7opo9.fsf@localhost> <4eb9a5ad-2d91-15ae-ccd9-894c0303cca2@posteo.eu> <874jml8ggm.fsf@localhost> <8d6dd95e-5bce-44c3-638a-52351b69cc66@posteo.eu> Date: Mon, 03 Jul 2023 13:05:41 +0000 Message-ID: <87cz19gn6i.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -6.23 X-Migadu-Queue-Id: DBA8419C42 X-Spam-Score: -6.23 X-TUID: GqnsVxGUAH5U S=C3=A9bastien Miquel writes: >> May you please provide an example when it is necessary? >> `org-indent-line' will run `org-babel-do-key-sequence-in-edit-buffer', so >> it should still use `org-src--contents-for-write-back' and will not >> modify the org buffer text directly. > > You're at the end of a line, you press =3Dorg-return-and-indent=3D. > 1. It adds a newline character. > 2. =3Dorg-indent-line=3D adds the org indentation, _before_ calling > =3Dorg-babel-do-key-sequence-in-edit-buffer=3D I missed this: ;; At the beginning of a blank line, do some preindentation. = This ;; signals org-src--edit-element to preserve the indentation o= n exit > 3. The native edit call removes the common indentation, before > calling tab in the native buffer. > 4. Calling tab in the native buffer possibly does nothing. > 5. =3Dorg-src--contents-for-write-back=3D sees the current line is empt= y, > but it should indent it (with org indentation) nonetheless. Ok. I understand better now (I think). We are talking about \t#+begin_src bash \tcd foo \t#+end_src and user pressing Then, the expected result is \t#+begin_src bash \tcd foo \t \t#+end_src with being aligned with "cd foo" above. Alternatively, \t#+begin_src emacs-lisp \t(when t \t#+end_src should yield indentation in src block as well \t#+begin_src emacs-lisp \t(when t \t \t#+end_src ------------- For the second scenario, no special treatment of current line is needed. For the first scenario, why do we need to do it all the way in `org-src--contents-for-write-back'? Why not directly in `org-indent-line'? >> Before your change, all the blank non-empty lines were unconditionally >> removed. After your change, the first such line is removed and the >> function returns nil without continuing. > > I don't understand. With this change, the function only stops if it > finds a non blank line with less than n indentation (same as before). > When a blank line with less than n indentation is found, it is emptied > (same as before), and execution continues. Never mind this. I misread the code. Thought that `throw' is called on blank lines. >> Since not removing blank lines is intentional after the change, why >> doing it on a single line that is indented less than N? > > Are you advocating for computing N using blank lines as well ? No. It was a misunderstanding. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at