From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id +I0nFleU1GZcFwAAqHPOHw:P1 (envelope-from ) for ; Sun, 01 Sep 2024 16:20:39 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id +I0nFleU1GZcFwAAqHPOHw (envelope-from ) for ; Sun, 01 Sep 2024 18:20:39 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=rMLfUaTI; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1725207639; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=WildApXIdR0WQC+rNWK8LluvR4fH+3ApCqkbi8HAEY0=; b=Cfx6JSi+Gki++J2wjH6g032R3fOOaNifO/UZKuZJKv8bhx57uiffAnCn6OqRZTsX29RbLX McRGy9/+4Fe7XhiABwvR+4eLCwFqGN+xAhpiYUoLDwqygaaXtiXw+DAiQIyejcorskNZwe s1n+yEM0hS3ZaZZxAyLd+aYJqHa7tb7UoOCPBkKwK60UkVsZ9OoxRFwhyZsLfuGgwVLfwI iUtXRCLTWGsq0I9stEsmryQx8NuGB+DXNbPwDU7F7Z0681/bInR93GlIkFWr5uTj+NwhXr 1suaPMk6qCRjsZWgFsc4v7S8egsfq6hGXobrvLp0QnfFnG+6j7yAPUASLVvuog== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1725207639; a=rsa-sha256; cv=none; b=aJBAT//3Ay0xlJ2/sKcROLrEHwqwTqI3Hjw6k3nL0qIkNpzCuH2a2TReJT7EJo7e0wVLP1 iZ24rLMfhGh/mM8m1HPsHCsCQJA6XzTdVkWSwwKvnlX7m0rZHjt+bLS4/fhbzUCOMqXX2L eoQzvu10tYVP+o6Up8mKxrjN4ctb+VU+/VNyiSBS7h3cyuMTtmgL2Zi8573yPH/ALA2D23 rZn85PHSp5eGRNgawN69gmhq8lvU018N2pThqT+SWf4V37mAGyBtpmdnq+scCrw/Uig3Jm RIYvaCAHhUkpZKPWYdcT0+2txl7fs/4km74rVMagUeYw5e8xPq6q51i94QaRGw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=rMLfUaTI; dmarc=pass (policy=none) header.from=posteo.net; 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" 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 EEFF6F97E for ; Sun, 01 Sep 2024 18:20:38 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sknIa-00020L-Cs; Sun, 01 Sep 2024 12:19:32 -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 1sknIX-0001zz-G7 for emacs-orgmode@gnu.org; Sun, 01 Sep 2024 12:19:30 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sknIU-00063z-PU for emacs-orgmode@gnu.org; Sun, 01 Sep 2024 12:19:29 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B7BC2240101 for ; Sun, 1 Sep 2024 18:19:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1725207564; bh=w6tgk3LF/uORFwKvgY72mhyjcKNJUnRITY6wY0RnPG4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:From; b=rMLfUaTIYP2ONzzbqbDWGX9B75me8WzhCnyxGjp+4TGrknMmA1uh6LIg0LBPZqIox mtepoyFV0wttuDCEK8W/55bXraIWs91iXmRegXXWSNgoSRueGJtH78DETm4CjRe+/f RLbeFu1ibPva94rzLGaiSgAizNrmP2nkv5xdTmUCeAsjzOt7L2hPgM0oa29NCzXsEZ MyYwl5R8ihOlcEZF1ueIkq5UgDalrC9uGUGh/NYK4aLQHHHCMSiOP46qtqcecCYItP fFu1WM5oYvwEM02ViB0z+BKmMRhB09fDTtR4YEwinya1s6p4BZBnyUWhpFfCZd5Vvm hR/tmRa9dyI2A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WxcXW46Bpz6twS; Sun, 1 Sep 2024 18:19:23 +0200 (CEST) From: Ihor Radchenko To: Dan Drake , Rudolf =?utf-8?Q?Adamkovi=C4=8D?= Cc: emacs-orgmode@gnu.org Subject: Re: org-cut-subtree should respect org-ctrl-k-protect-subtree In-Reply-To: References: Date: Sun, 01 Sep 2024 16:20:47 +0000 Message-ID: <87y14bpcps.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: , 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-Spam-Score: -6.71 X-Spam-Score: -6.71 X-Migadu-Queue-Id: EEFF6F97E X-Migadu-Scanner: mx11.migadu.com X-TUID: 2RuOBDZkBFhL Dan Drake writes: > I customized org-ctrl-k-protect subtree so that when point is on a > headline for an entry with some folded content, ctrl-k asks for > confirmation first. > > However, I also have the "k" speed key set up; to me, doing ctrl-K and > the "k" speed key are the same, but only ctrl-K respects the "protect > subtree" variable. > > I took at look at the source code, and it seems like a trivial change > to make these two things act consistently: by default, the "k" speed > key calls org-cut-subtree. I copied over the "when" snippet from > org-kill-line (which is what ctrl-K ends up calling), and this seems > to work as expected: > ... > ... > Could this change be included in org? I am not sure. `org-ctrl-k-protect-subtree' is only relevant when `org-special-ctrl-k' is set to non-nil, which is not the default. When users set `org-special-ctrl-k', C-k will become context-sensitive - on normal lines it will kill like, while on headings it will kill the whole subtree. Some users complained that it may be easy to confuse killing a line a subtree, especially when the subtree being killed is folded. That's why we have `org-ctrl-k-protect-subtree' customization - it is very, very specific. I am not even sure if many users use it in the way it was designed. In contrast, "k" and its normal binding C-c C-x C-w are calling `org-cut-subtree' command which has a _single_ purpose - cut a subtree at point. So, every time the user invokes the relevant key binding, the intention is not ambiguous as it might be with C-k. Except accidentally pressed keys, of course. AFAIU, what you are struggling with is that you sometimes press "k" by accident, without aiming to cut the subtree. Is my understanding correct? Rudolf Adamkovi=C4=8D writes: > I think the logic should be > extracted into a function, > and tested on all paths: > - `org-kill-note-or-show-branches' (`C-c C-k'), This one does not modify anything in the buffer. What do you want to protect here? Rudolf Adamkovi=C4=8D writes: > However, we should then also rename > `org-ctrl-k-protect-subtree' > to something more general, like > `org-protect-subtrees', > as it applies beyond "ctrl-k". As you saw, the purpose of this option is very specific now. I am not sure if it is a good thing to expand its scope. May you list the editing commands that you think can benefit from an extra confirmation dialog? Rudolf Adamkovi=C4=8D writes: > I like that name, but perhaps we should zoom out a bit and look at the > entire family of the non-idiomatic `org-ctrl-*' variables. ... which are `org-ctrl-k-protect-subtree', `org-ctrl-c-ctrl-c-hook', and `org-ctrl-c-ctrl-c-final-hook'. What do you want to do with the latter two? --=20 Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at