Browse Source

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 planning info is completetly removed from a
heading.

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.

Reported-by: Krishan Kharagjitsing <krishan404@gmail.com>
Ref: https://orgmode.org/list/CAKXDJO2xUgBoTx-XcL7WbXyvP2Oj8iVEmdmRNCVzdRTEwzNR+Q@mail.gmail.com
Ihor Radchenko 4 years ago
parent
commit
5d4c0f59d8
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lisp/org.el

+ 2 - 2
lisp/org.el

@@ -10684,8 +10684,8 @@ WHAT entry will also be removed."
 	 ;; If there is nothing more to add and no more keyword is
 	 ;; left, remove the line completely.
 	 (if (and (looking-at-p "[ \t]*$") (not what))
-	     (delete-region (line-beginning-position)
-			    (line-beginning-position 2))
+	     (delete-region (line-end-position 0)
+			    (line-end-position))
 	   ;; If we removed last keyword, do not leave trailing white
 	   ;; space at the end of line.
 	   (let ((p (point)))