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 ms5.migadu.com with LMTPS id uFEXFhpYb2JRxAAAbAwnHQ (envelope-from ) for ; Mon, 02 May 2022 06:03:38 +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 iEVEFhpYb2JsGwEA9RJhRA (envelope-from ) for ; Mon, 02 May 2022 06:03:38 +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 1B6B13CF37 for ; Mon, 2 May 2022 06:03:38 +0200 (CEST) Received: from localhost ([::1]:56862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlNHc-0005Sv-NP for larch@yhetil.org; Mon, 02 May 2022 00:03:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlNDz-0005Sh-F0 for emacs-orgmode@gnu.org; Sun, 01 May 2022 23:59:51 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:34761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlNDx-00045j-Ol for emacs-orgmode@gnu.org; Sun, 01 May 2022 23:59:51 -0400 Received: by mail-pj1-x1031.google.com with SMTP id qe3-20020a17090b4f8300b001dc24e4da73so3222636pjb.1 for ; Sun, 01 May 2022 20:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=1lYtIqgfzx+utWEYW55lFCq7Qj5Hux5G9xvW8BjjJGA=; b=nZFDxjYzSWTOyBo2qgbDdL6q0aT3XREPVKzCyGlfjFo8zqNwKrmDIzRFxJ9VqJQurH oRyrqMx7ofiJdsqV3CZY2Lqzo7++Z5NZjKXRQaU6LELrzJpuI2hzCGl+W5MnFmYxvqGZ J9KTAyGYpyOy2E0dc9LgfLw+sRxM6Vp4c/+v5l0TvFwmYd+exWnqUbjfCZAyOvlVy9/A AaojD0f//4CBwvKxK+UxmrW1Ch43Df/XM90q3NXVtASb+55x2l7sfD2M7PI1Zqh9GSho g/+wVG8TOFcrLmLRnK9jW1yUvaDy+El8xWkon3OqpPtkVSriFSbjVacLCJ8ASOx+YAvG Sqlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=1lYtIqgfzx+utWEYW55lFCq7Qj5Hux5G9xvW8BjjJGA=; b=Jf76uRp07nYnSeWdBAwUsll8H04/qcdcUxin7RmO8jh1u0Ggq5FSSkDO9gnNtx0TN+ wBphUDFpDqmcJWUBwie+QpyGOsg+GFnOp0NBU2cC5w0mWAQAKIJ7T8qSuKt7TFQfv0Lz ohKSx8neSSPwmVyXTbzPkJ0GpOk/Uxcde3X/DQrlTjdH/Ml1SVL0fOKADkYPIkF0qA9q pzSSeDRl8o3kc6UATqwCwcTzJhFtXm8bmRY8Ha9eC/LlnRIIXKiuMsyb3PPFg04k3YKS iskPIq+zb3Mf7arSLXobRZ+G8v+pkiHvyPQUj7/DxFJGPf6xO6a2bjNT7Za7+ncsLVtF jbEw== X-Gm-Message-State: AOAM530uZeOcmtSM9b85QrXgz9PFjj3/7lNgn4yfzypus1ReiOLagiML ia7gnwYmmshr2fQWKVapmHg= X-Google-Smtp-Source: ABdhPJz6HKwDv3ELujv8gWRCH9NcbQtnGmyCIACpWcu2mv6emBv0hrW5sYVZJd2efyiY2cIanDdCnA== X-Received: by 2002:a17:90a:ce13:b0:1d9:acbe:7ede with SMTP id f19-20020a17090ace1300b001d9acbe7edemr16143211pju.16.1651463988166; Sun, 01 May 2022 20:59:48 -0700 (PDT) Received: from localhost ([104.129.16.8]) by smtp.gmail.com with ESMTPSA id h7-20020a170902ac8700b0015e8d4eb273sm3557534plr.189.2022.05.01.20.59.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 May 2022 20:59:47 -0700 (PDT) From: Ihor Radchenko To: Max Nikulin Subject: Re: [Bug] incorrect indent of next heading after org-paste-subtree In-Reply-To: References: <87tuaa6l11.fsf@localhost> Date: Mon, 02 May 2022 12:00:36 +0800 Message-ID: <87a6c0vb17.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1031.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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_ENVFROM_END_DIGIT=0.25, 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=1651464218; 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=1lYtIqgfzx+utWEYW55lFCq7Qj5Hux5G9xvW8BjjJGA=; b=JVAkUat2mrU+WSiGsRmfShwY2j1yL//vVGqeR9+aJWLjm9VUXRbrsdi4rkDYVc70JO6VSq qDE/1DWPMrdEbksoRBKXQ0yFFQ6PujsbaLgnxU9hD+rdil1uiGy8x9VriWrAWckBfpMsrz 9wGLoCZtplUc3HvzcgacLY1n3yk1aPxgZg7jvF0HYHhCD2JS67rR5euwA1Bwh2+h/ohELo w9Vjz+/jpAPgOdL0icBzHIMqRoSHPvXsZEBMnQqfaNEQwicMKxxvi5IT8VUhZYxrvVGSfh xPRojHd7upVSmwE9sRn/S8iPC/YbNwDplUQJEZaEZ+/NikCtLGEMyBMyoga78g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651464218; a=rsa-sha256; cv=none; b=DE/Yq5zP7HRv4rRNIsS2Iu0izOQbjkb6vZMc1n8Edg/jl9ieqMa5W3H6HzYnN4UPvPyB+v DaGPBu+cLMi7XlIBnrdulz0nRpq5ZkMyuds7vhi4Ui6qY+6VeMhu7zY6/DiyFsvi8w7yPC tAHj84tQHH6JthgmBVzGtY9awTpzdvxIHt/FBsSpjmcKCwzTpEQ505ISZmg0xrGlWx64hl Inae0+Ct3ZsSUwEwUbcOgyPYFqTISdqmNM15cYEUj6SK2gQVsJRhxQmNXXTYhokZL0qYw+ QfjbFY7ZhPZFW3iIj/wAGFQWDQdTTPwebjd++DbpexSdGf+cLSMq6J+MyiNzeA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nZFDxjYz; 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: -8.49 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nZFDxjYz; 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: 1B6B13CF37 X-Spam-Score: -8.49 X-Migadu-Scanner: scn0.migadu.com X-TUID: D+wjUxvDHUTm --=-=-= Content-Type: text/plain Max Nikulin writes: >> I am unable to reproduce on the latest Org. > > Thank you, Ihor. I have checked it once more for current main HEAD > 2bd34edb64. I can reproduce it using the provided steps in Emacs-26, but > not in Emacs-27. > > Unless there is a reason to suspect something weird underneath, the > issue should be considered with rather low priority. Anyway, I have > added trailing newline to generated content and mostly use org-capture > with org-protocol for communication between applications. Thanks for the extra info! I managed to reproduce using Emacs 26 and it is a real problem with some edge case in org-indent. The problem is masked by combine-after-change-calls that is used since Emacs 27 but replaced by a placeholer in Emacs 26. The fix is attached. Let me know if it also works on your side. Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-indent-Fix-edge-case-when-edited-region-ends-at-.patch >From 5dd89d7b36bee94804c7ab631780a4bd020c49cb Mon Sep 17 00:00:00 2001 Message-Id: <5dd89d7b36bee94804c7ab631780a4bd020c49cb.1651463875.git.yantar92@gmail.com> From: Ihor Radchenko Date: Mon, 2 May 2022 11:56:15 +0800 Subject: [PATCH] org-indent: Fix edge case when edited region ends at headline leading stars * lisp/org-indent.el (org-indent-refresh-maybe): Extend affected region to the whole line after END. Fixes https://orgmode.org/list/t4lpos$l3p$1@ciao.gmane.io --- lisp/org-indent.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/org-indent.el b/lisp/org-indent.el index 4cca0c35d..7469aba97 100644 --- a/lisp/org-indent.el +++ b/lisp/org-indent.el @@ -409,7 +409,13 @@ (defun org-indent-refresh-maybe (beg end _) (goto-char beg) (beginning-of-line) (re-search-forward - (org-with-limited-levels org-outline-regexp-bol) end t))) + (org-with-limited-levels org-outline-regexp-bol) + (save-excursion + (goto-char end) + ;; Extend to headline if END is within its + ;; headline stars. + (line-end-position)) + t))) (let ((end (save-excursion (goto-char end) (org-with-limited-levels (outline-next-heading)) -- 2.35.1 --=-=-=--