From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id SIKlJuC71GZYzgAAe85BDQ:P1 (envelope-from ) for ; Sun, 01 Sep 2024 19:09:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id SIKlJuC71GZYzgAAe85BDQ (envelope-from ) for ; Sun, 01 Sep 2024 21:09:20 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hEHUqNOO; 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=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1725217760; 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=TYhGgnKbrb/+v+v8HmWpCVUXaZJRfiikksDHKsZ8tzI=; b=rtI7RVlvBbu6JRCSgh2dcTHq/7U0+CTElADSUUZmKf0T/wHNcLCR1gEH65i3ZzYN4MnY3W yhVefWUmLAXa7ozm+nZXW7+oEJ3jgC7BWrIbaPxCWFRF2wMrul50KEArug/+pFHX/3636N 5Cq92o/RjsxGBLm2lj2FG77UK1M5XuT+zjsgN0nGhHQAKi9uzEBJPWxgd2ls9Xcw4lzVF5 LfhrxwHiY6dTZy/cJs1daCFjA6t60Gjw1JkM20B6f8LtNZmgsdbC5W1vK0QCd4cD7IaY2z mRyPDBIohf4g+wekz6H6vbZYQ58PBmHicK/CXkYlWa8deQ1OWTRNtSivDJrXlQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=hEHUqNOO; 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=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1725217760; a=rsa-sha256; cv=none; b=NrZBJXkOXdhHDl/3zok/8+AA7nHSPMNfyl0YkTKD2PWcskStMZW0IsJ/3HxgtXnzNL6bgQ mGwJJJKAhwTEswt9+PqkrtgpQgYkPgJzbpAk9b2kRhqdT5xjXrJsz/U3GuVg0yVoA51BAi dt2KlY8wVgsr+1d1jKEo46I3Tp3TF23CKuumZx4s4fbqYVZGHUFY0r6jWSMm/xtfFscTRh LYmQN/0tiYP6pcgChZk8ln1ruTbH1Hpk48PJ7+oTw5+RgWNk9RvOJ15ghGamPMGMrOpG/O 30f+X3dutv1y8Q7xgSF5wlPZPJsrPyYVoQGHdeyDaNyf6YAuFe07J4FTVDiUsQ== 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 53E0B691C6 for ; Sun, 1 Sep 2024 21:09:20 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1skpeB-0001YN-MT; Sun, 01 Sep 2024 14:49:59 -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 1skpe9-0001Xs-Pe for emacs-orgmode@gnu.org; Sun, 01 Sep 2024 14:49:58 -0400 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1skpe7-0003zy-Mi for emacs-orgmode@gnu.org; Sun, 01 Sep 2024 14:49:57 -0400 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-277c861d9f6so1013010fac.2 for ; Sun, 01 Sep 2024 11:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725216594; x=1725821394; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=TYhGgnKbrb/+v+v8HmWpCVUXaZJRfiikksDHKsZ8tzI=; b=hEHUqNOOYcRfrp7Sh94BNUnqDoEhaGC6lDJqSQHvZUtedWDpRcPUlDUP5rbgBVgaxH Hp7uGQP7XowaIpDX3sJTazgAT9AH0J1HjeQvUb9S4GzdXNC2QU9vvijGEkuyu98+e6wJ yLJq9f8TLWgNilZqEerW8JaPKAvULFmhzBfBbpZMzGRswW/n2biZ4PsRVhdc2iY1KZzR x1wh7IidW/NeRQIIMr0VI1wHBCLkD/UKoWxEDNmusYbTudrJAsopIC0QJ142ng6oIVTJ EC59no9T57kYZTktSGUWTVwDWrrasgqammrLkFczbHA6TEgnDZG8UZfZeNCkXjEnngWY FWMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725216594; x=1725821394; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TYhGgnKbrb/+v+v8HmWpCVUXaZJRfiikksDHKsZ8tzI=; b=ZKfwRPhe2WxgngRKqSXSWIJ1IZJd3BjUAmaA7t+QhU1n3olwegLUocBqvSZL2KbSKO 0ZR3vworJFCYnUWxwFXQxyYpIVLKbYN/lqdCbZOFNrNkTl9MyRDOreVx7rxzC/lYURt8 RYdgDgb/QsLfwdxba7jlcE92gAFRlHP/bNj2MQt5StghG+rcw6ZxbtH6Lc3hOKWsZUVT 3Y5TcOboKakYxSN/HJPOrwffDceH2pkqEabcoSQaocLCjnSZSHpQ7oR8ug+qDtdbuZ/t 7AdjmEIFRo/OcL4bKbVhl5bmqhKIyAC7OolvTYG8gWcR4qCI3hPD4nzi68ZT2HEHPz5S vsUg== X-Forwarded-Encrypted: i=1; AJvYcCVOn83lgqH75wyvmJqmGB/hZvFEPaQ6e50XZ0pjW9V2UaIBV+BTSeLwVE0QSlqaU1LoE7hXRLLqokYXgwB/@gnu.org X-Gm-Message-State: AOJu0YyT0yhT7xdycY0sjvDDvIi7a9bQvFFxuI7D2HEoWUF2EhrGjG5P 4Tdg8cmW0Rdp131OT6w/Z8Oh7y1ZlOzOMuFDpkdZshw6GYf31Mj9tqO7aVLdfrZ7MuKosEyB0Ia SGAtIlPJ7GA8UmVkIdri7pFCCG7U= X-Google-Smtp-Source: AGHT+IF5llXkaO8hohbDG5f8BpYH+QQhouW1EFqsIySNjZh8m3+1cF038SkOEIMPMfh0TaTgfi5xuGNiK8lTFiqSa98= X-Received: by 2002:a05:6870:55ce:b0:277:e039:7aef with SMTP id 586e51a60fabf-277e0398793mr3634739fac.8.1725216594043; Sun, 01 Sep 2024 11:49:54 -0700 (PDT) MIME-Version: 1.0 References: <87y14bpcps.fsf@localhost> In-Reply-To: <87y14bpcps.fsf@localhost> From: Dan Drake Date: Sun, 1 Sep 2024 13:49:42 -0500 Message-ID: Subject: Re: org-cut-subtree should respect org-ctrl-k-protect-subtree To: Ihor Radchenko Cc: =?UTF-8?Q?Rudolf_Adamkovi=C4=8D?= , emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2001:4860:4864:20::2d; envelope-from=dan.drake@gmail.com; helo=mail-oa1-x2d.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." 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-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -9.80 X-Migadu-Queue-Id: 53E0B691C6 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -9.80 X-TUID: erPC2XBscbac "AFAIU, what you are struggling with is that you sometimes press "k" by accident, without aiming to cut the subtree. Is my understanding correct?" Yes, that's correct. Sometimes I'd use the speed key accidentally and cut the subtree. On Sun, Sep 1, 2024 at 11:19=E2=80=AFAM Ihor Radchenko wrote: > > 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 t= he > > 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? > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at --=20 Ceci n'est pas une .signature.