Status-Detective-783 · 2022-02-20 17:58
I have this. I'd like to delete the entire subtree at some point, such as either the entire TODO, or perhaps everything under List 1. Is there a command to do this?
TODO Check Auto Oil
- List 1
- List 1.1
- List 1.1.1
- List 1.1.2
- List 1.1.2.1.1
- List 1.1.2.1.2
- fyi
- hi
- [-] List 2.1
-
- [X]
- [ ]
-
No-Command-791 · 2022-02-20 19:42
`org-cut-subtree`. For the plain list, you can call `org-toggle-heading` on `List 1` then `org-cut-subtree`. Edit: be warned, though, that everything between `List 1` and the next heading will be deleted, not just its sub-items.
tigre200 · 2022-02-20 19:56
Put your cursor on list 1 and click C-c C-x C-w. It is basically a cut, so you can use C-c C-x C-y to paste it into another sub-tree.
If you want to archive it into an archive file, type C-c C-x C-a.
SlowValue · 2022-02-20 20:09
fold the (sub-)tree you would like to remove and press `C-k`.
xtifr · 2022-02-20 21:42
Do you have menus disabled or something? You shouldn't have to ask this question--it's right there in the Org menu: Org->Edit Structure->Cut Subtree. It even has a handy keybinding (`C-c C-x C-w`) listed *right there on the menu* for future reference.
In the interest of teaching someone to fish: *always* check the menus when you're not sure how to do something. You *may* not find the answer, but there's a *really* good chance you will! And Emacs is *so* big and complex that there is *going* to be stuff you don't remember or weren't yet aware of that you can find in the menus, even after *years* of use! I've been using Emacs for over two decades, and I still regularly use the menus to find stuff, especially for mode-specific stuff.
Also, in case you didn't realize, the `describe-key` function (`C-h k` or `F1 k`) works on mouse clicks as well as keys, so you can find the documentation for a menu item by clicking `C-h k` and then navigating to that item. This is handy if you're not sure the menu item you found is *really* what you need.
And if someone persuaded you that the menu is useless and you should disable it, you should be *very* cross with that person, and should go re-enable it right away! :)
Status-Detective-783 · 2022-02-20 23:23
You know, this is absolutely excellent advice, thanks! I searched all over the place for "**delete** tree" and found nothing. For some reason I didn't think of "**cut** subtree". But yes, the menus was the ONE place I didn't look. Also, great to know I can `C-h k` on menu items to learn what they are! Thank you so much!!!
Status-Detective-783 · 2022-02-20 23:29
Real easy to remember this one, thanks!
Status-Detective-783 · 2022-02-20 23:34
I see that this effectively searches up and finds `TODO Check Auto Oil` and cuts that entire tree and all contents and subtrees. While that's not exactly what I was looking for, I'm in "absorb everything learning mode", and this is great to know about this, thanks!