BUG: org-cut-special on inlinetask kill until point-max

2023-08-16 Thread Michael Dauer
>>>
* h1
*** ilt
*** END
** h11
* h2
<<<
org-cut-special somewhere on the send line kills all but the first line.

Org mode version 9.7-pre (release_9.6.7-594-gf03b83
I don't think that this bug existed in the previous versions.


Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-16 Thread Ihor Radchenko
Michael Dauer  writes:


> * h1
> *** ilt
> *** END
> ** h11
> * h2
> <<<
> org-cut-special somewhere on the send line kills all but the first line.

I am unable to reproduce.
May you please provide more detailed steps?
In particular, which line are you referring to?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-16 Thread Michael Dauer
Put the point on the second line - the inlinetask "ilt".

Am Mi., 16. Aug. 2023 um 13:47 Uhr schrieb Ihor Radchenko <
yanta...@posteo.net>:

> Michael Dauer  writes:
>
> 
> > * h1
> > *** ilt
> > *** END
> > ** h11
> > * h2
> > <<<
> > org-cut-special somewhere on the send line kills all but the first line.
>
> I am unable to reproduce.
> May you please provide more detailed steps?
> In particular, which line are you referring to?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-16 Thread Ihor Radchenko
Michael Dauer  writes:

> Put the point on the second line - the inlinetask "ilt".

I tried the following:

1. make repro REPRO_ARGS="/tmp/bug.org"
2. Move to **... ilt line

* h1
*** ilt
*** END
** h11
* h2


3. M-x org-cut-special

* h1
*** END
** h11
* h2

As expected.

Then, I also tried

1. make repro REPRO_ARGS="-l org-inlinetask /tmp/bug.org"
2. Move to **... ilt line

* h1
*** ilt
*** END
** h11
* h2


3. M-x org-cut-special

* h1
* h2

Is it what you are seeing?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-16 Thread Michael Dauer
No. Here also * h2 gets killed by org-cut-special.

What is REPRO_ARGS? org-onlinetask.el is included org repo anyway?

Ihor Radchenko  schrieb am Mi., 16. Aug. 2023, 14:11:

> Michael Dauer  writes:
>
> > Put the point on the second line - the inlinetask "ilt".
>
> I tried the following:
>
> 1. make repro REPRO_ARGS="/tmp/bug.org"
> 2. Move to **... ilt line
>
> * h1
> *** ilt
> *** END
> ** h11
> * h2
>
>
> 3. M-x org-cut-special
>
> * h1
> *** END
> ** h11
> * h2
>
> As expected.
>
> Then, I also tried
>
> 1. make repro REPRO_ARGS="-l org-inlinetask /tmp/bug.org"
> 2. Move to **... ilt line
>
> * h1
> *** ilt
> *** END
> ** h11
> * h2
>
>
> 3. M-x org-cut-special
>
> * h1
> * h2
>
> Is it what you are seeing?
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-16 Thread Ihor Radchenko
Michael Dauer  writes:

> No. Here also * h2 gets killed by org-cut-special.

You may need to pull the latest main.

> What is REPRO_ARGS? org-onlinetask.el is included org repo anyway?

See https://orgmode.org/manual/Feedback.html#Feedback
REPRO_ARGS are just extra arguments passed to Emacs when opening it in a
clean environment in current Org git repo.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-17 Thread Michael Dauer
I looked directly into the code and I think I found the issue:
(org-copy-subtree) calls (org-end-of-subtree) without providing an element.
But without an element this function just jumps to (point-max).
I would expect a different behavior or (org-end-of-subtree). Since element
is optional it should take the element at point.


Am Mi., 16. Aug. 2023 um 18:02 Uhr schrieb Ihor Radchenko <
yanta...@posteo.net>:

> Michael Dauer  writes:
>
> > No. Here also * h2 gets killed by org-cut-special.
>
> You may need to pull the latest main.
>
> > What is REPRO_ARGS? org-onlinetask.el is included org repo anyway?
>
> See https://orgmode.org/manual/Feedback.html#Feedback
> REPRO_ARGS are just extra arguments passed to Emacs when opening it in a
> clean environment in current Org git repo.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-17 Thread Ihor Radchenko
Michael Dauer  writes:

> I looked directly into the code and I think I found the issue:
> (org-copy-subtree) calls (org-end-of-subtree) without providing an element.
> But without an element this function just jumps to (point-max).

This is not true. Please make sure that you are using the latest Org.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-17 Thread Michael Dauer
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?

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.

Am Do., 17. Aug. 2023 um 10:42 Uhr schrieb Michael Dauer <
mick.da...@gmail.com>:

> I looked directly into the code and I think I found the issue:
> (org-copy-subtree) calls (org-end-of-subtree) without providing an
> element. But without an element this function just jumps to (point-max).
> I would expect a different behavior or (org-end-of-subtree). Since element
> is optional it should take the element at point.
>
>
> Am Mi., 16. Aug. 2023 um 18:02 Uhr schrieb Ihor Radchenko <
> yanta...@posteo.net>:
>
>> Michael Dauer  writes:
>>
>> > No. Here also * h2 gets killed by org-cut-special.
>>
>> You may need to pull the latest main.
>>
>> > What is REPRO_ARGS? org-onlinetask.el is included org repo anyway?
>>
>> See https://orgmode.org/manual/Feedback.html#Feedback
>> REPRO_ARGS are just extra arguments passed to Emacs when opening it in a
>> clean environment in current Org git repo.
>>
>> --
>> Ihor Radchenko // yantar92,
>> Org mode contributor,
>> Learn more about Org mode at .
>> Support Org development at ,
>> or support my work at 
>>
>


Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-17 Thread Ihor Radchenko
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 



Re: BUG: org-cut-special on inlinetask kill until point-max

2023-08-17 Thread Michael Dauer
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  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 
>


[POLL] Should org-copy/cut/paste-special handle inlinetasks specially? (was: BUG: org-cut-special on inlinetask kill until point-max)

2023-08-17 Thread Ihor Radchenko
Michael Dauer  writes:

> 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"

I looked into this further, and I can see that in the earlier versions
of Org org-cut-special on inlinetask killed that inlinetask, not the
containing subtree:

* Heading
Text
** Inlinetask
** END
More text
* Another heading

C-c C-x C-w

* Heading
Text

More text
* Another heading

It was by accident, AFAIU. Also, when point was at END, it was buggy
(only removed "END" line).

So, technically, the current behaviour cutting the actual subtree (not
inlinetask) can be considered a feature regression (if we call the
previously existing bug a "feature").

I think that it would be slightly better to keep special behaviour for
inlinetasks. But other opinions would be appreciated.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at