From a25d00d5dff6c162b1bb7542201c590052d267fa Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sat, 19 Aug 2023 10:23:40 +0300 Subject: [PATCH] org-return: Do not insert inside folded region * lisp/org.el (org--newline): When called interactively, check for invisible edits. Reported-by: Kaiyu Zheng Link: https://orgmode.org/list/87wmxs8hxt.fsf@localhost --- lisp/org.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/org.el b/lisp/org.el index c5c080810..02a081339 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -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)))