From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id iFZ4OqoI9mS5nQAA9RJhRA:P1 (envelope-from ) for ; Mon, 04 Sep 2023 18:41:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id iFZ4OqoI9mS5nQAA9RJhRA (envelope-from ) for ; Mon, 04 Sep 2023 18:41:15 +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 930705C770 for ; Mon, 4 Sep 2023 18:41:14 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=whxvd.name header.s=MBO0001 header.b=y4t+NoK0; 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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1693845674; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=pI41S7ipJAm3ewnaURbeoDsDoW9LRfS1y3HeQxVDKRc=; b=Nb2rdvIRBNQwCl6lvY6mK4z2xmffOQCSuhcGyM+77HFstB8rsfReHSqtJk9QzL7XcwPYyh Wjwv6H7gfXde1L8evg7eXhj6f9y0GK4H+EE5U5AYdd7sivOEblDnCJ7HvpzIRs7CEq/ynU J2DFF60SGBhYZcAuQRoUPbLc9Tyc/QHd00h4KY/GAYp73F0bhRPA+MZC4ahqbQ4wb/1Rik XeKR0ku6UKy+nnLt6K6D0Q9gfUxVh2BIjmR7K8NRp9cKWyaCjnxqhn6N9zf9vVyHdGPVwP Qs6u0UHSR0McT5rzIIKubT7ojN30pMMdqpOufIUhcqJgRFJlu4K5qN3A+diX7A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=whxvd.name header.s=MBO0001 header.b=y4t+NoK0; 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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1693845674; a=rsa-sha256; cv=none; b=PCocJAGrktWM1PIeT4rzjmozqi0+KoiIJOPWPK+CWMD2tFBQFBUgjFL04fLXkE51cFVk1Y koHmRtkj5Vv1iwREWS7A8fJWqO6SGopnYUAkTZMPXSKOx9WznGfNdcl7pUp6xmjjpCxTgy NEqLelIuXKyPB1fjRa1kqlyAPemEaWjYSMpj1LLV2n8ltFJk/sac4FLAlca6mRGLFd5Fhd o0HCyRuq8U+iGfB4khFX0KNMjMvNFEHiCl1eEOX41uJ2PQe8pB4GLDUE/dSqfD+RjOyA/h ST8ifqsVvUhTkReNhn9aLD2b4qYrb+amwNxKZbS3AD0xEqbB6tYYDvgbMkQJZA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdCcV-0004pc-2t; Mon, 04 Sep 2023 12:40:11 -0400 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 1qdCcO-0004pG-F7 for emacs-orgmode@gnu.org; Mon, 04 Sep 2023 12:40:04 -0400 Received: from mout-p-102.mailbox.org ([80.241.56.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1qdCcL-000595-AD for emacs-orgmode@gnu.org; Mon, 04 Sep 2023 12:40:04 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4RfZ9l1hxHz9sX0 for ; Mon, 4 Sep 2023 18:39:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=whxvd.name; s=MBO0001; t=1693845595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=pI41S7ipJAm3ewnaURbeoDsDoW9LRfS1y3HeQxVDKRc=; b=y4t+NoK0iZng6evMmiIJGAXN6gDx0ubQtN53jGlZhGgmGFwQByZnETIwwChELXl3L1jrPj GyuMGEZjy22S0zsgrFu+Xs8ASGBbOa0yTHxB5oMvqjs+iUBHWxNegns3Rres/GDgGT+0bf 7PUtQC+NIe2ggW8v1koLUsoL3Cvtwywgk2gPzE8D8bTGoDpBOTfvrXQHZGRVcD1D7GY01U SwwP6BsfnOAmtanlEV3OE1q3m8l1sFKvezgoHDjjq0b9h0K5RJmIeN3BJU6BGs+vC9DWOT B/d+ATa8p8PuUaGtufO/wJqiskshZVvyx/OE/ZM/MzV9MF2b8bMbgWwmynvzaA== From: Sebastian Miele To: emacs-orgmode@gnu.org Subject: [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: Mon, 04 Sep 2023 18:30:38 +0200 Message-ID: <87il8pao4l.fsf@whxvd.name> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: 4RfZ9l1hxHz9sX0 Received-SPF: pass client-ip=80.241.56.152; envelope-from=iota@whxvd.name; helo=mout-p-102.mailbox.org X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 930705C770 X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: -7.13 X-Spam-Score: -7.13 X-TUID: bxKyuFJ6hYxK In an emacs -Q, create an Org buffer with the following contents: --8<---------------cut here---------------start------------->8--- * AB ** C --8<---------------cut here---------------end--------------->8--- Fold the subtree under the heading AB, so that only a single line is displayed (ending in "..."). With point between A and B, hit C-S- (kill-whole-line). Expected: The whole _visible_ line, i.e., the entire contents of the buffer is erased. Actual behavior: The line with heading C remains. Contrast this with the same experiment, except that the point is at the beginning of the line containing AB when hitting C-S-. Then the expected behavior happens. According to the source of kill-whole-line, the intended effect indeed is to kill a whole _visible_ line. The following patch to the Emacs sources fixes the issue: diff --git a/lisp/simple.el b/lisp/simple.el index abd587245fe..44221f3fc24 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6649,9 +6649,7 @@ kill-whole-line (unless (bobp) (backward-char)) (point)))) (t - (save-excursion - (kill-region (point) (progn (forward-visible-line 0) (point)))) - (kill-region (point) + (kill-region (save-excursion (forward-visible-line 0) (point)) (progn (forward-visible-line arg) (point)))))) (defun forward-visible-line (arg) The reason for the issue probably is: Without the patch, the killing happens in two stages. The first kill-region kills from the beginning of the line until after the A. That kills the leading *. That probably somehow triggers Org visibility changes. With the patch applied the whole killing happens in one stage, probably without causing an intermediate change of visibility. I first reported this to bug-gnu-emacs@gnu.org (see https://debbugs.gnu.org/65734). However, Eli asks: > I'm not sure I understand why this is deemed a problem in Emacs. > Shouldn't Org redefine C-S- if the default binding doesn't > suit what happens in Org buffers? Did you discuss this with Org > developers? Emacs : GNU Emacs 29.1.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.17.8) of 2023-09-04 Package: Org mode version 9.6.8 (release_9.6.8-3-g21171d @ /home/w/usr/emacs/0/29/0/lisp/org/)