Eli Zaretskii <e...@gnu.org> writes: >> So, I'd like some way to configure `kill-whole-line'/`kill-line' to warn >> user about killing hidden text when we detect that we are deleting a >> folded heading. Something like: >> >> (y-or-n-p "Kill hidden subtree along with headline? ") >> >> I believe that it might be useful in other situations as well. Like in >> outline-mode or outline-minor-mode. > > How would kill-line know that it's about to kill a subtree? All it > knows is that it is killing some invisible text.
I imagine the following: 1. `kill-*-line' function will, by default, test if invisible text of length size is killed and query the user when called interactively. 2. Major modes could also set buffer-local `kill-line-query-function' that will return nil when killing should proceed without query or a string with query text. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>