Hi All, I recently upgraded to Emacs 29.2 (from 29.1) and observed that `org-insert-heading-respect-content' has changed behavior with regard to how it handles blank lines at the end of the entry at which the command was called.
Consider the following document (with "|" representing point): #+begin_src org ,* Sec1 ,** |SubSec1 text ,** SubSec2 text #+end_src Calling `org-insert-heading-respect-content' ("C-RET") with Org version 9.6.6 (built-in Emacs 29.1) would result in: #+begin_src org ,* Sec1 ,** SubSec1 text ,** | ,** SubSec2 text #+end_src Now, with Org version 9.6.15 (built-in Emacs 29.2), it results in: #+begin_src org ,* Sec1 ,** SubSec1 text ,** | ,** SubSec2 text #+end_src Note the missing blank line between the inserted heading and SubSec2. That is an unfortunate change of behavior since those who like to keep some breathing space at the end of entries now have to deal with it manually after the heading is inserted. So the handy "C-RET" becomes something like "C-RET RET C-b SPC". Plus the cost of having to think about it, and that of occasionally forgetting it, consistency is just harder to maintain. As far as I can tell, the commit which introduced this change of behavior was https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=52bc95676. It was introduced to deal with a real issue which had been reported: to avoid the possibility of those blank lines being shown folded after insertion in some cases (link on the commit). However, as far as I understand, the issue the commit tried to fix was one of visibility of the buffer. The actual contents were expected, correct. But to fix the visibility issue, the behavior of `org-insert-heading' with regard to the actual contents was changed: to avoid the blank lines being shown folded the blank lines were actually removed. So I'd like to suggest / propose that previous behavior of `org-insert-heading' with respect to blank lines be somehow restored and that the problem of the blank lines being shown folded be treated as one of visibility / folding, not one of buffer contents. Best regards, gusbrs. Emacs : GNU Emacs 29.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2024-01-18 Package: Org mode version 9.6.15 (release_9.6.15 @ /usr/local/share/emacs/29.2/lisp/org/) current state: ============== (setq org-link-elisp-confirm-function 'yes-or-no-p org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-persist-after-read-hook '(org-element--cache-persist-after-read) org-export-before-parsing-hook '(org-attach-expand-links) org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-archive-hook '(org-attach-archive-delete-maybe) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change org-cycle-display-inline-images) org-persist-before-read-hook '(org-element--cache-persist-before-read) org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-fold-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-confirm-shell-link-function 'yes-or-no-p outline-isearch-open-invisible-function 'outline-isearch-open-invisible org-agenda-before-write-hook '(org-agenda-add-entry-text) org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-confirm-elisp-link-function 'yes-or-no-p org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-persist-directory "/tmp/org-persist-St7aom" org-fold-core-isearch-open-function 'org-fold--isearch-reveal org-persist-before-write-hook '(org-element--cache-persist-before-write) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-link-shell-confirm-function 'yes-or-no-p org-babel-pre-tangle-hook '(save-buffer) org-agenda-loop-over-headlines-in-active-region nil org-occur-hook '(org-first-headline-recenter) org-metadown-hook '(org-babel-pop-to-session-maybe) org-link-parameters '(("attachment" :follow org-attach-follow :complete org-attach-complete-link) ("id" :follow org-id-open) ("eww" :follow org-eww-open :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link :insert-description org-info-description-as-command) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("doi" :follow org-link-doi-open :export org-link-doi-export) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[514 "\301\300\302 Q \"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("mailto" :follow #[514 "\301\300\302 Q \"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("https" :follow #[514 "\301\300\302 Q \"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("http" :follow #[514 "\301\300\302 Q \"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("ftp" :follow #[514 "\301\300\302 Q \"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("help" :follow org-link--open-help :store org-link--store-help) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp)) org-metaup-hook '(org-babel-load-in-session-maybe) )