Make it possible to protect hidden subtrees to be killed by `C-k'
commitfd1d2992f6bdda19ebaea0761036236f21305cdc
authorCarsten Dominik <carsten.dominik@gmail.com>
Wed, 2 Jun 2010 18:20:10 +0000 (2 20:20 +0200)
committerCarsten Dominik <carsten.dominik@gmail.com>
Wed, 2 Jun 2010 22:18:44 +0000 (3 00:18 +0200)
tree263b043731fd83b549cdbab826487c8e92c5d3c4
parent70d24c5d036cd5787f719104a0ad2f157c5207b1
Make it possible to protect hidden subtrees to be killed by `C-k'

* lisp/org.el (org-ctrl-k-protect-subtree): New option.
(org-kill-line): Protect hidden subtrees if the user wants it.
* doc/org.texi (Headlines): Mention the special behavior of C-k
in headlines.

Scott Otterson writes:

> For what must be the dozenth time, I've just accidentally deleted a
> large tree by typing C-k while in a headline.
>
> This is really easy to do because emacs users have "C-k deletes to the
> end of the line" worn deeply into their neural pathways -- it's so
> automatic for me that the keystroke is close to subconscious.  A
> mistaken C-k is especially hard to detect because org-mode displays
> the result exactly like what your subconscious expects, that is, a
> collapsed headline is deleted to the end -- and the tree underneath is
> wiped out with no noticeable warning.
>
> Feature request: add an option preventing tree deletion with C-k
> without user confirmation.  Actually, I'd like an option to prevent it
> period.
>
> If this option is already in there, then you're encouraged to tell me
> to RTFM.  But then also please tell me where it is, because I can't
> find it.

Carsten replies

> This is now possible due to the variable
> `org-ctrl-k-protect-subtree'.  But I predict that you are going to set
> it to nil again soon :D
doc/org.texi
lisp/org.el