emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: David Naumann <naumann@cs.stevens.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: how can I insert a new heading after all at this level?
Date: Tue, 19 Feb 2013 17:36:08 -0500	[thread overview]
Message-ID: <8116.1361313368@alphaville> (raw)
In-Reply-To: Message from David Naumann <naumann@cs.stevens.edu> of "Tue, 19 Feb 2013 14:53:58 EST." <alpine.DEB.2.02.1302191451040.9441@eloi>

David Naumann <naumann@cs.stevens.edu> wrote:

> I'm a happy, frequent user of org mode but there's something I can't
> figure out from the manual.
> 
> What I would like to be able to do is insert a new heading at the same
> level as current, _following_ all the others.  For example, with the
> cursor on the A in this tree:
> 
>     * top
> ->  ** A
>     ** B
>     ** C
>     * next
> 
> I would like to insert a last sibling and move to it:
> 
>     * top
>     ** A
>     ** B
>     ** C
> ->  **
>     * next
> 
> Use case: adding to a very long chronological list.  I have not seen a
> quick way to do this using the structure motion/editing commands in
> the manual, without scrolling in one way or another.
> 
> If you have a hint, please reply to my address; I'm not on this
> mailing list.
> 

From somewhere in the second level (but not in the third or higher levels, if such
exist), you can go up to the higher-level heading (what you call top), then to the
next heading at the same level (next), open a line before that and insert a heading:

C-c C-u
C-c C-f
C-o
M-RET

If typing all that is objectionable, you can define a keyboard macro to
do it. 

Or you can define a command to do it (I just looked up the
above key bindings to find the functions to call and looked up the docs
of the various functions for the arguments):

(defun my-org-insert-heading-at-end-of-current-level ()
  (interactive)
  (outline-up-heading 1)
  (org-forward-heading-same-level 1)
  (open-line 1)
  (org-meta-return))

and either call it with M-x my-org-insert-heading-at-end-of-current-level RET
or bind it to a key.

Nick

  reply	other threads:[~2013-02-19 22:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 19:53 how can I insert a new heading after all at this level? David Naumann
2013-02-19 22:36 ` Nick Dokos [this message]
2013-02-25 16:28 ` Jonathan Leech-Pepin
2013-03-03 17:08 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8116.1361313368@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=naumann@cs.stevens.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).