* "Create new heading after this one" command
@ 2007-09-18 15:45 Nuutti Kotivuori
2007-09-18 17:38 ` Carsten Dominik
0 siblings, 1 reply; 7+ messages in thread
From: Nuutti Kotivuori @ 2007-09-18 15:45 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Very often I end up in a situation where I'm at a heading, and need to
create a new heading after this one, with the same level. But this
seems to be overly difficult in some cases.
I am pointing out a few problems with an example layout of this:
* Heading
** Item 1...
** Ite[1]m 2
- Text
- Other[2] text
- More text
*** Subitem 1
*** Subitem 2
** Item 3[3]...
* Another heading
(I'm using [x] to mark possible positions for the point, which I
outline below.)
In the [1] case, the point is currently in the middle of the "Item 2"
heading. To get what I want, I need to do C-a to get to the beginning
of the line, then M-RET to get a new bullet item which appears
*before* "Item 2" and then press M-down to make it be after "Item 2"
and before "Item 3". I could, alternatively, move to the beginning of
the "Item 3" line and press M-RET, but for me that's counter intuitive
- and it wouldn't work if I wanted an item below "Item 3".
And if I do the thing that would be intuitive for me - that is, moving
to the end of "Item 2" with C-e and pressing M-RET, I get a new item
after "Item 2", but the notes I had with "Item 2" Become notes for the
*new* item - which is not what I want.
In the [2] case, things are even more difficult. Pressing M-RET
creates new list items, so I first need to navigate myself out to
somewhere where there's a heading and then do the same thing as
before.
In the [3] case, behaviour is actually really broken. If the item is
folded, pressing C-e will bring me just before the "..." signifying
the folded status. If I press M-RET there, the point just mysteriously
gets moved to the end of the line (after "..."). If I start typing
there and go around changing folding a number of different things can
happen - worst of which is losing the entire subtree under "Item 3"!
(This can be reproduced by: M-RET "foobar" C-a TAB)
For this, all, I have two alternative suggestions:
Either: Make C-e M-RET consistently make a new heading below the
current one - regardless of folding and leaving any text associated
with the current heading alone. But this may be difficult, considering
that folding seems to be a bit troublesome at times.
Or, simply: Add a new command which creates a new heading after the
current one, regardless where the point is on the line, at the same
level the current heading is. This command could work also in the text
part of headings, like lists - always creating headings, unlike
M-RET. Prefix argument on this command could create the heading before
the current one, though I'm not sure if it would be terribly useful. A
variation, creating a subheading (one level deeper) of the current
item could be useful, but since that can be achieved with the former
by just pressing M-right after the command, I don't think this one is
too useful either.
I've run into this problem ever since I started using org-mode - so I
thought others might have the same problem. If not, I can hack this
trivially for myself only.
Thank you for your time,
-- Naked
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "Create new heading after this one" command
2007-09-18 15:45 "Create new heading after this one" command Nuutti Kotivuori
@ 2007-09-18 17:38 ` Carsten Dominik
2007-09-19 1:05 ` Bastien
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Carsten Dominik @ 2007-09-18 17:38 UTC (permalink / raw)
To: Nuutti Kotivuori; +Cc: emacs-orgmode
On Sep 18, 2007, at 17:45, Nuutti Kotivuori wrote:
>
> For this, all, I have two alternative suggestions:
>
> Either: Make C-e M-RET consistently make a new heading below the
> current one - regardless of folding and leaving any text associated
> with the current heading alone. But this may be difficult, considering
> that folding seems to be a bit troublesome at times.
>
> Or, simply: Add a new command which creates a new heading after the
> current one, regardless where the point is on the line, at the same
> level the current heading is. This command could work also in the text
> part of headings, like lists - always creating headings, unlike
> M-RET. Prefix argument on this command could create the heading before
> the current one, though I'm not sure if it would be terribly useful. A
> variation, creating a subheading (one level deeper) of the current
> item could be useful, but since that can be achieved with the former
> by just pressing M-right after the command, I don't think this one is
> too useful either.
I guess this would be as easy as
(defun org-new-heading-after-current ()
"Insert a new heading with same level as current, after current
subtree."
(interactive)
(org-back-to-heading)
(org-insert-heading)
(org-move-subtree-down)
(end-of-line 1))
Any suggestions for a keybinding?
- Carsten
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "Create new heading after this one" command
2007-09-18 17:38 ` Carsten Dominik
@ 2007-09-19 1:05 ` Bastien
2007-09-20 7:14 ` Rainer Stengele
2007-09-19 10:01 ` Nuutti Kotivuori
2007-09-23 7:35 ` Renzo Been
2 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2007-09-19 1:05 UTC (permalink / raw)
To: emacs-orgmode
Carsten Dominik <dominik@science.uva.nl> writes:
> (defun org-new-heading-after-current ()
> "Insert a new heading with same level as current, after current
> subtree."
> (interactive)
> (org-back-to-heading)
> (org-insert-heading)
> (org-move-subtree-down)
> (end-of-line 1))
>
> Any suggestions for a keybinding?
C-M-return?
(I first considered of M-S-return but then I realized it calls
org-insert-todo-heading.)
--
Bastien
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "Create new heading after this one" command
2007-09-19 1:05 ` Bastien
@ 2007-09-20 7:14 ` Rainer Stengele
0 siblings, 0 replies; 7+ messages in thread
From: Rainer Stengele @ 2007-09-20 7:14 UTC (permalink / raw)
To: emacs-orgmode
Bastien schrieb:
> Carsten Dominik <dominik@science.uva.nl> writes:
>
>> (defun org-new-heading-after-current ()
>> "Insert a new heading with same level as current, after current
>> subtree."
>> (interactive)
>> (org-back-to-heading)
>> (org-insert-heading)
>> (org-move-subtree-down)
>> (end-of-line 1))
>>
>> Any suggestions for a keybinding?
>
> C-M-return?
>
> (I first considered of M-S-return but then I realized it calls
> org-insert-todo-heading.)
>
a dream! - the removal of what was bugging me too!
Thank you and C-M-return is perfect,
Rainer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "Create new heading after this one" command
2007-09-18 17:38 ` Carsten Dominik
2007-09-19 1:05 ` Bastien
@ 2007-09-19 10:01 ` Nuutti Kotivuori
2007-10-16 10:23 ` Nuutti Kotivuori
2007-09-23 7:35 ` Renzo Been
2 siblings, 1 reply; 7+ messages in thread
From: Nuutti Kotivuori @ 2007-09-19 10:01 UTC (permalink / raw)
To: emacs-orgmode
Carsten Dominik wrote:
> I guess this would be as easy as
>
> (defun org-new-heading-after-current ()
> "Insert a new heading with same level as current, after current
> subtree."
> (interactive)
> (org-back-to-heading)
> (org-insert-heading)
> (org-move-subtree-down)
> (end-of-line 1))
Works like a dream, thanks!
> Any suggestions for a keybinding?
Well, it has to be a single keypress, like M-RET - but I'm afraid I
don't know org-mode well enough to give a good suggestion.
-- Naked
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "Create new heading after this one" command
2007-09-19 10:01 ` Nuutti Kotivuori
@ 2007-10-16 10:23 ` Nuutti Kotivuori
0 siblings, 0 replies; 7+ messages in thread
From: Nuutti Kotivuori @ 2007-10-16 10:23 UTC (permalink / raw)
To: emacs-orgmode
Nuutti Kotivuori wrote:
> Carsten Dominik wrote:
>> I guess this would be as easy as
>>
>> (defun org-new-heading-after-current ()
>> "Insert a new heading with same level as current, after current
>> subtree."
>> (interactive)
>> (org-back-to-heading)
>> (org-insert-heading)
>> (org-move-subtree-down)
>> (end-of-line 1))
>
> Works like a dream, thanks!
>
>> Any suggestions for a keybinding?
>
> Well, it has to be a single keypress, like M-RET - but I'm afraid I
> don't know org-mode well enough to give a good suggestion.
I've been using this since I got the snippet. My keybinding for it is
simply C-M-RET, which seems to work well enough.
I couldn't really live without this anymore - the only use for M-RET I
have (outside of text lists) is for a specific case which I will
mention in another posting.
-- Naked
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: "Create new heading after this one" command
2007-09-18 17:38 ` Carsten Dominik
2007-09-19 1:05 ` Bastien
2007-09-19 10:01 ` Nuutti Kotivuori
@ 2007-09-23 7:35 ` Renzo Been
2 siblings, 0 replies; 7+ messages in thread
From: Renzo Been @ 2007-09-23 7:35 UTC (permalink / raw)
To: emacs-orgmode
Carsten Dominik <dominik <at> science.uva.nl> writes:
,-----
| ...And you could add an extra line to the end of
| the command like this:
|
| (defun org-new-heading-after-current ()
| "Insert a new heading with same level as current, after current subtree."
| (interactive)
| (org-back-to-heading)
| (org-insert-heading)
| (org-move-subtree-down)
| (end-of-line 1)
| (org-todo))
|
| In that way it works real nice together with
| TODO-cycling:
|
| #+SEQ_TODO: TODO(t) NEXT(n) INPROGRESS(i@) SOMEDAY(s) WAITING(w@) | DONE(d)
CANCELED(c@)
| #+STARTUP: lognotestate
|
| You'll get to chose what type your new heading
| should be...
|
| Ciao
| Renzo
`-----
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-10-16 10:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18 15:45 "Create new heading after this one" command Nuutti Kotivuori
2007-09-18 17:38 ` Carsten Dominik
2007-09-19 1:05 ` Bastien
2007-09-20 7:14 ` Rainer Stengele
2007-09-19 10:01 ` Nuutti Kotivuori
2007-10-16 10:23 ` Nuutti Kotivuori
2007-09-23 7:35 ` Renzo Been
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).