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 <
yanta...@posteo.net>:

> Michael Dauer <mick.da...@gmail.com> 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 <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>

Reply via email to