[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cycling through TODO workflow joins the next line onto the current o
From: |
Ihor Radchenko |
Subject: |
Re: Cycling through TODO workflow joins the next line onto the current one |
Date: |
Wed, 23 Sep 2020 22:22:52 +0800 |
> On my emacs 27, following demonstrates the problem.
The patch is attached. It should fix the problem.
>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
Richard Kim <emacs18@gmail.com> writes:
> Richard Kim <emacs18@gmail.com> writes:
>
>> Bastien <bzg@gnu.org> writes:
>>
>>> Hi Krishan,
>>>
>>> Krishan Kharagjitsing <krishan404@gmail.com> writes:
>>>
>>>> Hello, I found the following weird behaviour.
>>>
>>> What is M-x org-version RET ?
>>
>> Because of (setq org-log-done 'time) according to
>> https://github.com/syl20bnr/spacemacs/issues/13901#issuecomment-697323151
>>
>>>> When I set some tasks to DONE and fold the headings with TAB, then
>>>> when I cycle back from DONE to TODO it joins the next line with the
>>>> current one.
>>>>
>>>> org_mode_bug
>>>>
>>>> Reproduction guide
>>>>
>>>> Make two TODO headings in org mode
>>>> Cycle both TODO items to DONE
>>>> Fold the headings (so the dots appear, because the timestamp gets
>>>> folded with the heading)
>>>> Cycle the first DONE heading
>>>
>>> Why are there timestamps? Can you provide a test .org file where we
>>> can reproduce the problem?
>>>
>>> Thanks,
>>
>> The original report at the top of
>> https://github.com/syl20bnr/spacemacs/issues/13901
>> has gif animation on how this problem can be seen.
>
> On my emacs 27, following demonstrates the problem.
>
> (let ()
> (switch-to-buffer (generate-new-buffer "*demo line joining bug*"))
> (erase-buffer)
> (org-mode)
> (setq org-log-done 'time)
> (insert "* one\n")
> (insert "* two\n")
> (goto-line 1)
> (org-todo)
> (org-todo)
> (org-todo)
> (org-cycle)
> (org-todo)
> (org-todo)
> )