From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko 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, 11 Jan 2024 18:08:11 +0000 Message-ID: <87bk9rivzo.fsf__13764.73529251$1704996394$gmane$org@localhost> References: <87il8pao4l.fsf@whxvd.name> <87tts8vrpb.fsf@localhost> <83cyyw4of7.fsf@gnu.org> <875y4ovct9.fsf@localhost> <875y04yq9s.fsf@localhost> <875y02y0da.fsf@localhost> <87frz6w2zt.fsf@localhost> <83cyu9nyea.fsf@gnu.org> <87sf35pcds.fsf@localhost> <83y1cxmgws.fsf@gnu.org> <87ttnjj2dp.fsf@localhost> <83bk9rlusw.fsf@gnu.org> <87h6jjj17y.fsf@localhost> <838r4vlt0n.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="29201"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65734@debbugs.gnu.org, manikulin@gmail.com, emacs-orgmode@gnu.org, monnier@iro.umontreal.ca, iota@whxvd.name To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 11 19:06:25 2024 Return-path: 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 ) id 1rNzRg-0007JZ-RL for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Jan 2024 19:06:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNzRO-00004y-Q4; Thu, 11 Jan 2024 13:06:06 -0500 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 ) id 1rNzRN-0008V8-4v for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 13:06:05 -0500 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 ) id 1rNzRM-0008Oi-RZ for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 13:06:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rNzRK-0005cF-3l for bug-gnu-emacs@gnu.org; Thu, 11 Jan 2024 13:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Jan 2024 18:06:02 +0000 Resent-Message-ID: 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.170499631121498 (code B ref 65734); Thu, 11 Jan 2024 18:06:02 +0000 Original-Received: (at 65734) by debbugs.gnu.org; 11 Jan 2024 18:05:11 +0000 Original-Received: from localhost ([127.0.0.1]:33845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNzQU-0005ag-Qm for submit@debbugs.gnu.org; Thu, 11 Jan 2024 13:05:11 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:42941) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rNzQR-0005a8-43 for 65734@debbugs.gnu.org; Thu, 11 Jan 2024 13:05:08 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id A2ED2240027 for <65734@debbugs.gnu.org>; Thu, 11 Jan 2024 19:05:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1704996303; bh=lTse73jpxmOQOLqRc3wxjXnVtlcEXBtKhqALK1wuoKQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=jwKBGvqCti3ygM+MsxXOKBy5pnC5UafrQOvS7daIWU3Wbt5C3q+kUu8N4fZUxMlrv g13hSukRHz1w84vaaCmy7yGCn27QhH/Wo5ZSArNE7HSRPJJfmVkR6A/o1rZk0pTjNP bjqma5lbYrqIt1f9lZ0Jozm4vPutRMwlFxaasK0PmtoZMz2TvAEorEwoOEBwGFiFfd PUUDcFvRWgjeXgtvELzzCJZX79pY8z09Ud14M/Yj8GoXgxfKj4g/Z6TBcKFZJgpIJK d5RdnK4cbbDh7i4Dl0pRWydkuXpwmjFFXx8Wj1XheXtzYz92/yv2iMCwsBbBpLO3Ws nx0ZNCN5bSqJw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4T9syQ3F2jz6tvw; Thu, 11 Jan 2024 19:05:02 +0100 (CET) In-Reply-To: <838r4vlt0n.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" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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:277925 Archived-At: Eli Zaretskii writes: >> > How would kill-line know that it's about to kill a subtree? All it >> > knows is that it is killing some invisible text. >> >> I imagine the following: >> >> 1. `kill-*-line' function will, by default, test if invisible text of >> length size is killed and query the user when called interactively. >> >> 2. Major modes could also set buffer-local `kill-line-query-function' >> that will return nil when killing should proceed without query or a >> string with query text. > > If the command is only sensitive to invisible text, it could warn > about so-and-so many invisible characters being killed, but it could > not warn about "subtrees", which is what you wanted. Invisible text > in a buffer could have nothing to do with subtrees, even if the buffer > is under org-mode. Let me elaborate. In Elisp, I am thinking about something like: (defvar-local kill-line-query-function #'kill-line-query-default) (defun kill-line-query-default (beg end) (let ((nlines )) (when (> nlines threshold) (format "Kill %d invisible lines? " nlines)))) Then, Org mode can instead have (setq-local kill-line-query-function #'org-kill-line-query) (defun org-kill-line-query (beg end) (org-with-point-at beg (when (and (org-at-heading-p) (progn (end-of-line) (and (< (point) end) (org-fold-folded-p)))) "Kill hidden subtree along with headline? "))) -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at