Handling 4 Kinds of Return in Org Mode

You might want more than a few ways to “return” when inside of Org; I did.

  • org-return-indent: Make it really easy to work in existing list items, headings, and tables
    • This is listed first because I often go back to modify entries
    • <return> because it is used the most
  • org-meta-return: Make it really easy to add new list items, headings, and table contents
    • M-<return> because the binding comes with Org
  • electric-indent-just-newline: For when I want to break out of the default Org indentation to start working at the beginning of the line for example when I’m done working in a list or have just created a new heading
    • C-M-<return> because it is next step “lower” in the binding
  • This: When I want to insert a new line between the current and next line then position the cursor correctly indented at the start of it.

    (defun help/smart-open-line ()
      "Insert a new line, indent it, and move the cursor there.
    
    This behavior is different then the typical function bound to return which may be `open-line' or `newline-and-indent'. When you call with the cursor between ^ and $, the contents of the line to the right of it will be moved to the newly inserted line. This function will not do that. The current line is left alone, a new line is inserted, indented, and the cursor is moved there.
    
    Attribution: URL `http://emacsredux.com/blog/2013/03/26/smarter-open-line/'"
      (interactive)
      (move-end-of-line nil)
      (newline-and-indent))
    
    • s-<return because it is that is the last place in the modifier key chain

5 thoughts on “Handling 4 Kinds of Return in Org Mode”

Leave a Reply

Your email address will not be published. Required fields are marked *