Is it possible to prevent editing of text within a collapsed subtree in Org Mode? That is, I would like to make it impossible to edit the hidden text. This seems like something that should exist but I haven't seen a way to do it.
Asked
Active
Viewed 1,590 times
1 Answers
29
From the fine Org Manual -- 2.3.3 Catching Invisible Edits:
Sometimes you may inadvertently edit an invisible part of the buffer and be confused on what has been edited and how to undo the mistake. Setting org-catch-invisible-edits to non-nil will help prevent this. See the docstring of this option on how Org should catch invisible edits and process them.
I have this in my init.el:
(setq-default org-catch-invisible-edits 'smart)
I found out about the 'smart
option by hitting C-h v org-catch-invisible-edits
.

Tad Ashlock
- 596
- 4
- 6
-
1Is 'smart sufficient, or should I set it to 'error if I want to make it impossible to accidentally edit hidden text? – incandescentman Jul 11 '15 at 05:47
-
Smart should be good enough. If you do a 'C-h v' to get help on 'org-catch-invisible-edits' you can find the following explanation of what the ''smart' option means: '"Make point visible, and do insertion/deletion if it is adjacent to visible text and the change feels predictable. Never delete a previously invisible character or add in the middle or right after an invisible region. Basically, this allows insertion and backward-delete right before ellipses."' – Brian Z Apr 29 '18 at 17:32
-
I found the manual entry first, but the problem is it shows the variable to use is `org-fold-catch-invisible-edits`, which does not exist in version 9.5.2. So I had to come here for the right answer. – Jim Jan 07 '23 at 14:56