From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail
From: Ihor Radchenko <yantar92@posteo.net>
Newsgroups: gmane.emacs.bugs
Subject: bug#65734: [BUG] kill-whole-line on folded subtrees [9.6.8
 (release_9.6.8-3-g21171d @ /home/w/usr/emacs/0/29/0/lisp/org/)]
Date: Thu, 07 Sep 2023 13:43:57 +0000
Message-ID: <878r9inlnm.fsf__21270.7079526567$1694094263$gmane$org@localhost>
References: <87il8pao4l.fsf@whxvd.name> <87tts8vrpb.fsf@localhost>
 <83h6o84yz1.fsf@gnu.org> <87ledju2j7.fsf@localhost>
 <837cp3333w.fsf@gnu.org> <87pm2upajy.fsf@localhost>
 <83il8mz3nf.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="4653"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: 65734@debbugs.gnu.org, emacs-orgmode@gnu.org, iota@whxvd.name
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 07 15:44:15 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.92)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1qeFIt-00010i-5W
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Sep 2023 15:44:15 +0200
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1qeFIg-0006wd-8J; Thu, 07 Sep 2023 09:44:02 -0400
Original-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 <Debian-debbugs@debbugs.gnu.org>)
 id 1qeFIe-0006tC-Pr
 for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2023 09:44:00 -0400
Original-Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1qeFIe-0000Jy-GP
 for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2023 09:44:00 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1qeFIg-0007Oq-4B
 for bug-gnu-emacs@gnu.org; Thu, 07 Sep 2023 09:44:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Ihor Radchenko <yantar92@posteo.net>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 07 Sep 2023 13:44:02 +0000
Resent-Message-ID: <handler.65734.B65734.169409419728382@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 65734
X-GNU-PR-Package: emacs
Original-Received: via spool by 65734-submit@debbugs.gnu.org id=B65734.169409419728382
 (code B ref 65734); Thu, 07 Sep 2023 13:44:02 +0000
Original-Received: (at 65734) by debbugs.gnu.org; 7 Sep 2023 13:43:17 +0000
Original-Received: from localhost ([127.0.0.1]:38916 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1qeFHx-0007Ni-50
 for submit@debbugs.gnu.org; Thu, 07 Sep 2023 09:43:17 -0400
Original-Received: from mout02.posteo.de ([185.67.36.66]:53333)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@posteo.net>) id 1qeFHu-0007NS-U6
 for 65734@debbugs.gnu.org; Thu, 07 Sep 2023 09:43:16 -0400
Original-Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 3B82F240107
 for <65734@debbugs.gnu.org>; Thu,  7 Sep 2023 15:43:07 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1694094187; bh=nLcyAH+MhlSPMDErdSkmEFNznBNe1Jdfd9zb77UFkPE=;
 h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From;
 b=cgumHZokZwa1VqOG3cpGupJqfEkjoceloPq/7aDXNtK6XIomfO5R9yuPnKdHb+grh
 IeXUO0BTFNcXRxYQqLo23Zy+2whx8EWqbzajFsmP9I9oRxTITLetqrachQkFK61TOH
 nExwn7BPZlCFIPlkgKByucDEDXWXjMrXZHwwi1xpoCFb2scyjgntZF7p9oXEWgJn6c
 tmttrWFzD7ZEJ8E0jUXfcdIqgE5fhkI8xE6gnTB+Ld9qIUv/5v3sd+t2quiUYREKRp
 80o0XtF654JYrzWEfsCh1UdgGAAPR9fxvjZVlo3qdrwK2H6GT/DEXMiWLfsG2Aqqo+
 Td7qrg0c919cw==
Original-Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4RhL6L3TQbz9rxG;
 Thu,  7 Sep 2023 15:43:06 +0200 (CEST)
In-Reply-To: <83il8mz3nf.fsf@gnu.org>
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Xref: news.gmane.io gmane.emacs.bugs:269658
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/269658>

Eli Zaretskii <eliz@gnu.org> writes:

>> We may have a misunderstanding here.
>> In "* Heading text :tag1:tag2:", everything is visible yet Org needs to
>> protect ":tag1:tag2: from being killed by `kill-line', but not from
>> `kill-whole-line'. Moreover, the behaviour also depends on the point
>> position - if point is inside ":tag1:tag2:", we fall back to the default
>> behaviour. And the whole "special" behaviour can also be switched off by
>> flipping `org-special-ctrl-k'.
>> 
>> Invisibility has nothing to do with this need.
>
> Isn't it true that invisibility is what causes the user expectations
> in this case to begin with?  Then saying that "invisibility has
> nothing to do with this" is not really accurate, is it?

There are two things I raised in the previous messages:
1. The specific bug reported, related to invisibility changes in
   after-change-functions
2. A request to extend `kill-whole-line' and `kill-line' to cater Org
   needs:
   - for invisible text in folded headings
   - for visible text, when `kill-line' is called on a heading

In this branch of the discussion, I am describing a request to deal with
visible text.

Hope I made things more clear now.

>> >> What about something like `end-of-visible-line-function'?
>> >
>> > That is also a possibility, but it will then affect kill-line
>> > _anywhere_ in the buffer, whereas a text property can have a more
>> > localized effect.  Are you sure kill-line will need this customization
>> > on the whole buffer?
>> 
>> Applying text property is not free - (1) we need to do it across the
>> whole buffer, which scales poorly; (2) we need to keep it updated as the
>> buffer changes, which scales even worse. In addition, adding more text
>> properties slow down redisplay, which Org already strains to its limits.
>
> I understand, but in my book correctness tramps performance, and I was
> trying to make the point that perhaps modifying the behavior of
> kill-line everywhere in Org buffers might be incorrect for some cases.

I think that `end-of-visible-line-function' might be more appropriate -
it does not reduce correctness (we can simply fall back to the default
behaviour when needed) and less problematic performance-wise, as I
described.

Or maybe some other idea. But not text properties - they are
problematic performance-wise. In addition, `org-kill-line' is sensitive
to point position (do different things at bol, before ":tag:...", and
inside it). I am not sure how to make things depend on point position
with text properties only.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>