reddit / emacs

Newbie. How to efficiently start new line or Entry below folded entry?

Status-Detective-783 · 2022-02-26 22:56
Suppose I start with this, with point on letter J: * Example 1 * PROJECTS... * Inbox... I want this * EXAMPLE 2 [EDIT: Actually, this is impossible with org-indent-mode on.] * PROJECTS... x <--- point here at space marked x * Inbox... What's the standard way and/or the most efficient way to get there? Or alternatively, achieve this: * Example 3 * PROJECTS... * x <--- point here at space marked x * Inbox... I know that if I start with Example 1 and I press C-S-RET, I'll get this: * Example 4 * PROJECTS... * TODO x <--- point here at space marked x * Inbox... That's good enough for `TODO`'s, but I'd like to do something similar for the other cases. But it's odd that it leaves a space there (why does it do that?). I'd rather it not, but I'll accept this standard behavior, for now, if that's just the way it works out-of-the-box. (I know I can change emacs to do whatever I want though.) Also, the C-S-RET behaves a little different if the point starts at the end of `* Projects...x` at space marked `x`. In that case, it creates something like this: * Example 5 * PROJECTS... * TODO x <--- point here at space marked x * Inbox... In Example 5, it creates a new TODO item under the last child entry of `* PROJECTS`, but leaving `* PROJECTS` otherwise folded. Isn't it a little odd to have an intermediate parent invisible? Finally, does that last point position (marked `x` here:`* Projects...x`) have special meaning/purpose? Is there a name for that position? EDIT: I think some of my questions about the functionality of ellipses and spaces is probably related to this timely post: https://www.reddit.com/r/emacs/comments/t1r2wq/have_you_ever_wondered_how_orgmode_toggles_the/. Which, from a newbie perspective, is probably summed up as "Because reasons."
NihilistDandy · 2022-02-27 02:25
You may be interested in `C-RET` and `C-c RET`.
Status-Detective-783 · 2022-02-27 05:20
Thanks! C-RET works great! It produces the effect EXAMPLE1 -> EXAMPLE3. I already knew that, or at least I forgot that I already knew that! I have it documented in my own notes: > C-RET - New heading below current heading. Can be anywhere in an entry, it will skip down and create new heading. Now on to C-c RET. Help says this: > Call ‘org-table-hline-and-move’ or ‘org-insert-heading’. For purposes of this question, we aren't in a table so ‘org-insert-heading’. It's a pretty long help page, but here's what it does basically. If point is at beginning of line, create a new heading above. Or in other words, to create a new heading above, `C-a C-c RET`. Then you get the following effect. Suppose point is on the letter 'b' on the second line: * Example 1 * PROJECTS... * Inbox... Then `C-a C-c RET` produces this. It's basically the reverse of C-RET, going up instead of down: * EXAMPLE 2 * PROJECTS... x <--- point here at space marked x * Inbox... Now with prefix, I think (not 100% sure) `C-u C-c RET` seems to be the same as `C-RET`. Finally, one can do `C-u C-u C-c RET`. Referring to below, suppose point is anywhere within `* PROJ1`, folded or not, or in the notes below that: * PROJECTS * PROJ1 <-- Anywhere here Some notes blah blah <-- Or anywhere here * PROJ2... * Inbox... `C-u C-u C-c RET` creates a new heading at the END of the list of headings. As the "last child" of the parent (with an additional empty line showing, but I don't care about that): * PROJECTS * PROJ1 Some notes blah blah * PROJ2... * x<--- point here at space marked x * Inbox... Very useful, thanks!