From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id ekrlOlIJoGS4lAAASxT56A (envelope-from ) for ; Sat, 01 Jul 2023 13:09:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sArPOVIJoGQadQEAauVa8A (envelope-from ) for ; Sat, 01 Jul 2023 13:09:06 +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 A59F4406B5 for ; Sat, 1 Jul 2023 13:09:06 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFYSN-0007zH-0n; Sat, 01 Jul 2023 07:07:59 -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 1qFYSL-0007yt-3a for emacs-orgmode@gnu.org; Sat, 01 Jul 2023 07:07:57 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFYSI-0001BR-Mk for emacs-orgmode@gnu.org; Sat, 01 Jul 2023 07:07:56 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 4CB57240028 for ; Sat, 1 Jul 2023 13:07:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1688209672; bh=bzBn8G33QtVo0ghjNeZbmU9Efi8+i4ubdzIxvetH1Vg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=i+p32VAlQb2bh1FiZNm99jvDvAUzQTv9hhBPukvrfHJubtbLdji8ApeTzBvDyfl23 FLUIXIrvMKG3K7NF4yODJNiN4ZzsvAh3vDvEElJQZCOd1PzEbAgXHX7IuMExBVuIeG oO2beuB/JZVk0xnDm/UPb+zNqA0g/TGJbW29BqMIMk1ygNifO4+UpdiAFP3hJSuwbp 484w+zcCNgeZ7mj8T7sdbdNjYkZsRQsAs+L4fgQYC6FCZptG/0OaNn+IEU96G8EC/d HPZebhxBL4uQvwq8YMFtSKJ338GxUYmtYSZ1fr/ScCqPQ078MRksJLmVY20iHM0NdE QzYMWJ9A1Mc5w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QtTtb4lP3z6tsb; Sat, 1 Jul 2023 13:07:51 +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: 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> Date: Sat, 01 Jul 2023 11:07:50 +0000 Message-ID: <87sfa7opo9.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.65; envelope-from=yantar92@posteo.net; helo=mout01.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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688209746; a=rsa-sha256; cv=none; b=Sejb1PFwX505WbsP/JGkphtxlDHFMxpfQkzBoPul3e5waHuMMPkFIKvTiUXkqw0AN3jCj+ uemp75OWKQnTwmDTo6+YA9VsB781RqEDd52x0uZgcAw3RoH4bGfQGubwF8nERjAtI0WAOY RccEtGjj782cSpm376Q6fUNZwfjNJC6oL8t3+rCE6gVH7NyPPbWHvQ5Fv7vjNlOciEJ49f hcoBLb2q2w66ft1f6ohvV98qB8dNjQuRz4gjfAsxMszEq7XNJbjNnmSD18czIha96KRO4D vzKGDtXJElDpV60Sfq5ZxEibWSzz/KgJhP4SDOoH4e7Z09WVjuR42LEZozHRXg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=i+p32VAl; 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=1688209746; 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=Q22/SFvcxSOib48m1fE1r/jPlzYy1wNM0zvaSIy1iu8=; b=mnvuBZgnJ/zhyf0ma+FePVL3u+W+T1WNSGo+Zmv93uIqu7CxfP+AaCgIN60Y8FCpsIFAlx Zqj4iHN6VYZZlWKagEAhgvC0JihNpNKCr1GYABfLMX7E+DADGlCeflgGZYPEY80Ony0Wdn 2TXqrCfxEwYGCu2yYQhm7DfYhobuT9tyt35RoNeeJKnclYe8KQ9iUNGVUNGwwvVlJ0U3e0 57nKtMmu7AE0CrK/+zaxaxKxQogAQBki6BIOgLysIlYaWQi51+lvrImossqQ6iDocYlP3l a7usUpVHyuhfx7P44AGMXH+qBxT2F0KHnnM6GvymVU6Q6w7x+bPAmNNu/XVLzA== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=i+p32VAl; 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" X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -6.53 X-Spam-Score: -6.53 X-Migadu-Queue-Id: A59F4406B5 X-TUID: QVxIKh+tJFtO S=C3=A9bastien Miquel writes: > Ihor Radchenko writes: >> But why do we need to avoid indenting empty lines? > > In the following link, Greg Minshal argues for preserving empty lines: > https://list.orgmode.org/725763.1632663635@apollo2.minshall.org/T/ Thanks for the reference! I can see that non-empty blank line below might be annoying for some users. \t#+begin_src lang \t line1 \t line2 ^\t $ \t#+end_src However, I do not see why Org should clear blank lines created by the lang-mode itself \t#+begin_src lang \t line1: \t \tline2: ^\t \t\t$ \t#+end_src If source code in the edit buffer contains non-empty blank lines, it is not Org's responsibility to clear them. In fact, it will go against possible user settings! So, I agree that we should not indent empty lines. However, I do not agree that we should not indent non-empty blank lines. --- The code in your patch is confusing, considering the above considerations. > - (setq org-src--preserve-blank-line preserve-blank-line) > + (setq org-src--indent-current-empty-line (and blank-line > + (not empty-line))) Here, you have a variable named "empty-line" set when (not empty-line). ?? Also, > (while (not (eobp)) > - (skip-chars-forward " \t") > - (when (or (not (eolp)) ; not a b= lank line > - (and (eq (point) (marker-position marker)) ; current= line > + (when (or (not (eolp)) ; not an empty line > + ;; If the current line is empty, we may > + ;; want to indent it. > + (and (eq (point) (marker-position marker)) > preserve-blank-line)) > (insert indent-str)) > (forward-line))) removed `skip-chars-forward' call, so the loop will always check every bol and (not (eolp)) will be t for every line, except ^$. Then, considering that preserve-blank-line is set when (not empty-line), your second condition will never trigger. I feel that something is fishy in the logic. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at