* How to move up/down a headline but not the subtree?
@ 2018-07-05 9:40 Alain.Cochard
2018-07-05 9:44 ` Eric S Fraga
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Alain.Cochard @ 2018-07-05 9:40 UTC (permalink / raw)
To: emacs-orgmode
Hello.
I am aware of org-move-subtree-up/down, which moves the entire
subtree.
I am also aware of org-shiftmetaup/down which moves the line[fn:1] (also
works for a headline).
What I would like to do is to be able to move a headline with
everything up to (but not including) its first subheading.
Does anyone know how to do that?
I am also interested in knowing if there are specific (deep?) reasons
why this seemingly basic operation, which I see as the analogous of
org-do-promote/demote and perform very often with standard (but
tedious) emacs editing commands, is not already implemented.
Thanks,
Regards
PS: I know that worg is not org, but I take the opportunity to mention
that the Org-mode reference card seems to me to be outdated in this
respect (orgmode.org/worg/orgcard.html):
M-S-UP/DOWN move subtree/list item up/down
[fn:1] I am surprised I can't find it in the manual -- I find it
extremely useful.
--
EOST (École et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | Fax: +33 (0)3 68 85 01 25
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 9:40 How to move up/down a headline but not the subtree? Alain.Cochard
@ 2018-07-05 9:44 ` Eric S Fraga
2018-07-05 10:38 ` Alain.Cochard
2018-07-05 10:46 ` Neil Jerram
2018-07-05 10:50 ` Nicolas Goaziou
2 siblings, 1 reply; 14+ messages in thread
From: Eric S Fraga @ 2018-07-05 9:44 UTC (permalink / raw)
To: Alain.Cochard; +Cc: emacs-orgmode
On Thursday, 5 Jul 2018 at 11:40, Alain.Cochard@unistra.fr wrote:
> Hello.
>
> I am aware of org-move-subtree-up/down, which moves the entire
> subtree.
>
> I am also aware of org-shiftmetaup/down which moves the line[fn:1] (also
> works for a headline).
>
> What I would like to do is to be able to move a headline with
> everything up to (but not including) its first subheading.
Promote the first subheading, move the original heading, and then demote
that first subheading?
Or, remembering that this *is* in fact a text editor, select heading and
content, kill it, go where you want it placed, and yank it...?
--
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 9:44 ` Eric S Fraga
@ 2018-07-05 10:38 ` Alain.Cochard
2018-07-05 10:46 ` Eric S Fraga
0 siblings, 1 reply; 14+ messages in thread
From: Alain.Cochard @ 2018-07-05 10:38 UTC (permalink / raw)
To: Eric S Fraga; +Cc: emacs-orgmode
Eric S Fraga writes on Thu 5 Jul 2018 10:44:
> Or, remembering that this *is* in fact a text editor, select
> heading and content, kill it, go where you want it placed, and yank
> it...?
This is what I do so far... and qualify as tedious :-)
Thanks anyway.
--
EOST (École et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | Fax: +33 (0)3 68 85 01 25
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 10:38 ` Alain.Cochard
@ 2018-07-05 10:46 ` Eric S Fraga
2018-07-05 12:07 ` Alain.Cochard
0 siblings, 1 reply; 14+ messages in thread
From: Eric S Fraga @ 2018-07-05 10:46 UTC (permalink / raw)
To: Alain.Cochard; +Cc: emacs-orgmode
On Thursday, 5 Jul 2018 at 12:38, Alain.Cochard@unistra.fr wrote:
> Eric S Fraga writes on Thu 5 Jul 2018 10:44:
>
> > Or, remembering that this *is* in fact a text editor, select
> > heading and content, kill it, go where you want it placed, and yank
> > it...?
>
> This is what I do so far... and qualify as tedious :-)
Well, it's a deterministic set of steps so you could record a macro to
do the selection and kill? Then all you have to do is move and yank?
What was not clear in your OP was what happens to the first subheading?
Should it be promoted or does it suddenly become a child of another main
heading?
--
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 10:46 ` Eric S Fraga
@ 2018-07-05 12:07 ` Alain.Cochard
2018-07-05 13:39 ` Eric S Fraga
0 siblings, 1 reply; 14+ messages in thread
From: Alain.Cochard @ 2018-07-05 12:07 UTC (permalink / raw)
To: Eric S Fraga; +Cc: emacs-orgmode
Eric S Fraga writes on Thu 5 Jul 2018 11:46:
> Well, it's a deterministic set of steps so you could record a macro
> to do the selection and kill? Then all you have to do is move and
> yank?
Would still be long...
> What was not clear in your OP was what happens to the first
> subheading? Should it be promoted or does it suddenly become a
> child of another main heading?
In my mind, everything except the headline and its associated text
would stay unchanged, though your questions make me realize that a
reasonable option would be that the whole subtree be promoted (but
probably not just the 1st subheading).
Regards
--
EOST (École et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | Fax: +33 (0)3 68 85 01 25
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 12:07 ` Alain.Cochard
@ 2018-07-05 13:39 ` Eric S Fraga
0 siblings, 0 replies; 14+ messages in thread
From: Eric S Fraga @ 2018-07-05 13:39 UTC (permalink / raw)
To: Alain.Cochard; +Cc: emacs-orgmode
On Thursday, 5 Jul 2018 at 14:07, Alain.Cochard@unistra.fr wrote:
> Eric S Fraga writes on Thu 5 Jul 2018 11:46:
>
> > Well, it's a deterministic set of steps so you could record a macro
> > to do the selection and kill? Then all you have to do is move and
> > yank?
>
> Would still be long...
You save the keyboard macro as a key binding and it would be no longer
than what you were asking for? Maybe one key stroke longer.
> > What was not clear in your OP was what happens to the first
> > subheading? Should it be promoted or does it suddenly become a
> > child of another main heading?
>
> In my mind, everything except the headline and its associated text
> would stay unchanged, though your questions make me realize that a
> reasonable option would be that the whole subtree be promoted (but
> probably not just the 1st subheading).
But, as others have noted, this is a change of (semantic) structure and
not well defined which is arguably why there's no automatic way of doing
what you want.
--
Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 9:40 How to move up/down a headline but not the subtree? Alain.Cochard
2018-07-05 9:44 ` Eric S Fraga
@ 2018-07-05 10:46 ` Neil Jerram
2018-07-05 11:28 ` Alain.Cochard
2018-07-05 10:50 ` Nicolas Goaziou
2 siblings, 1 reply; 14+ messages in thread
From: Neil Jerram @ 2018-07-05 10:46 UTC (permalink / raw)
To: alain.cochard, emacs-orgmode
Alain.Cochard@unistra.fr writes:
> Hello.
>
> I am aware of org-move-subtree-up/down, which moves the entire
> subtree.
>
> I am also aware of org-shiftmetaup/down which moves the line[fn:1] (also
> works for a headline).
>
> What I would like to do is to be able to move a headline with
> everything up to (but not including) its first subheading.
>
> Does anyone know how to do that?
>
> I am also interested in knowing if there are specific (deep?) reasons
> why this seemingly basic operation, which I see as the analogous of
> org-do-promote/demote and perform very often with standard (but
> tedious) emacs editing commands, is not already implemented.
My view/guess: because the subheadings are an integral part of the
content of the containing item.
Wouldn't you agree? It seems to me like a fairly fundamental aspect of
the Org model.
That said, perhaps your use case is one where you've realized that
subheadings don't actually belong to the containing item? In that case,
what could make more sense is to promote (or kill and yank elsewhere)
all of the wrongly placed subheadings. You could promote an individual
subheading with M-S-left, or kill and yank it with C-c C-x C-w and C-c
C-x C-y, but I don't know if there's an easy way to repeat that over all
subheadings.
Another possible approach: what about demoting just the containing
heading with M-left and then killing/yanking that elsewhere?
Regards,
Neil
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 10:46 ` Neil Jerram
@ 2018-07-05 11:28 ` Alain.Cochard
2018-07-05 12:53 ` Neil Jerram
2018-07-10 17:51 ` Bernt Hansen
0 siblings, 2 replies; 14+ messages in thread
From: Alain.Cochard @ 2018-07-05 11:28 UTC (permalink / raw)
To: Neil Jerram; +Cc: emacs-orgmode
Neil Jerram writes on Thu 5 Jul 2018 11:46:
> > What I would like to do is to be able to move a headline with
> > everything up to (but not including) its first subheading.
> >
> > Does anyone know how to do that?
> >
> > I am also interested in knowing if there are specific (deep?)
> > reasons why this seemingly basic operation, which I see as the
> > analogous of org-do-promote/demote and perform very often with
> > standard (but tedious) emacs editing commands, is not already
> > implemented.
> My view/guess: because the subheadings are an integral part of the
> content of the containing item.
>
> Wouldn't you agree? It seems to me like a fairly fundamental
> aspect of the Org model.
Yes, but couldn't you raise the same argument about
org-promote/demote?
> That said, perhaps your use case is one where you've realized that
> subheadings don't actually belong to the containing item? In that
> case, what could make more sense is to promote (or kill and yank
> elsewhere) all of the wrongly placed subheadings. You could
> promote an individual subheading with M-S-left, or kill and yank it
> with C-c C-x C-w and C-c C-x C-y, but I don't know if there's an
> easy way to repeat that over all subheadings.
>
> Another possible approach: what about demoting just the containing
> heading with M-left and then killing/yanking that elsewhere?
My use case is after I have not too carefully written down many ideas.
Then I start thinking and try to order them in a better way. All what
you suggest is very sensible but much longer than the command I am
looking for.
Thanks much for you time.
a.
--
EOST (École et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | Fax: +33 (0)3 68 85 01 25
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 11:28 ` Alain.Cochard
@ 2018-07-05 12:53 ` Neil Jerram
2018-07-06 12:45 ` Alain.Cochard
2018-07-10 17:51 ` Bernt Hansen
1 sibling, 1 reply; 14+ messages in thread
From: Neil Jerram @ 2018-07-05 12:53 UTC (permalink / raw)
To: alain.cochard; +Cc: emacs-orgmode
Alain.Cochard@unistra.fr writes:
> Neil Jerram writes on Thu 5 Jul 2018 11:46:
>
> > > What I would like to do is to be able to move a headline with
> > > everything up to (but not including) its first subheading.
> > >
> > > Does anyone know how to do that?
> > >
> > > I am also interested in knowing if there are specific (deep?)
> > > reasons why this seemingly basic operation, which I see as the
> > > analogous of org-do-promote/demote and perform very often with
> > > standard (but tedious) emacs editing commands, is not already
> > > implemented.
>
> > My view/guess: because the subheadings are an integral part of the
> > content of the containing item.
> >
> > Wouldn't you agree? It seems to me like a fairly fundamental
> > aspect of the Org model.
>
> Yes, but couldn't you raise the same argument about
> org-promote/demote?
Fair point.
> > That said, perhaps your use case is one where you've realized that
> > subheadings don't actually belong to the containing item? In that
> > case, what could make more sense is to promote (or kill and yank
> > elsewhere) all of the wrongly placed subheadings. You could
> > promote an individual subheading with M-S-left, or kill and yank it
> > with C-c C-x C-w and C-c C-x C-y, but I don't know if there's an
> > easy way to repeat that over all subheadings.
> >
> > Another possible approach: what about demoting just the containing
> > heading with M-left and then killing/yanking that elsewhere?
>
> My use case is after I have not too carefully written down many ideas.
> Then I start thinking and try to order them in a better way. All what
> you suggest is very sensible but much longer than the command I am
> looking for.
FWIW, I just experimented. This seems to work:
M-right M-right M-right M-right M-right C-c C-x C-w
move to new destination
C-c C-x C-y
and is pretty fast.
> Thanks much for you time.
> a.
No problem, it's an interesting question.
Neil
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 12:53 ` Neil Jerram
@ 2018-07-06 12:45 ` Alain.Cochard
0 siblings, 0 replies; 14+ messages in thread
From: Alain.Cochard @ 2018-07-06 12:45 UTC (permalink / raw)
To: Neil Jerram; +Cc: emacs-orgmode
Neil Jerram writes on Thu 5 Jul 2018 13:53:
> FWIW, I just experimented. This seems to work:
>
> M-right M-right M-right M-right M-right C-c C-x C-w
>
> move to new destination
>
> C-c C-x C-y
>
> and is pretty fast.
That's an interesting idea. Maybe I can build on that for my need. I
appreciate the effort!
--
EOST (École et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | Fax: +33 (0)3 68 85 01 25
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 11:28 ` Alain.Cochard
2018-07-05 12:53 ` Neil Jerram
@ 2018-07-10 17:51 ` Bernt Hansen
1 sibling, 0 replies; 14+ messages in thread
From: Bernt Hansen @ 2018-07-10 17:51 UTC (permalink / raw)
To: alain.cochard; +Cc: Neil Jerram, emacs-orgmode
Alain.Cochard@unistra.fr writes:
> Neil Jerram writes on Thu 5 Jul 2018 11:46:
>
> > > What I would like to do is to be able to move a headline with
> > > everything up to (but not including) its first subheading.
> > >
> > > Does anyone know how to do that?
> > >
> > > I am also interested in knowing if there are specific (deep?)
> > > reasons why this seemingly basic operation, which I see as the
> > > analogous of org-do-promote/demote and perform very often with
> > > standard (but tedious) emacs editing commands, is not already
> > > implemented.
This only works if the task you want to deal with is level 2 or greater
(i.e. there is a level 1 task above it)
M-S-left M-right C-c C-w (use refile to move this heading somewhere
else)
This promotes all the subheadings one level and detaches the head from
the following stuff so you can move it alone.
Is that what you are looking for?
I regularly capture single level tasks and refile things into trees
later. If it's filed wrong changing the structure isn't all that hard
with the above commands. You just don't want to leave the subtasks
orphaned without a parent task (by skipping a level) so that is why I
promote with sublevels first and then demote just the parent task so it
becomes the same level as the subtasks.
Hope that helps.
Regards,
Bernt
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 9:40 How to move up/down a headline but not the subtree? Alain.Cochard
2018-07-05 9:44 ` Eric S Fraga
2018-07-05 10:46 ` Neil Jerram
@ 2018-07-05 10:50 ` Nicolas Goaziou
2018-07-06 11:59 ` Alain.Cochard
2 siblings, 1 reply; 14+ messages in thread
From: Nicolas Goaziou @ 2018-07-05 10:50 UTC (permalink / raw)
To: Alain.Cochard; +Cc: emacs-orgmode
Hello,
Alain.Cochard@unistra.fr writes:
> I am also interested in knowing if there are specific (deep?) reasons
> why this seemingly basic operation, which I see as the analogous of
> org-do-promote/demote and perform very often with standard (but
> tedious) emacs editing commands, is not already implemented.
Yes, this is not a "basic" operation: it breaks the structure of the
document. Org helps you maintain it and organize it, this would be going
the opposite way.
There are ways to do this, and you can even automate them with
a keyboard macro or a function.
> [fn:1] I am surprised I can't find it in the manual -- I find it
> extremely useful.
Documentation patches are always welcome. The hardest part would be to
find an appropriate location for this. Maybe Miscellaneous.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-05 10:50 ` Nicolas Goaziou
@ 2018-07-06 11:59 ` Alain.Cochard
2018-07-07 8:20 ` Nicolas Goaziou
0 siblings, 1 reply; 14+ messages in thread
From: Alain.Cochard @ 2018-07-06 11:59 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: emacs-orgmode
Hi, and thanks for your message.
Nicolas Goaziou writes on Thu 5 Jul 2018 12:50:
> > I am also interested in knowing if there are specific (deep?)
> > reasons why this seemingly basic operation, which I see as the
> > analogous of org-do-promote/demote and perform very often with
> > standard (but tedious) emacs editing commands, is not already
> > implemented.
> Yes, this is not a "basic" operation: it breaks the structure of
> the document. Org helps you maintain it and organize it, this would
> be going the opposite way.
I do not understand this. When one is demoting/promoting
headlines[fn:2] (and even whole subtrees), it seems to me that one is
implicitly admitting that the structure is wrong. I only see a
quantitative difference (i.e., not a qualitative one) between doing
this and performing want I want to do.
Only now do I realize that it is probably the same logic which is
behind the triggering of the error "Cannot move past superior level or
buffer limit" which occurs when trying to move a subtree. Well, I
certainly don't appreciate these limitations :-) At least in that case
I can not too painfully break the law by promoting+moving+demoting...
> There are ways to do this, and you can even automate them with a
> keyboard macro or a function.
Indeed, I will try to hack something. Ideally, it has to work for
list items as well -- certainly not easy for me. I had hoped someone
would have done it already...
> > [fn:1] I am surprised I can't find it in the manual -- I find it
> > extremely useful.
> Documentation patches are always welcome. The hardest part would be to
> find an appropriate location for this. Maybe Miscellaneous.
I understand patches are welcome, but I don't know how to do that yet.
In that case, is it better that I remain silent?
Regards
a.
[fn:2] Here I am not even talking about cases like going from:
* head
* sub head
text
* sub sub head
to:
* head
* sub head
text
* sub sub head
which is obtained by demoting 'sub head' 3 times. (With the similar
structure with list items, one gets "Cannot outdent an item without
its children".)
--
EOST (École et Observatoire des Sciences de la Terre)
IPG (Institut de Physique du Globe) | alain.cochard@unistra.fr
5 rue René Descartes [bureau 106] | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | Fax: +33 (0)3 68 85 01 25
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: How to move up/down a headline but not the subtree?
2018-07-06 11:59 ` Alain.Cochard
@ 2018-07-07 8:20 ` Nicolas Goaziou
0 siblings, 0 replies; 14+ messages in thread
From: Nicolas Goaziou @ 2018-07-07 8:20 UTC (permalink / raw)
To: Alain.Cochard; +Cc: emacs-orgmode
Hello,
Alain.Cochard@unistra.fr writes:
> I do not understand this. When one is demoting/promoting
> headlines[fn:2] (and even whole subtrees), it seems to me that one is
> implicitly admitting that the structure is wrong. I only see a
> quantitative difference (i.e., not a qualitative one) between doing
> this and performing want I want to do.
This is indeed a quantitative difference. demoting/promoting is quite
natural, predictable, and easy to implement. Barring indentation, it
only affects the current line. This is a useful low-level function.
Your suggestion is, OTOH, very vague. You want to move a headline and
its section. Where? What should happen then to the rest of the sub-tree?
Even if properly defined, it would potentially affect a lot of the
document, possibly in a convoluted way.
You certainly have good use for this, but I insist on this point: this
is not a "basic" operation, at all. AFAIU, I do think that such
a complex low-level operation should not be a standard command.
> Only now do I realize that it is probably the same logic which is
> behind the triggering of the error "Cannot move past superior level or
> buffer limit" which occurs when trying to move a subtree. Well, I
> certainly don't appreciate these limitations :-) At least in that case
> I can not too painfully break the law by promoting+moving+demoting...
I cannot answer as I don't know what exactly you want to achieve.
> I understand patches are welcome, but I don't know how to do that yet.
> In that case, is it better that I remain silent?
Not at all. You can see how to contribute there:
<https://orgmode.org/worg/org-contribute.html#patches>.
If you don't have time for the gory details, you can also suggest
a change in the Org manual without formatting it as a patch. Since the
manual is an Org file[1], you don't even have to learn Texinfo.
Regards,
Footnotes:
[1] https://code.orgmode.org/bzg/org-mode/raw/master/doc/org-manual.org
--
Nicolas Goaziou 0x80A93738
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2018-07-10 17:51 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-05 9:40 How to move up/down a headline but not the subtree? Alain.Cochard
2018-07-05 9:44 ` Eric S Fraga
2018-07-05 10:38 ` Alain.Cochard
2018-07-05 10:46 ` Eric S Fraga
2018-07-05 12:07 ` Alain.Cochard
2018-07-05 13:39 ` Eric S Fraga
2018-07-05 10:46 ` Neil Jerram
2018-07-05 11:28 ` Alain.Cochard
2018-07-05 12:53 ` Neil Jerram
2018-07-06 12:45 ` Alain.Cochard
2018-07-10 17:51 ` Bernt Hansen
2018-07-05 10:50 ` Nicolas Goaziou
2018-07-06 11:59 ` Alain.Cochard
2018-07-07 8:20 ` Nicolas Goaziou
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).