org-return: Do not insert inside folded region

* lisp/org.el (org--newline): When called interactively, check for
invisible edits.

Reported-by: Kaiyu Zheng <kaiyu_zheng@alumni.brown.edu>
Link: https://orgmode.org/list/87wmxs8hxt.fsf@localhost
This commit is contained in:
Ihor Radchenko 2023-08-19 10:23:40 +03:00
parent 27a41d418d
commit a25d00d5df
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 0 deletions

View File

@ -17663,6 +17663,8 @@ If INDENT is non-nil, call `newline-and-indent' with ARG to
indent unconditionally; otherwise, call `newline' with ARG and
INTERACTIVE, which can trigger indentation if
`electric-indent-mode' is enabled."
(when interactive
(org-fold-check-before-invisible-edit 'insert))
(if indent
(org-newline-and-indent arg)
(newline arg interactive)))