From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id GOzMAX0b3mQY5gAASxT56A (envelope-from ) for ; Thu, 17 Aug 2023 15:07:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id WCCLAX0b3mRjEwEAauVa8A (envelope-from ) for ; Thu, 17 Aug 2023 15:07:09 +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 644154A70F for ; Thu, 17 Aug 2023 15:07:08 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WcxYzxbC; 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=1692277628; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=l1/rAsIpc6BtPRN/MzLVJRyCpeuIvSZ1T0G3ExDd5SI=; b=gn3NthqQOv2zj+W7yYTICi1FxIpvvnNbZrGIohmUbPXdubMAZMNqwJKOjArX4RvPB5kij0 +OLVboc0qff/D0RB3095wKRBlKVTin8VkOdEiZa77tvxRoc5DGl9BdlhLbfZV534aD5k8D sRj75vHlAXPLriXiKz2tIjjhC8nWckCusGtKedXPRhPc4JBNjlhue+wDAXPEO12FRZgzmw ePxUP1ZsgkqIa+XroiVUeXzh8NBaOsKWxgHYNoS+j9eCc8u/LV2YnSyn0UwcJAUdW8u+Oc yKGbNAJItvbtLYNwBT7OGJ9nHvNPu5Fsbtdo0VRYgkH76IJcz/q7PncKSVB8zQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692277628; a=rsa-sha256; cv=none; b=qXBjSnOtEul/Odwny5zeRFsOGABZpkeZSxda4h8BFbvn4BfAIyUuKTXc/1Cz1N3pJNaxGv Wh57tv0TQwkhHRN7V10M01lV7tAzSEBxmzZ4/VVlGhLcUGw1m1D0A8DOCX7rVGkXw4Uwr5 Ejmwf7E/C99AD35iPRhUUtXtsAXggT36R5ZGBkwttmu9tltag1MDc/DYHYNIkEHQzpBwHD lHE2KphH5ezagiUA3WJeZJvOPXLfj/Vyfp3HNMgBRjTXb9Naj+dUza5OEY0v4FF9/5fKQF w+Ph1qLIm+lg4ZMpO93C/Hd1yXCYbg+4gHb0qtN7gI/rYzW9EdCIQhK3hLxMDQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=WcxYzxbC; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWchb-0007w5-VM; Thu, 17 Aug 2023 09:06:15 -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 1qWcha-0007up-Sn for emacs-orgmode@gnu.org; Thu, 17 Aug 2023 09:06:14 -0400 Received: from mail-qt1-x82d.google.com ([2607:f8b0:4864:20::82d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWchW-0001OH-2D for emacs-orgmode@gnu.org; Thu, 17 Aug 2023 09:06:14 -0400 Received: by mail-qt1-x82d.google.com with SMTP id d75a77b69052e-40ff45065c9so48909211cf.0 for ; Thu, 17 Aug 2023 06:06:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692277567; x=1692882367; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=l1/rAsIpc6BtPRN/MzLVJRyCpeuIvSZ1T0G3ExDd5SI=; b=WcxYzxbC65/ecMMoETKMkVcvn/2NzmJ62Hp9ZpZcB4OZ2AqiVfV+4zR2MhWQ8bSQpH APldLDObZmUO5O6E/QA1C7MqCOEhHervzUnOyATdFH85Ja05qBa17E1pnemrU6B6wwof xjRNSOPL6ot8o1G69SSRjES0cgfkhGn9u0p0GYolitsygZIPMcfge7/IKvU3lGI3/vXn chkAVc96jGlYYiz4kHThp+rullSwM+V4bkRjukKXFscD0M9eMk8X7tPDNvEgFTx01uh1 +/YPIDFMyZktEc2mLGQ8T4pTlxUhaq9qpfLTySR8vTdlTImy21UKsfPzG/n49ZlpZN+U 1gqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692277567; x=1692882367; h=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=l1/rAsIpc6BtPRN/MzLVJRyCpeuIvSZ1T0G3ExDd5SI=; b=CW0uwdtPzd15OMvtjegapcUYwfNcEGx2wqYESzH+OFItCiVt5O3SBh6dZLlRN+IVDb ScAKt34SDuJGfZ8SkrrTVvFozzpRKL2/lw5a2oNPP7J7JcsHfBEF+aPQP0UhI85Oo0vu keuwrsBwHfd0aE4VUObsbV/axsUsCYdlHPTl9jlhOENCM4flfE+7XPr65oEP4qCKTiVg LR/2zfGOH12Efx98Be+BXCuIodqYRC3hTFUVHWgDbJRtQuuv/4dI0sjbrG/iL+6Eu2jw wEcFSi6nv0EC0Ja7HhKwGa5azjC9X4jjL4ZJNRIjD+SOTKYcfX6564Z2fGLIskxb6KCI zZ4A== X-Gm-Message-State: AOJu0YxWL3hmVbmfevdL++5Y7n8kLkp4bLtSaOkdloxLpv70oVpmNWo1 HNqp30ogLt/GSa50PkCggJDjVIBaKJnsYnB3nJUPY/us/ek= X-Google-Smtp-Source: AGHT+IEfYKizLw+H0M5MlLEFKdjiPeH5Dddb4thnTmdfcoL4amx1UM0plSDkd5jtXwYqfAJ2LlnYhN/4v/AnA/hBm7o= X-Received: by 2002:a0c:cb8b:0:b0:63c:f5c0:cd14 with SMTP id p11-20020a0ccb8b000000b0063cf5c0cd14mr4671632qvk.49.1692277567457; Thu, 17 Aug 2023 06:06:07 -0700 (PDT) MIME-Version: 1.0 References: <877cpvqkcb.fsf@localhost> <871qg3qj8q.fsf@localhost> <87jztvou08.fsf@localhost> <87fs4hrjmn.fsf@localhost> In-Reply-To: <87fs4hrjmn.fsf@localhost> From: Michael Dauer Date: Thu, 17 Aug 2023 15:05:55 +0200 Message-ID: Subject: Re: BUG: org-cut-special on inlinetask kill until point-max To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="000000000000450ea306031e13b9" Received-SPF: pass client-ip=2607:f8b0:4864:20::82d; envelope-from=mick.dauer@gmail.com; helo=mail-qt1-x82d.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -6.98 X-Migadu-Scanner: mx2.migadu.com X-Migadu-Queue-Id: 644154A70F X-Spam-Score: -6.98 X-TUID: zcLyD16kK3JJ --000000000000450ea306031e13b9 Content-Type: text/plain; charset="UTF-8" I understand your view. From the user perspective inline task are still more a specialization of a task, which is a specialisation of a heading. Here is my implementation of how I see it that it should behave: (defun pm-cut-special () "Like org-cut-special but also works on inlinetask." (interactive) (if (not (eq 'inlinetask (save-excursion (org-back-to-heading t) (org-element-type (org-element-context))))) (funcall-interactively 'org-cut-special) (org-inlinetask-goto-beginning) (let ((begin (point))) (org-inlinetask-goto-end) (kill-region begin (point)) (message "Cut: Inline Task")))) (defun pm-copy-special () "Like org-copy-special but also works on inlinetask." (interactive) (if (not (eq 'inlinetask (save-excursion (org-back-to-heading t) (org-element-type (org-element-context))))) (funcall-interactively 'org-cut-special) (org-inlinetask-goto-beginning) (let ((begin (point))) (org-inlinetask-goto-end) (copy-region-as-kill begin (point)) (message "Copied: Inline Task")))) (defun pm-paste-special (arg) "Like org-paste-special but also works on inlinetask." (interactive "P") (if (not (eq 'inlinetask (with-temp-buffer (org-mode) (insert (current-kill 0 t)) (goto-char (point-min)) (org-element-type (org-element-context))))) (funcall-interactively 'org-paste-special arg) (unless (eq (point) (pos-bol)) (forward-line)) (yank))) There is a fine-tuning outstanding: The criteria whether to paste before or after the current line should not be the point on the begin-of-line but the beginning of the actual heading (after the asterisks). Am Do., 17. Aug. 2023 um 13:30 Uhr schrieb Ihor Radchenko < yantar92@posteo.net>: > Michael Dauer writes: > > > I probably mis-interpreted the code. Because then I would also fail for > > normal headings. Just thinking about the symptoms I think the issue Is > that > > (org-end-of-subtree) works with type 'headline. And inlinetask is a > > different type, right? > > Yes. Inlinetask is not considered a subtree of its own. > Just like other foldable elements (lists/drawers/blocks) are not > considered subtrees. > > > IMO org-mode should consistently treat inlinetasks including the END line > > as a branch. Then org-cut-special would do something useful on them, i.e. > > cutting the inlinetask includinging its contents and the END line. > > It would not be consistent. We already do not treat, for example, lists > special in `org-cut-special'. > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at > --000000000000450ea306031e13b9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I understand your view. From the user=C2=A0perspective inl= ine task are still more a specialization of a task, which is a specialisati= on of a heading.

Here is my implementation of how I see = it that it should behave:
(defun pm-cut-special ()
=C2=A0 &quo= t;Like org-cut-special but also works on inlinetask."
=C2=A0 (inter= active)
=C2=A0 (if (not (eq 'inlinetask (save-excursion (org-back-to= -heading t) (org-element-type (org-element-context)))))
=C2=A0 =C2=A0 = =C2=A0 (funcall-interactively 'org-cut-special)
=C2=A0 =C2=A0 (org-i= nlinetask-goto-beginning)
=C2=A0 =C2=A0 (let ((begin (point)))
=C2=A0= =C2=A0 =C2=A0 (org-inlinetask-goto-end)
=C2=A0 =C2=A0 =C2=A0 (kill-regi= on begin (point))
=C2=A0 =C2=A0 =C2=A0 (message "Cut: Inline Task&q= uot;))))

(defun pm-copy-special ()
=C2=A0 "Like org-copy-spe= cial but also works on inlinetask."
=C2=A0 (interactive)
=C2=A0 = (if (not (eq 'inlinetask (save-excursion (org-back-to-heading t) (org-e= lement-type (org-element-context)))))
=C2=A0 =C2=A0 =C2=A0 (funcall-inte= ractively 'org-cut-special)
=C2=A0 =C2=A0 (org-inlinetask-goto-begin= ning)
=C2=A0 =C2=A0 (let ((begin (point)))
=C2=A0 =C2=A0 =C2=A0 (org-= inlinetask-goto-end)
=C2=A0 =C2=A0 =C2=A0 (copy-region-as-kill begin (po= int))
=C2=A0 =C2=A0 =C2=A0 (message "Copied: Inline Task"))))<= br>
(defun pm-paste-special (arg)
=C2=A0 "Like org-paste-special= but also works on inlinetask."
=C2=A0 (interactive "P")<= br>=C2=A0 (if (not (eq 'inlinetask
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(with-temp-buffer
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-mode)
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(insert (current-kill 0 t))
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char (point-mi= n))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(org-e= lement-type (org-element-context)))))
=C2=A0 =C2=A0 =C2=A0 (funcall-inte= ractively 'org-paste-special arg)
=C2=A0 =C2=A0 (unless (eq (point) = (pos-bol))
=C2=A0 =C2=A0 =C2=A0 (forward-line))
=C2=A0 =C2=A0 (yank))= )

There is a fine-tuning outstanding: The crit= eria whether to paste before or after the current line should not be the po= int on the begin-of-line but the beginning of the actual heading (after the= asterisks).



Am Do., 17. Aug. 2023 um 13= :30=C2=A0Uhr schrieb Ihor Radchenko <yantar92@posteo.net>:
Michael Dauer <mick.dauer@gmail.com> writes:

> I probably mis-interpreted the code. Because then I would also fail fo= r
> normal headings. Just thinking about the symptoms I think the issue Is= that
> (org-end-of-subtree) works with type 'headline. And inlinetask is = a
> different type, right?

Yes. Inlinetask is not considered a subtree of its own.
Just like other foldable elements (lists/drawers/blocks) are not considered= subtrees.

> IMO org-mode should consistently treat inlinetasks including the END l= ine
> as a branch. Then org-cut-special would do something useful on them, i= .e.
> cutting the inlinetask includinging its contents and the END line.

It would not be consistent. We already do not treat, for example, lists
special in `org-cut-special'.

--
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>
--000000000000450ea306031e13b9--