emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-paste-subtree and org-refile broken
@ 2011-08-13  3:31 Matt Lundin
  2011-08-13  3:36 ` Matt Lundin
  2011-08-13  7:25 ` David Maus
  0 siblings, 2 replies; 6+ messages in thread
From: Matt Lundin @ 2011-08-13  3:31 UTC (permalink / raw)
  To: Org Mode; +Cc: David Maus

The following commit broke org-paste-subtree (and, as a result, refile):

,----
| commit ece3091f16af246780e29ba6e8248dd8bb3b7ba2
| Author: David Maus <dmaus@ictsoc.de>
| Date:   Wed Aug 10 18:38:26 2011 +0200
| 
|     Don't eat headline when yank with point at existing headline
|     
|     * org.el (org-paste-subtree): Don't eat headline when called with
|     point at existing headline.
`----

Here is a minimal example:

--8<---------------cut here---------------start------------->8---
* One

Text in one

* Two

Text in two

* Three

Text in three

* Four

Text in four
--8<---------------cut here---------------end--------------->8---

If I kill subtree "Four" and call org-paste-subtree with the point on
"Two" (or if I refile it to "Two"), I get the following:

--8<---------------cut here---------------start------------->8---
* One

Text in one

* Two
* Four

Text in four

Text in two

* Three

Text in three
--8<---------------cut here---------------end--------------->8---

Best,
Matt

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

* Re: org-paste-subtree and org-refile broken
  2011-08-13  3:31 org-paste-subtree and org-refile broken Matt Lundin
@ 2011-08-13  3:36 ` Matt Lundin
  2011-08-13  7:25 ` David Maus
  1 sibling, 0 replies; 6+ messages in thread
From: Matt Lundin @ 2011-08-13  3:36 UTC (permalink / raw)
  To: Org Mode; +Cc: David Maus

Matt Lundin <mdl@imapmail.org> writes:
>
> If I kill subtree "Four" and call org-paste-subtree with the point on
> "Two" (or if I refile it to "Two"), I get the following:
>
> * One
>
> Text in one
>
> * Two
> * Four
>
> Text in four
>
> Text in two
>
> * Three
>
> Text in three

I should add that the correct result (and old behavior) looks like this
when refiling:

--8<---------------cut here---------------start------------->8---
* One

Text in one

* Two

Text in two

** Four

Text in four

* Three

Text in three
--8<---------------cut here---------------end--------------->8---

Best,
Matt

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

* Re: org-paste-subtree and org-refile broken
  2011-08-13  3:31 org-paste-subtree and org-refile broken Matt Lundin
  2011-08-13  3:36 ` Matt Lundin
@ 2011-08-13  7:25 ` David Maus
  2011-08-13 13:05   ` David Maus
  1 sibling, 1 reply; 6+ messages in thread
From: David Maus @ 2011-08-13  7:25 UTC (permalink / raw)
  To: Matt Lundin; +Cc: David Maus, Org Mode, Sebastien Vauban

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

Hi Matt,
Hi Sebastien,

I pushed a temporary workaround to master that should fix the problem
with refile and capture. Both depend on a buggy behavior of
org-paste-subtree, i.e. pasting a subtree *above* the target headline
when called with point at the beginning of the target headline.

A fix for the second bug, mixing the content of two headlines

> If I kill subtree "Four" and call org-paste-subtree with the point on
> "Two" (or if I refile it to "Two"), I get the following:
>
> --8<---------------cut here---------------start------------->8---
> * One
>
> Text in one
>
> * Two
> * Four
>
> Text in four
>
> Text in two
>
> * Three
>
> Text in three
> --8<---------------cut here---------------end--------------->8---

is under development.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

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

* Re: org-paste-subtree and org-refile broken
  2011-08-13  7:25 ` David Maus
@ 2011-08-13 13:05   ` David Maus
  2011-08-13 14:03     ` Matt Lundin
  0 siblings, 1 reply; 6+ messages in thread
From: David Maus @ 2011-08-13 13:05 UTC (permalink / raw)
  To: David Maus; +Cc: Sebastien Vauban, Matt Lundin, Org Mode

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

At Sat, 13 Aug 2011 09:25:19 +0200,
David Maus wrote:
>
> Hi Matt,
> Hi Sebastien,
>
> I pushed a temporary workaround to master that should fix the problem
> with refile and capture. Both depend on a buggy behavior of
> org-paste-subtree, i.e. pasting a subtree *above* the target headline
> when called with point at the beginning of the target headline.

If you have already pulled, please pull again. Had confused something,
fixed now.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

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

* Re: org-paste-subtree and org-refile broken
  2011-08-13 13:05   ` David Maus
@ 2011-08-13 14:03     ` Matt Lundin
  2011-08-20 18:41       ` David Maus
  0 siblings, 1 reply; 6+ messages in thread
From: Matt Lundin @ 2011-08-13 14:03 UTC (permalink / raw)
  To: David Maus; +Cc: Sebastien Vauban, Org Mode

David Maus <dmaus@ictsoc.de> writes:

> At Sat, 13 Aug 2011 09:25:19 +0200,
> David Maus wrote:
>>
>> Hi Matt,
>> Hi Sebastien,
>>
>> I pushed a temporary workaround to master that should fix the problem
>> with refile and capture. Both depend on a buggy behavior of
>> org-paste-subtree, i.e. pasting a subtree *above* the target headline
>> when called with point at the beginning of the target headline.
>
> If you have already pulled, please pull again. Had confused something,
> fixed now.

Thanks for fixing this! Refiling is working well now. Could you explain
what you mean by a "buggy behavior of org-paste-subtree." AFAIK,
org-paste-subtree has always pasted the subtree above the current tree
if the point is at the beginning of the headline. Is there something in
the documentation that suggests that this should not be the case? I
believe this behavior is consistent with
org-insert-heading-respect-content, which inserts a new heading above
the current heading if called at the beginning of a headline. For
instance, in the following example...

--8<---------------cut here---------------start------------->8---
* One
  Text in one
* Two
  Text in two
** Subpoint two
   Text in subpoint two.
* Three
  Text in three
* Four
  Text in four
--8<---------------cut here---------------end--------------->8---

If I kill headline four, move the point to the beginning of headline
three, and yank (i.e., call org-paste-subtree), I get the following,
which seems to me correct:

--8<---------------cut here---------------start------------->8---
* One
  Text in one
* Two
  Text in two
** Subpoint two
   Text in subpoint two.
* Four
  Text in four

* Three
  Text in three
--8<---------------cut here---------------end--------------->8---

Similarly, if I place the cursor on three and call
org-insert-heading-respect-content (M-RET), the new headline is inserted
above the headline:

--8<---------------cut here---------------start------------->8---
* One
  Text in one
* Two
  Text in two
** Subpoint two
   Text in subpoint two.
* 
* Three
  Text in three
* Four
  Text in four
--8<---------------cut here---------------end--------------->8---

Best,
Matt

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

* Re: org-paste-subtree and org-refile broken
  2011-08-13 14:03     ` Matt Lundin
@ 2011-08-20 18:41       ` David Maus
  0 siblings, 0 replies; 6+ messages in thread
From: David Maus @ 2011-08-20 18:41 UTC (permalink / raw)
  To: Matt Lundin; +Cc: David Maus, Org Mode, Sebastien Vauban

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

At Sat, 13 Aug 2011 09:03:40 -0500,
Matt Lundin wrote:
>
> David Maus <dmaus@ictsoc.de> writes:
>
> > At Sat, 13 Aug 2011 09:25:19 +0200,
> > David Maus wrote:
> >>
> >> Hi Matt,
> >> Hi Sebastien,
> >>
> >> I pushed a temporary workaround to master that should fix the problem
> >> with refile and capture. Both depend on a buggy behavior of
> >> org-paste-subtree, i.e. pasting a subtree *above* the target headline
> >> when called with point at the beginning of the target headline.
> >
> > If you have already pulled, please pull again. Had confused something,
> > fixed now.
>
> Thanks for fixing this! Refiling is working well now. Could you explain
> what you mean by a "buggy behavior of org-paste-subtree." AFAIK,
> org-paste-subtree has always pasted the subtree above the current tree
> if the point is at the beginning of the headline. Is there something in
> the documentation that suggests that this should not be the case? I
> believe this behavior is consistent with
> org-insert-heading-respect-content, which inserts a new heading above
> the current heading if called at the beginning of a headline. For
> instance, in the following example...
>
> --8<---------------cut here---------------start------------->8---
> * One
>   Text in one
> * Two
>   Text in two
> ** Subpoint two
>    Text in subpoint two.
> * Three
>   Text in three
> * Four
>   Text in four
> --8<---------------cut here---------------end--------------->8---
>
> If I kill headline four, move the point to the beginning of headline
> three, and yank (i.e., call org-paste-subtree), I get the following,
> which seems to me correct:
>
> --8<---------------cut here---------------start------------->8---
> * One
>   Text in one
> * Two
>   Text in two
> ** Subpoint two
>    Text in subpoint two.
> * Four
>   Text in four
>
> * Three
>   Text in three
> --8<---------------cut here---------------end--------------->8---
>
> Similarly, if I place the cursor on three and call
> org-insert-heading-respect-content (M-RET), the new headline is inserted
> above the headline:
>
> --8<---------------cut here---------------start------------->8---
> * One
>   Text in one
> * Two
>   Text in two
> ** Subpoint two
>    Text in subpoint two.
> *
> * Three
>   Text in three
> * Four
>   Text in four
> --8<---------------cut here---------------end--------------->8---
>

What bothers me is the fact that paste-subtree operates on the
previous sibling of a headline if called with explicit level and point
at the beginning of a headline.

--8<---------------cut here---------------start------------->8---
* One
  Text in one
* Two
  Text in two
** Subpoint two
   Text in subpoint two.
* Three
  Text in three
* Four
  Text in four
--8<---------------cut here---------------end--------------->8---

Cut Four, move point at the beginning of Three and paste with a level
of 2 (C-u 2 C-c C-x C-y) and you get:

--8<---------------cut here---------------start------------->8---
* One
  Text in one
* Two
  Text in two
** Subpoint two
   Text in subpoint two.
** Four
   Text in four
* Three
  Text in three
--8<---------------cut here---------------end--------------->8---

For refile this means that if you refile Four to Two, refile operates
on Two by operating on Two's following-sibling, Three.

There seems to be no practical problem, it's
just... strange. Especially if you consider pasting a subtree with
point somewhere on a headline but not at the beginning. Here []
represents point.

--8<---------------cut here---------------start------------->8---
* One
  Text in one
* T[]wo
  Text in two
** Subpoint two
   Text in subpoint two.
* Three
  Text in three
--8<---------------cut here---------------end--------------->8---

I've noticed that Org did not cover this case, e.g. calculated the
paste level correctly but pasted above. What I expected Org to do in
this case is to paste the subtree as last child of Two. If this
expectation is implemented (I am on it) then pasting above if point is
at beginning of headline is strange because point is still on the
heading but the direction of paste is reversed. It's not a practical
problem if the subtree is pasted with the same level as the target
headline (i.e. its sibling), but still...

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

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

end of thread, other threads:[~2011-08-20 18:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-13  3:31 org-paste-subtree and org-refile broken Matt Lundin
2011-08-13  3:36 ` Matt Lundin
2011-08-13  7:25 ` David Maus
2011-08-13 13:05   ` David Maus
2011-08-13 14:03     ` Matt Lundin
2011-08-20 18:41       ` David Maus

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