Ihor Radchenko writes: >> On my emacs 27, following demonstrates the problem. > > The patch is attached. It should fix the problem.
Thanks for the patch. > Subject: [PATCH] Do not remove trailing newline when deleting planning info > line. > > * lisp/org.el (org-add-planning-info): Remove front newline instead of > trailing newline when deleting planning info is completetly removed > from a heading. Fixes "Cycling through TODO workflow joins the next > line onto the current one". > > The old behaviour affected folded headlines containing only planning > info in the body: > > Before deletion: > * DONE Headline<begin fold> > CLOSED: [2020-09-23 Wed 21:39]<end fold> > * test > > After deletion: > * DONE Headline<begin fold> > <end fold>* test > > The newline after the first headline is hidden making both the > headlines appear at the same visual line. > > New behaviour: > After deletion: > * DONE Headline > * test > > All the folded text is completely removed. Nicely explained, and appears to work well. Applied (5d4c0f59d) with a couple of minor tweaks to the commit message: 1: 8e776cca1 ! 1: 5d4c0f59d Do not remove trailing newline when deleting planning info line. @@ Metadata Author: Ihor Radchenko <yanta...@gmail.com> ## Commit message ## - Do not remove trailing newline when deleting planning info line. + Do not remove trailing newline when deleting planning info line * lisp/org.el (org-add-planning-info): Remove front newline instead of - trailing newline when deleting planning info is completetly removed - from a heading. Fixes "Cycling through TODO workflow joins the next - line onto the current one". + trailing newline when planning info is completetly removed from a + heading. The old behaviour affected folded headlines containing only planning info in the body: @@ Commit message All the folded text is completely removed. + Reported-by: Krishan Kharagjitsing <krishan...@gmail.com> + Ref: https://orgmode.org/list/cakxdjo2xugbotx-xcl7wbxyvp2oj8ivemdmrncvzdrtewzn...@mail.gmail.com + ## lisp/org.el ## @@ lisp/org.el: (defun org-add-planning-info (what &optional time &rest remove) ;; If there is nothing more to add and no more keyword is