emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* BUG: org-cut-special on inlinetask kill until point-max
@ 2023-08-16 11:14 Michael Dauer
  2023-08-16 11:48 ` Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Dauer @ 2023-08-16 11:14 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

>>>
* 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.

[-- Attachment #2: Type: text/html, Size: 392 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-16 11:14 BUG: org-cut-special on inlinetask kill until point-max Michael Dauer
@ 2023-08-16 11:48 ` Ihor Radchenko
  2023-08-16 11:57   ` Michael Dauer
  0 siblings, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2023-08-16 11:48 UTC (permalink / raw)
  To: Michael Dauer; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-16 11:48 ` Ihor Radchenko
@ 2023-08-16 11:57   ` Michael Dauer
  2023-08-16 12:12     ` Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Dauer @ 2023-08-16 11:57 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 723 bytes --]

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

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

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

[-- Attachment #2: Type: text/html, Size: 1426 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-16 11:57   ` Michael Dauer
@ 2023-08-16 12:12     ` Ihor Radchenko
  2023-08-16 15:55       ` Michael Dauer
  0 siblings, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2023-08-16 12:12 UTC (permalink / raw)
  To: Michael Dauer; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-16 12:12     ` Ihor Radchenko
@ 2023-08-16 15:55       ` Michael Dauer
  2023-08-16 16:02         ` Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Dauer @ 2023-08-16 15:55 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

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

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

Ihor Radchenko <yantar92@posteo.net> schrieb am Mi., 16. Aug. 2023, 14:11:

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

[-- Attachment #2: Type: text/html, Size: 2236 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-16 15:55       ` Michael Dauer
@ 2023-08-16 16:02         ` Ihor Radchenko
  2023-08-17  8:42           ` Michael Dauer
  0 siblings, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2023-08-16 16:02 UTC (permalink / raw)
  To: Michael Dauer; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-16 16:02         ` Ihor Radchenko
@ 2023-08-17  8:42           ` Michael Dauer
  2023-08-17  8:56             ` Ihor Radchenko
  2023-08-17  9:00             ` Michael Dauer
  0 siblings, 2 replies; 12+ messages in thread
From: Michael Dauer @ 2023-08-17  8:42 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

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

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

[-- Attachment #2: Type: text/html, Size: 1827 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-17  8:42           ` Michael Dauer
@ 2023-08-17  8:56             ` Ihor Radchenko
  2023-08-17  9:00             ` Michael Dauer
  1 sibling, 0 replies; 12+ messages in thread
From: Ihor Radchenko @ 2023-08-17  8:56 UTC (permalink / raw)
  To: Michael Dauer; +Cc: emacs-orgmode

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-17  8:42           ` Michael Dauer
  2023-08-17  8:56             ` Ihor Radchenko
@ 2023-08-17  9:00             ` Michael Dauer
  2023-08-17 11:30               ` Ihor Radchenko
  1 sibling, 1 reply; 12+ messages in thread
From: Michael Dauer @ 2023-08-17  9:00 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 2693 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-17  9:00             ` Michael Dauer
@ 2023-08-17 11:30               ` Ihor Radchenko
  2023-08-17 13:05                 ` Michael Dauer
  0 siblings, 1 reply; 12+ messages in thread
From: Ihor Radchenko @ 2023-08-17 11:30 UTC (permalink / raw)
  To: Michael Dauer; +Cc: emacs-orgmode

Michael Dauer <mick.dauer@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>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: BUG: org-cut-special on inlinetask kill until point-max
  2023-08-17 11:30               ` Ihor Radchenko
@ 2023-08-17 13:05                 ` Michael Dauer
  2023-08-17 17:50                   ` [POLL] Should org-copy/cut/paste-special handle inlinetasks specially? (was: BUG: org-cut-special on inlinetask kill until point-max) Ihor Radchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Dauer @ 2023-08-17 13:05 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2858 bytes --]

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 <mick.dauer@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>
>

[-- Attachment #2: Type: text/html, Size: 3913 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [POLL] Should org-copy/cut/paste-special handle inlinetasks specially? (was: BUG: org-cut-special on inlinetask kill until point-max)
  2023-08-17 13:05                 ` Michael Dauer
@ 2023-08-17 17:50                   ` Ihor Radchenko
  0 siblings, 0 replies; 12+ messages in thread
From: Ihor Radchenko @ 2023-08-17 17:50 UTC (permalink / raw)
  To: Michael Dauer; +Cc: emacs-orgmode

Michael Dauer <mick.dauer@gmail.com> 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<point>
****************** END
More text
* Another heading

C-c C-x C-w

* Heading
Text
<point>
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 <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-08-17 17:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-16 11:14 BUG: org-cut-special on inlinetask kill until point-max Michael Dauer
2023-08-16 11:48 ` Ihor Radchenko
2023-08-16 11:57   ` Michael Dauer
2023-08-16 12:12     ` Ihor Radchenko
2023-08-16 15:55       ` Michael Dauer
2023-08-16 16:02         ` Ihor Radchenko
2023-08-17  8:42           ` Michael Dauer
2023-08-17  8:56             ` Ihor Radchenko
2023-08-17  9:00             ` Michael Dauer
2023-08-17 11:30               ` Ihor Radchenko
2023-08-17 13:05                 ` Michael Dauer
2023-08-17 17:50                   ` [POLL] Should org-copy/cut/paste-special handle inlinetasks specially? (was: BUG: org-cut-special on inlinetask kill until point-max) Ihor Radchenko

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).