From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp11.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 KR7yLx0TzWLjBAEAbAwnHQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 12 Jul 2022 08:22:21 +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 kOS2Lh0TzWId/QAA9RJhRA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 12 Jul 2022 08:22:21 +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 56A32289E0
	for <larch@yhetil.org>; Tue, 12 Jul 2022 08:22:21 +0200 (CEST)
Received: from localhost ([::1]:48572 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1oB9Hn-00020W-Jg
	for larch@yhetil.org; Tue, 12 Jul 2022 02:22:19 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:50632)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jackkamm@gmail.com>)
 id 1oB9Cr-0001zT-3M
 for emacs-orgmode@gnu.org; Tue, 12 Jul 2022 02:17:14 -0400
Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:33338)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <jackkamm@gmail.com>)
 id 1oB9Cn-0001fb-SV
 for emacs-orgmode@gnu.org; Tue, 12 Jul 2022 02:17:12 -0400
Received: by mail-pl1-x634.google.com with SMTP id v21so3893883plo.0
 for <emacs-orgmode@gnu.org>; Mon, 11 Jul 2022 23:17:09 -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=R1JthJKoy+GZdulrcuWgcf9E7cjui0xZvwAgD77GASw=;
 b=czFk+Yz0T3+jRvBQvyYZ0sayRFMK/bL+whVophPs6rPPvshYU+lmA+zhzWsjX+voBB
 6Jgq2nLP9e4/GSJAEffhy8Lni70qC0/jP3hT9VxylC8GaDbcNFfXFwUcRvtfQjc6m1db
 +cZYGYI/+ktnG2GZl89CGz20thGhPFH7OAO6R7yfo7F7Pl8wGd2UB/bNand1+dx2oeIu
 9oWyS69MBqZ5/KFzkWXDCpYpssOTXmNMRn0Y1qrtwoBwNPWPwhpffWv3dOgFcWTgw3R1
 p/xox7s2vUuUYM9kBbKam1svQTvlTNCYZp0hWM3JpjmhfjM7Q7NHK8AyXqO77JGBjimZ
 ZTTw==
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=R1JthJKoy+GZdulrcuWgcf9E7cjui0xZvwAgD77GASw=;
 b=NaCfddnrHyl/ys1lxHiSfxcDgQmmavFDqsY3KiPp2rwcKznkyROsjfOrfInVQ439iX
 ouwQTKwCLJVlRAzEJxOq7wR7Gr5tvZh5CPIF8lHc2zcz/WRr6uS+nx6mrbG5o9eYdK+U
 1ykhJkPuBN9XAPUPEf4r7WjW6GfKyoCXpGXkN584XCNyvapOq+Tx0Pr99cB6m7MfrK/+
 AlCTepPJle9J16ZieWtJs45C5BkFfh1epD1gg+UoK6YOvRAy5krEuK9g4dl091HPcaJq
 xHtlXEKiEa+viAdmHAF3gGpFmVevwADUR+7fs45NCrDnGYDYe4evAJeClbaJKvRlKtUX
 LUhw==
X-Gm-Message-State: AJIora9AzD2v8Edy/8Ggt2KYquPKGcckDILD/Gq9an21I31PA7Nya5Cn
 6u17Z+ZszHE2ZioPFVW6lkU=
X-Google-Smtp-Source: AGRyM1sJ1SNvnxe6bB73OzywbOqX5xoFfYvIcbmUQ3StpmLUY9+9PqEuKBpW8lXPSSu9QX7DREzWSw==
X-Received: by 2002:a17:90b:4a8b:b0:1ef:fba9:1c0b with SMTP id
 lp11-20020a17090b4a8b00b001effba91c0bmr2419631pjb.239.1657606627989; 
 Mon, 11 Jul 2022 23:17:07 -0700 (PDT)
Received: from localhost (198-27-249-67.fiber.dynamic.sonic.net.
 [198.27.249.67]) by smtp.gmail.com with ESMTPSA id
 r29-20020a63a55d000000b00412a9c2217asm5172251pgu.64.2022.07.11.23.17.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 23:17:07 -0700 (PDT)
From: Jack Kamm <jackkamm@gmail.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Recent folding issues
In-Reply-To: <87ilo36su8.fsf@localhost>
References: <877d4jve13.fsf@gmail.com> <87ilo36su8.fsf@localhost>
Date: Mon, 11 Jul 2022 23:17:06 -0700
Message-ID: <871quqvorh.fsf@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::634;
 envelope-from=jackkamm@gmail.com; helo=mail-pl1-x634.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." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: "Emacs-orgmode" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
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=1657606941;
	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=R1JthJKoy+GZdulrcuWgcf9E7cjui0xZvwAgD77GASw=;
	b=HvXyw3kNZxKpnrUR328znua41XkJzKnjujVAeVZiUQgZmfiZ0ZJMvXMLOGK+BQnRgr2p6l
	54vfIfpIi4Ag8yKqBHU7P6G658AVOelPQ4Jahau72mlNpNbK39pElODK+xFYEsWGlaRa0c
	4YHlQgzJQdckSGGGK0HG+dKTJXkr5T3kXOmG+kqALJGjODDQX4kYAoVqJN92nuu4Gp5rbJ
	Qd4v7sDz/ffMipBwLpKM18M7G7Ql4Ks0jJZKEJNlFPgjxzUmNs/MqeF1l7n5crvc2hofIc
	qi+burYl8CvyndJ8Er8CvEGbu6PhPoRFAS3OVT3VRH4z87ocqw20Xgu+yhxldw==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1657606941; a=rsa-sha256; cv=none;
	b=NNMZM2OoS8hCilpIYftxEwwAyGj54dgJQAuZJ9kP28nGTyeq9qQu9pK7TsaLT2vu5aLwGW
	KcA2/GWl8wFE91ETdpXyFmtHrmgLU0vhcMXih0KJyove2ho3390/+M11SpNTlF5AHavbwD
	QG3FGNCCaauEqQLbI/6hNxPfVjJJ+ioWNMI01Y2RzWcfuiMkTNktHWSjk9zNvN5j9fO3px
	A8HkoBEuWSLUwxB19ihwWZKBZ9U53AbrETOF8lvJy9yKMI2NBh1gGbGpRFJ1GlqLDBoGTh
	ByMaFfbunhxHQCsq57eBEAOFO2pKlWFiUFx7P+ItUqk5Epd7g2WK0H6zJvNGYQ==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=czFk+Yz0;
	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: -5.55
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20210112 header.b=czFk+Yz0;
	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: 56A32289E0
X-Spam-Score: -5.55
X-Migadu-Scanner: scn0.migadu.com
X-TUID: XwCmj2J3eezW

--=-=-=
Content-Type: text/plain

Hi Ihor,

> May you provide the output of M-x org-version?

Org mode version 9.5.4 (release_9.5.4-623-gc66bdb @ /home/jack/dev/org-mode/lisp/)

I also updated org-mode to the most recent version (last commit 5
hours ago).

> I cannot reproduce. Please, update your Org to the latest version, try
> to reproduce, and provide the detailed steps required to obtain the
> confusing behaviour you are seeing.

I attach a couple files for a minimal reproducible example of both
issues.

Steps to reproduce:

0. Download the attached init.el and test.org. Edit the absolute path
   of "test.org" in the capture template in "init.el" to the location
   you downloaded it.

   Then do "emacs -q --load init.el test.org"

   test.org should look like this now:

> * Headline 1
> * 2021
> * 2022
> * Headline 4

1. Next, do "M-x org-capture". Then type "c". Then create the following note:

> **** Test entry 1

Then press C-c C-c. Buffer should look like this now:

> * Headline 1
> * 2021
> * 2022
> 
> ** 2022-07 July
> 
> *** 2022-07-11 Monday
> 
> **** Test entry 1
> 
> * Headline 4

2. Shift-TAB until all headlines are collapsed. Buffer should look like this:

> * Headline 1
> * 2021
> * 2022...
> * Headline 4

3. Capture a second note: do M-x org-capture, type "c", and create the entry:

> **** Test entry 2

And press C-c C-c.

Now, an error appears: I observe two headlines running into each other
on the last line, like so:

> * Headline 1
> * 2021
> * 2022...
> ** 2022-07 July...
> *** 2022-07-11 Monday...
> **** Test entry 2...* Headline 4

Now, to produce the other issue. Shift-tab until all headlines are
collapsed again. Doing this a couple times will also fix the above
error, and the buffer should look like this now:

> * Headline 1
> * 2021
> * 2022...
> * Headline 4

Put the pointer at the start of the line "* Headline 4". Then press Enter.

A newline is placed above "* Headline 4", but also, the preceding
headline "* 2022", has been expanded, so the buffer looks like this to me:

> * Headline 1
> * 2021
> * 2022
> 
> ** 2022-07 July
> 
> *** 2022-07-11 Monday
> 
> **** Test entry 1
> 
> **** Test entry 2
> 
> 
> * Headline 4

However, I would instead expect to see the following:

> * Headline 1
> * 2021
> * 2022...
> 
> * Headline 4

Which is what I observe when org-fold-core-style is set to overlays.

Best,
Jack


--=-=-=
Content-Type: text/plain
Content-Disposition: inline; filename=init.el

(add-to-list 'load-path "~/dev/org-mode/lisp")

(customize-set-variable
 'org-capture-templates
 '(("c" "capture" entry (file+olp+datetree
                         "~/dev/orgmode-devel/220711-folding-issues/test.org")
    "* %?"
    :empty-lines 1 :jump-to-captured t)))


--=-=-=
Content-Type: text/plain
Content-Disposition: inline; filename=test.org


* Headline 1
* 2021
* 2022
* Headline 4

--=-=-=--