From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 GNZFJoM1kGS2zQAASxT56A (envelope-from ) for ; Mon, 19 Jun 2023 13:01:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id AIIqJoM1kGQ6+QAA9RJhRA (envelope-from ) for ; Mon, 19 Jun 2023 13:01:23 +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 3F6DB3A881 for ; Mon, 19 Jun 2023 13:01:23 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBCcO-0008HD-9t; Mon, 19 Jun 2023 07:00:20 -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 1qBCcJ-0008GF-Rz for emacs-orgmode@gnu.org; Mon, 19 Jun 2023 07:00:16 -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 1qBCcG-0008DY-72 for emacs-orgmode@gnu.org; Mon, 19 Jun 2023 07:00:15 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 91315240029 for ; Mon, 19 Jun 2023 13:00:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1687172406; bh=lEMPeI6NbfQwPZQ67cK1LpaET1qaRdvUyko3htqClEw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=qT52oOc25JXkYEnzEpyhJx/4wtD0MWn+uZjPD+t2Vk6BMt5XpkUxCenSVqlfF/E29 wwbDZO8/FP9Hk5RrPRDXp3AnTBKZSBRXmKSS6uQ4fwlS8n1IWsk1gamnPBhymmXTHJ EUhc68w7IsqtknwIVam176IYRR8ACB7/4JunlMVldLrNGEaPFVrPikLG7wT5bNqvgf kTWhnl2AyXY8VsIPkBEVMSV3mRi5CAMxoWhRxWSWTB2ZFIysZynGPRbSi4/BDIgr5q DjkynVhdLRgEhY+bKkwq0Fft81uixGEa8iGbuvl9qILo9w2bjpAb/Fyv+i7RWwXlgC K2yZKD0AAVPNA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Ql6H945bTz9rxY; Mon, 19 Jun 2023 13:00:05 +0200 (CEST) From: Ihor Radchenko To: sebastien.miquel@posteo.eu Cc: wolf , 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> Date: Mon, 19 Jun 2023 11:05:01 +0000 Message-ID: <87zg4vsof6.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=1687172483; a=rsa-sha256; cv=none; b=OPn0KlZyvbXDgiDW6eIr1BaSqzyV4uMGl0T9igR66wzDBG2EnfuHip1USNvNO82oYgHLjJ KzeRpjJdrkPuwMbh0Pz7LczN3phqvq/5c7/Om+Mow9+vZc/GbuzkiU3dsECCPkEP9jzBUe wdzj2OUQ29VaeayMc3Ak6f/L9PzMrhBoe1KhMgL0bU/0Wr1472WPOFBnuGCjabd/WszGTy krtgkQUlhTZ9kF64FrdMT2eFOwjNV5+1eK90y9vcTQM0EEmJdWDfOeO071FjkCnP5SsJ4D sxbuNZR6f19EFik90bmknUANmcSJX8twUY0BMdC8UGCva1LWMnYTu4RvYlWIZw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=qT52oOc2; 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=1687172483; 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=ZTNgMuFGXO4ATh5WTwUunn5A5zut/dPXQBilGJGLr+4=; b=Ct+6139W9BsYCzNpe34cnUYEECgNnEBAinB9MKmLAciJT5kiQS9n445vdoGl+JMDOubLyo 6kT2QYLHsyGOTZZT+R6be5n4j2ZOs7CHn7fu4JMm9ZVDT/8jXD6NpYJd7xk2eYIROV2fCj nnbQfjIfcR1lNyFWpAO6qPJ3Y0JMk28fRm1EFvox0l3OUVXnYl/mhn9hycTp3tztBoQ3yE KEM8VOJiMGkJ2cKIU95Xn7i3J7AR+6zHcN8WfuMVYt2fZ3rD+DiDEgXilUbaQ3BDEnBdAF FK3oVswoF/ysDk+/sVCzYduGPyXEAdPc+YKgXt+91/Su0Yne+q1oweni8yDP3A== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=qT52oOc2; 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.51 X-Spam-Score: -6.51 X-Migadu-Queue-Id: 3F6DB3A881 X-TUID: 1EWwQPeRaw9E S=C3=A9bastien Miquel writes: > Ihor Radchenko writes: >> I feel that we will be getting various edge cases like the original >> report and like the one I made up above if we keep trying to convert >> tabs/spaces. Just retaining the original code indentation will be much >> more robust, IMHO. > > Python code being broken with the default configuration is > problematic, and fixing that seems worth the downsides (the > indentation in an org file will now partially depend on the > =3Dindent-tabs-mode=3D settings of other modes, which cannot be set using > buffer local variables). What about the following approach: When converting from org-src buffer back to Org, 1. We do not touch the original indentation, except minimal common indentation of the whole src code, respecting the src mode value of `indent-tabs-mode'. 2. Minimal common indentation is treated according to `org-src-preserve-indentation'. 3. `org-src-preserve-indentation', when in effect, will add extra indentation of #+begin indentation + `org-src-preserve-indentation', now honouring `indent-tabs-mode' in Org buffer. When converting from Org to org-src buffer, 1. When `org-src-preserve-indentation' is in effect, remove the common `org-src-preserve-indentation' + #+begin indentation from the body. >>> ... "- Item $abc\n efg$" >> Shouldn't newlines be removed completely before editing the body here? >> Just like what we do for inline src blocks. See `org-babel--normalize-bo= dy'. > > I was not aware of how we treated inline src blocks, but I don't think > so. LaTeX fragments, in particular $$=E2=80=A6$$ fragments, can have > significant (for the user) newlines. May you provide an example? AFAIK, LaTeX usually treats newlines as whitespace, same with " ". >>> 2. Renaming of =3Dpreserve-blank-line=3D, for clarity. >> My concern is for `newline-and-indent'. Current line is _previous_ line >> in such scenario, not the newly inserted line. > > The way =3Dnewline-and-indent=3D works, I think, is that a newline is > inserted, then =3Dorg-indent-line=3D is called, which preindents the line > to the common org indentation, then calls =3DTAB=3D in a native edit > buffer that does the rest of the indentation. The "current" line I > refer to in the code is the new line (the "current" line is the one > from which the native edit was called). I think I stumbled upon related problem in my testing, but can no longer reproduce. Your explanation indeed makes sense for my example. --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at