emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Bastien <bzg@gnu.org>, stardiviner <numbchild@gmail.com>
Cc: Nicholas Savage <nick@nicksavage.ca>, emacs-orgmode@gnu.org
Subject: [PATCH] Re: Bug: org-cycle stops working on Org files with empty lines at end of buffer [9.4 (9.4-elpaplus @ /home/brentg/.emacs.d/elpa/org-plus-contrib-20200914/)]
Date: Wed, 23 Sep 2020 22:13:04 +0800	[thread overview]
Message-ID: <87lfh060pb.fsf@localhost> (raw)
In-Reply-To: <87k0wkheik.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 67 bytes --]

> Also, if you can provide a patch, please go ahead.

Here it is.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Do-not-remove-trailing-newline-when-deleting-plannin.patch --]
[-- Type: text/x-diff, Size: 1607 bytes --]

From 8e99e5dea780041d314f666f506a120224f064eb Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yantar92@gmail.com>
Date: Wed, 23 Sep 2020 21:54:47 +0800
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.
---
 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index a9fdc7b77..845920a71 100644
--- a/lisp/org.el
+++ b/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)))
-- 
2.26.2


[-- Attachment #3: Type: text/plain, Size: 354 bytes --]



Bastien <bzg@gnu.org> writes:

> Hi,
>
> stardiviner <numbchild@gmail.com> writes:
>
>> I also did a bisect debug. Found the function ~org-cycle-show-empty-lines~ in hook
>> ~org-cycle-hook~ caused this problem.
>
> Did you find the commit that introduces this bug?
>
> Also, if you can provide a patch, please go ahead.
>
> Thanks!
>
> -- 
>  Bastien

  parent reply	other threads:[~2020-09-23 14:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-19 16:10 Bug: org-cycle stops working on Org files with empty lines at end of buffer [9.4 (9.4-elpaplus @ /home/brentg/.emacs.d/elpa/org-plus-contrib-20200914/)] B Goodr
2020-09-19 18:09 ` Nicholas Savage
2020-09-23  1:19   ` stardiviner
2020-09-23 12:19     ` Bastien
2020-09-23 14:07       ` stardiviner
2020-09-23 15:07         ` Ihor Radchenko
2020-10-18  7:20         ` stardiviner
2020-09-23 14:13       ` Ihor Radchenko [this message]
2020-09-28  5:08         ` [PATCH] " Kyle Meyer
2020-09-28  5:34           ` Ihor Radchenko
2020-10-03  7:34           ` stardiviner
2020-10-03  8:48             ` Bastien
2020-10-03 11:04               ` stardiviner
2020-10-27  4:11                 ` Kyle Meyer
2020-09-23 12:18   ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfh060pb.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=nick@nicksavage.ca \
    --cc=numbchild@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).