From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id +KLNGRQ6b2JnQQEAbAwnHQ (envelope-from ) for ; Mon, 02 May 2022 03:55:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id cFrBGRQ6b2I1FgAAauVa8A (envelope-from ) for ; Mon, 02 May 2022 03:55:32 +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 CC8843DB0F for ; Mon, 2 May 2022 03:55:31 +0200 (CEST) Received: from localhost ([::1]:57200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlLHe-0007PU-Ev for larch@yhetil.org; Sun, 01 May 2022 21:55:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlLHE-0007PM-Pe for emacs-orgmode@gnu.org; Sun, 01 May 2022 21:55:04 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:36699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlLHD-0006nH-0k for emacs-orgmode@gnu.org; Sun, 01 May 2022 21:55:04 -0400 Received: by mail-pj1-x1030.google.com with SMTP id gj17-20020a17090b109100b001d8b390f77bso15000569pjb.1 for ; Sun, 01 May 2022 18:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BFERou0L6AHuzBUO5hSYXXWuydnk/Tt9p2F4/q5QjYk=; b=d7GyCVarjJm6/dYH3YXEmnbVF0D+4rKmaXv5LQvfQoUurJkFlJFzaIfYaFKWmjnv+v b/Ce+u114d630NbbQmy3CAxACBpGs0CqCdBkMPmvD6ILhU3pdBJsB6JeLEUoOYxyoOm5 MOvTu57lscxZVgL6rU51znmJF6Tqv4kTHNhPl5NbbazqNVMXh5CTJSIY8ovsjOuKtl9I SXS+P4GdlffQYsytR3V8Z6fS/HpP2sT0U+4LK8/bLNzCTIi9yvM6YtehTSS4TEE0/dHP 8J+rqRJFbdZybyuXDpQ30WVT2ySTpk45u0Zi0Rnnm0PWYsqK64lA7dAmuF//oWuncJVM nzsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BFERou0L6AHuzBUO5hSYXXWuydnk/Tt9p2F4/q5QjYk=; b=owvSksrm3uYbv4z80Y05zn05YcBAHtn/hz5nwuPknuaUckHsAfcNVPZPiNxZ1Bya54 o0hyQIrRD+SeWBE78VVp4vIJ4aLTTB9xoA6z4WeZGgJh6FmJFFsg94VN3DJtw4C0rFA4 ehHhUXI1F3PjReDVxEkH5QS4sQNO10Vo1H0reZNYu6CrEyPiW1kn4Ob2ZYJCiELVzNg6 4RnKGz8QXPJc03OmehzuD96lhqYvxTYnGbU3WNY1wXXErukJoZwPagm7DIPaGc4NMiOl uZyujJMX3Hqv/2N4L7NtGQQPJMLvde7vE4bcfrRL8X6aK2TrwkFdE8N++x1CQZjsevCV y5/A== X-Gm-Message-State: AOAM530ttO/MIT0jd0vwWHePydG1R7+Bcc/iOtPjABQ/Jm60ZP9ZukXu NXr11Lg5Qd7mqeanHd2udAHsuerc0atpDxBjE1Y= X-Google-Smtp-Source: ABdhPJx53BOoL3txYW50PIkmKeCxcNW4HDYloxyA9J95AGOYzr6lFjGb7YtPv/MIsuIsU0fYzvgFQaugKc2T15QsadE= X-Received: by 2002:a17:902:ce02:b0:151:a86d:dc2b with SMTP id k2-20020a170902ce0200b00151a86ddc2bmr9857835plg.57.1651456501516; Sun, 01 May 2022 18:55:01 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6a06:16c3:b0:4b8:bf09:e16e with HTTP; Sun, 1 May 2022 18:54:59 -0700 (PDT) In-Reply-To: References: From: Samuel Wales Date: Sun, 1 May 2022 18:54:59 -0700 Message-ID: Subject: Re: [Bug] incorrect indent of next heading after org-paste-subtree To: Max Nikulin Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=samologist@gmail.com; helo=mail-pj1-x1030.google.com 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_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: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651456532; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=BFERou0L6AHuzBUO5hSYXXWuydnk/Tt9p2F4/q5QjYk=; b=ApnucBXU9N/2gyTe2fTLYb/aYgFT+/y9xREgYTswcoc9leOl2TE9fMNuUDMvjDiwVTzkSn PG6WxGoMi7oOEdGe+BXcbuBDkt7oSW40tW6zEFfWb1QRo135qvwOJQnbtJFEo2Y1zlKtEy zgby/72/WSxcDMp8TtAIM73P6zg8Icq4X+lTEyF4W+9CdButW2j5fatNyTAdxQOqMtOuLs QUV9wBC4G/uHJefmCbR+5Gv9pSA0jv8xkvcyhvNIt3wDyyOTZ7NYFTMz6Q4m1vJY4chVez 50u/LMD1UtT6P6OBPbwh1uHZ6LbwuDc6tfY5OPbvNa0bNEb6tHjl7XEVpvb+dQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651456532; a=rsa-sha256; cv=none; b=OyUZbbZ/F58TCruOW5zd56aapJ5gpT2BdacXbc+0BvcTfHrrFprqlLbajLTbvu8hx0kqpY rgcn0/FJBYVeNdMi8i+f8HGROn9sSLAH9XsFK3YRIbEfF3mx8hecdGJNaOjYB4tgR/SqUk YrwcpR2LaJfNCYB37ZpaSIaSDfehURKA3K0+UxxL/7ssNKkyxcrn27e3sbRVux+BQ+U5+u sxFfiO/GU2wnsFzj37x/JV1j3CbJC9dSAoF8veaOixzynnpQzApo36yQUg3ZI816f2jVqY doQ0wBJghXbjR6UaUbPM3J8UXhJuHi1vZyBNNVGfjMe7FHkoaHW5k10n2OgyXA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=d7GyCVar; dmarc=pass (policy=none) header.from=gmail.com; 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-Spam-Score: -3.99 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=d7GyCVar; dmarc=pass (policy=none) header.from=gmail.com; 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-Queue-Id: CC8843DB0F X-Spam-Score: -3.99 X-Migadu-Scanner: scn1.migadu.com X-TUID: 5LjFmPscKLZI fwiw [idk if this is useful but here just in case] iirc, outline mode does not include the final newline for subtrees in at least one case. yet, many users and much code assume or ensure that lines are terminated with a final newline. this can result in unexpected behavior. it required code to ensure compatibility and flexibility, and it required consideration for edge cases. sometimes the workarounds would have to be worked around by the calling code. core emacs code like sorting assumed/assumes newline. org would assume or provide none in some [but not all] cases. user or package code might naturally kill a subtree by killing the whole line when folded or killing each of the lines. those include final newline. or set require-final-newline. this is anissue for things similar to editing source blocks or capture. the usual bugs were unexpected presence or absence of newlines. idk if htat might help you debug or not. On 11/30/21, Max Nikulin wrote: > Another old bug with org-paste-subtree. > > It make indentation of next heading wrong. > > Consider the following document and follow described steps: > > ---- >8 ---- > #+STARTUP: indent > Enable soft indent mode > > Put to kill ring some text *without trailing newline* > that represents a subtree. In my case it is generated > by a browser extension. > #+begin_src elisp :results silent > (kill-new "* Pasted Header\nPasted body") > #+end_src > > Several levels of heading to make the problem apparent: > * H1 > ** H2 > Ensure that the following "H3" heading is expanded, > put cursor to this line and try =C-c C-x C-y= > or [[elisp:(org-paste-subtree)]] > *** H3 > :PROPERTIES: > :CUSTOM_ID: h3 > :END: > Body > ---- 8< ---- > > Actual result: > > ---- >8 ---- > Several levels of heading to make the problem apparent: > * H1 > *** H2 > Ensure that the following "H3" heading is expanded, > put cursor to this line and try =C-c C-x C-y= > or elisp:(org-paste-subtree) > ***** Pasted Header > Pasted body > ***** H3 > :PROPERTIES: > :CUSTOM_ID: h3 > :END: > Body > ---- 8< ---- > > Expected result > > ---- >8 ---- > Several levels of heading to make the problem apparent: > * H1 > *** H2 > Ensure that the following "H3" heading is expanded, > put cursor to this line and try =C-c C-x C-y= > or elisp:(org-paste-subtree) > ***** Pasted Header > Pasted body > ***** H3 > :PROPERTIES: > :CUSTOM_ID: h3 > :END: > Body > ---- 8< ---- > > Org mode version 9.5 (release_9.5-225-g494c20 > > > -- The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com