[-- Attachment #1: Type: text/plain, Size: 1889 bytes --] Hello there, orgmode list, this is my first contribution here, so please be gentle with me. I've now used outlining software for the last twenty years at least and it is my belief that when a user pastes headlines into an outline, they usually want to make them either A) siblings of (i. e. paste them at the same level as) or B) children of (i. e. paste them one level below) the currently focused heading. Unfortunately, org-paste-subtree currently attempts to "modify the level of the subtree to make sure the tree fits in nicely at the yank position" [from Org Manual]. For me, this has meant unpredictable results. As far as I know, there is currently no way to use the command while making sure the result will be A) or B) as desired. The user has to wait for the command to do its "magic" and then move the headings around manually to achieve the intended result. With a numeric prefix argument or by yanking after a headline marker, the user can specify the yank level. But how likely is it that a user will yank headings to level five under a level two heading? I can solve my problem with some additional code, in which I determine the level of the heading at point and then have two functions to call for same level or child level respectively, but it strikes me as odd that this is not part of the default options. My suggestion would be to make a fundamental change to how the command works, prioritizing definite A) or B) type results over the current vague "the tree fits in nicely" approach. IMHO the default should be to yank at the same level as the focused heading. Then, if the C-u 0 numeric prefix (which currently produces an error message) were used to yank at one level below that (as subheadings of the focused heading), the functionality of the other numeric prefixes to set the yank level could be preserved. Thanks for considering! Best regards, Philipp [-- Attachment #2: Type: text/html, Size: 2175 bytes --]
Philipp Kiefer <phil.kiefer@gmail.com> writes: > Unfortunately, org-paste-subtree currently attempts to "modify the level of > the subtree to make sure the tree fits in nicely at the yank position" > [from Org Manual]. > ... > My suggestion would be to make a fundamental change to how the command > works, prioritizing definite A) or B) type results over the current vague > "the tree fits in nicely" approach. IMHO the default should be to yank at > the same level as the focused heading. Then, if the C-u 0 numeric prefix > (which currently produces an error message) were used to yank at one level > below that (as subheadings of the focused heading), the functionality of > the other numeric prefixes to set the yank level could be preserved. AFAIU, `org-paste-subtree' already does what you want for the most part. See the function docstring: Paste the clipboard as a subtree, with modification of headline level. The entire subtree is promoted or demoted in order to match a new headline level. If the cursor is at the beginning of a headline, the same level as that headline is used to paste the tree. If not, the new level is derived from the *visible* headings before and after the insertion point, and taken to be the inferior headline level of the two. So if the previous visible heading is level 3 and the next is level 4 (or vice versa), level 4 will be used for insertion. This makes sure that the subtree remains an independent subtree and does not swallow low level entries. -- 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 #1: Type: text/plain, Size: 2919 bytes --] Thanks for addressing my concern, Ihor. So I can force same-level yank by navigating to the beginning of the current headline before calling org-paste-subtree, I see. However, I still do not see a way to force it to paste one level below the current headline, i. e. to add the trees on the clipboard as child-subtrees or the current heading. My best bet currently is probably to create a blank child heading, add some text (there seems to be a glitch turning the blank heading into an empty line when pasting with point on the blank dummy heading when it has no text), go back to the beginning of the line, then paste the subtrees at the level of the dummy heading, navigate back to the dummy heading and delete it. I'd really rather not have to do all that to achieve my simple goal of pasting subtrees at child level. As for the claim that the current procedure "makes sure that the subtree remains an independent subtree and does not swallow low level entries.", either I don't understand it or it isn't true. If I have a level 2 heading below which is a level 5 heading and I paste subtrees with point on the level 2 heading, the level 5 heading is subsumed under the last subtree yanked from the clipboard in all cases. Best, Philipp On 18.01.2023 09:04, Ihor Radchenko wrote: > Philipp Kiefer<phil.kiefer@gmail.com> writes: > >> Unfortunately, org-paste-subtree currently attempts to "modify the level of >> the subtree to make sure the tree fits in nicely at the yank position" >> [from Org Manual]. >> ... >> My suggestion would be to make a fundamental change to how the command >> works, prioritizing definite A) or B) type results over the current vague >> "the tree fits in nicely" approach. IMHO the default should be to yank at >> the same level as the focused heading. Then, if the C-u 0 numeric prefix >> (which currently produces an error message) were used to yank at one level >> below that (as subheadings of the focused heading), the functionality of >> the other numeric prefixes to set the yank level could be preserved. > AFAIU, `org-paste-subtree' already does what you want for the most part. > See the function docstring: > > Paste the clipboard as a subtree, with modification of headline level. > > The entire subtree is promoted or demoted in order to match a new headline > level. > > If the cursor is at the beginning of a headline, the same level as > that headline is used to paste the tree. > > If not, the new level is derived from the *visible* headings > before and after the insertion point, and taken to be the inferior headline > level of the two. So if the previous visible heading is level 3 and the > next is level 4 (or vice versa), level 4 will be used for insertion. > This makes sure that the subtree remains an independent subtree and does > not swallow low level entries. > [-- Attachment #2: Type: text/html, Size: 3744 bytes --]
Philipp Kiefer <phil.kiefer@gmail.com> writes: > Thanks for addressing my concern, Ihor. > > So I can force same-level yank by navigating to the beginning of the > current headline before calling org-paste-subtree, I see. However, I > still do not see a way to force it to paste one level below the current > headline, i. e. to add the trees on the clipboard as child-subtrees or > the current heading. > > My best bet currently is probably to create a blank child heading, add > some text (there seems to be a glitch turning the blank heading into an > empty line when pasting with point on the blank dummy heading when it > has no text), go back to the beginning of the line, then paste the > subtrees at the level of the dummy heading, navigate back to the dummy > heading and delete it. I'd really rather not have to do all that to > achieve my simple goal of pasting subtrees at child level. Just paste the subtree and press C-S-<right> to demote it immediately. It would not save you many keystrokes if there was yet another prefix argument. > As for the claim that the current procedure "makes sure that the subtree > remains an independent subtree and does not swallow low level entries.", > either I don't understand it or it isn't true. If I have a level 2 > heading below which is a level 5 heading and I paste subtrees with point > on the level 2 heading, the level 5 heading is subsumed under the last > subtree yanked from the clipboard in all cases. Sorry, but I cannot reproduce. Could you please provide detailed instructions about what you did? -- 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 #1: Type: text/plain, Size: 2864 bytes --] I've uploaded two screencasts to illustrate the issues described in my last message: 1. Org Mode-paste subtree low-level item swallowed: https://imgur.com/a/CZ5lDaH . This relates to what I assume the passage from the manual is trying to say should not happen: "makes sure that the subtree remains an independent subtree and does not swallow low level entries." 2. Org Mode-paste subtree on empty heading glitch: https://imgur.com/a/AT5pDj6 . See my last message. Further, you suggest I use C-S-<right> to demote the subtree after pasting it at the same level as the subtree at point. But what if I used a numerical prefix argument to copy or cut several subtrees, maybe 5 or 10? Not very convenient at all to demote them all by hand... I still hold that pasting headings / subtress either at the same level or at the child level of the target heading is part of the bread and butter of outline editing and should be as straightforward as possible. I'm rather sure the current numeric prefixes of org-paste-subtree to select a distinct level at which to paste are needed / used much less frequently than a "paste at child level" prefix (maybe C-u C-u?) would be if it was implemented. Best Philipp On 19.01.2023 10:44, Ihor Radchenko wrote: > Philipp Kiefer<phil.kiefer@gmail.com> writes: > >> Thanks for addressing my concern, Ihor. >> >> So I can force same-level yank by navigating to the beginning of the >> current headline before calling org-paste-subtree, I see. However, I >> still do not see a way to force it to paste one level below the current >> headline, i. e. to add the trees on the clipboard as child-subtrees or >> the current heading. >> >> My best bet currently is probably to create a blank child heading, add >> some text (there seems to be a glitch turning the blank heading into an >> empty line when pasting with point on the blank dummy heading when it >> has no text), go back to the beginning of the line, then paste the >> subtrees at the level of the dummy heading, navigate back to the dummy >> heading and delete it. I'd really rather not have to do all that to >> achieve my simple goal of pasting subtrees at child level. > Just paste the subtree and press C-S-<right> to demote it immediately. > It would not save you many keystrokes if there was yet another prefix > argument. > >> As for the claim that the current procedure "makes sure that the subtree >> remains an independent subtree and does not swallow low level entries.", >> either I don't understand it or it isn't true. If I have a level 2 >> heading below which is a level 5 heading and I paste subtrees with point >> on the level 2 heading, the level 5 heading is subsumed under the last >> subtree yanked from the clipboard in all cases. > Sorry, but I cannot reproduce. > Could you please provide detailed instructions about what you did? > [-- Attachment #2: Type: text/html, Size: 4247 bytes --]
Philipp Kiefer <phil.kiefer@gmail.com> writes: > 1. Org Mode-paste subtree low-level item swallowed: > https://imgur.com/a/CZ5lDaH . This relates to what I assume the passage > from the manual is trying to say should not happen: > > "makes sure that the subtree > remains an independent subtree and does not swallow low level entries." Confirmed. But what would be the expected behavior here? Inserting before the heading at point? After? Steps to reproduce: 1. Create a file **** 1.1.1.1 **** 1.1.1.2 * 3 ** 3.1 *** 3.1.<point>1 ************ low-level item *** 3.1.2 *** 3.1.3 2. Copy the first two headings 3. Move point as indicated 4. M-x org-paste-subtree Observed: 1.* headings inserted after 3.1.1 and before "low-level-item", thus breaking the sub-tree. > 2. Org Mode-paste subtree on empty heading glitch: > https://imgur.com/a/AT5pDj6 . See my last message. Fixed, on main. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c92769a50 -- 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>
Philipp Kiefer <phil.kiefer@gmail.com> writes: > Further, you suggest I use C-S-<right> to demote the subtree after > pasting it at the same level as the subtree at point. But what if I used > a numerical prefix argument to copy or cut several subtrees, maybe 5 or > 10? Not very convenient at all to demote them all by hand... > > I still hold that pasting headings / subtress either at the same level > or at the child level of the target heading is part of the bread and > butter of outline editing and should be as straightforward as possible. > I'm rather sure the current numeric prefixes of org-paste-subtree to > select a distinct level at which to paste are needed / used much less > frequently than a "paste at child level" prefix (maybe C-u C-u?) would > be if it was implemented. Could you please provide concrete ideas what C-u/C-u C-u should do? In particular, how it will interact with point located at heading, at heading beginning, at empty heading, or inside a heading section. -- 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>
On 20.01.2023 11:21, Ihor Radchenko wrote:
> Philipp Kiefer <phil.kiefer@gmail.com> writes:
>
>> Further, you suggest I use C-S-<right> to demote the subtree after
>> pasting it at the same level as the subtree at point. But what if I used
>> a numerical prefix argument to copy or cut several subtrees, maybe 5 or
>> 10? Not very convenient at all to demote them all by hand...
>>
>> I still hold that pasting headings / subtress either at the same level
>> or at the child level of the target heading is part of the bread and
>> butter of outline editing and should be as straightforward as possible.
>> I'm rather sure the current numeric prefixes of org-paste-subtree to
>> select a distinct level at which to paste are needed / used much less
>> frequently than a "paste at child level" prefix (maybe C-u C-u?) would
>> be if it was implemented.
> Could you please provide concrete ideas what C-u/C-u C-u should do?
> In particular, how it will interact with point located at heading,
> at heading beginning, at empty heading, or inside a heading section.
To be honest, I don't see much need for fine-grained special cases. I'd
be very happy with C-u yanking at the level of the heading at point and
C-u C-u yanking at one level below that, regardless of the exact
position of point. I realize that would mean C-u doubling what can
already be done by calling org-paste-subtree with point at the beginning
of a heading but accessing both options (paste as sibling or child) with
a single or repeat C-u seems more consistent to me than having one
depend on position and getting at the other via the command prefix.
Thanks a lot for your dedication in working on this!