emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Cycling through TODO workflow joins the next line onto the current one
@ 2020-09-20  6:37 Krishan Kharagjitsing
  2020-09-20 11:56 ` Nicholas Savage
  2020-09-23  7:17 ` Bastien
  0 siblings, 2 replies; 8+ messages in thread
From: Krishan Kharagjitsing @ 2020-09-20  6:37 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello, I found the following weird behaviour. I first reported it to the
spacemacs github (https://github.com/syl20bnr/spacemacs/issues/13901) but
they confirmed that it is an upstream bug.

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.

[image: org_mode_bug]
<https://user-images.githubusercontent.com/22841170/91837051-ed877000-ec4b-11ea-9698-151288dcc853.gif>
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

*Observed behaviour:*
The next line gets joined on the current one.

*Expected behaviour:*
No joining of lines.
System Info

   - OS: gnu/linux (WSL2, connected via X410 to Windows)
   - Emacs: 28.0.50 (also tested it on 26.1, same behaviour observed)
   - Graphic display: t
   - Distribution: spacemacs
   - Editing style: vim
   - Completion: helm
   - Layers:

(helm auto-completion emacs-lisp org themes-megapack treemacs)


   - System configuration features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND
   GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2
   FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE
   XIM MODULES THREADS PDUMPER LCMS2

[-- Attachment #2: Type: text/html, Size: 2035 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycling through TODO workflow joins the next line onto the current one
  2020-09-20  6:37 Cycling through TODO workflow joins the next line onto the current one Krishan Kharagjitsing
@ 2020-09-20 11:56 ` Nicholas Savage
  2020-09-23  7:17 ` Bastien
  1 sibling, 0 replies; 8+ messages in thread
From: Nicholas Savage @ 2020-09-20 11:56 UTC (permalink / raw)
  To: Emanuel Berg via General discussions about Org-mode.

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

I'm having a hard time reproducing this on the latest master, although it's clear from your image that something is going wrong. How are you marking the tasks as DONE? When I use C-c C-t to mark them as done, it doesn't add the "CLOSED" tag by default under emacs -Q, so I'm wondering if it's something about your or the spacemacs configuration that's causing this?

On Sun, Sep 20, 2020, at 02:37, Krishan Kharagjitsing wrote:
> Hello, I found the following weird behaviour. I first reported it to the spacemacs github (https://github.com/syl20bnr/spacemacs/issues/13901) but they confirmed that it is an upstream bug.

> 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 <https://user-images.githubusercontent.com/22841170/91837051-ed877000-ec4b-11ea-9698-151288dcc853.gif>

> 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

> *Observed behaviour:* 
> The next line gets joined on the current one.


> *Expected behaviour:* 
> No joining of lines.

> System Info 

>  * OS: gnu/linux (WSL2, connected via X410 to Windows)
>  * Emacs: 28.0.50 (also tested it on 26.1, same behaviour observed)
>  * Graphic display: t
>  * Distribution: spacemacs
>  * Editing style: vim
>  * Completion: helm
>  * Layers:
> (helm auto-completion emacs-lisp org themes-megapack treemacs)
>  * System configuration features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER LCMS2

[-- Attachment #2: Type: text/html, Size: 2830 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycling through TODO workflow joins the next line onto the current one
  2020-09-20  6:37 Cycling through TODO workflow joins the next line onto the current one Krishan Kharagjitsing
  2020-09-20 11:56 ` Nicholas Savage
@ 2020-09-23  7:17 ` Bastien
  2020-09-23 13:28   ` Richard Kim
  1 sibling, 1 reply; 8+ messages in thread
From: Bastien @ 2020-09-23  7:17 UTC (permalink / raw)
  To: Krishan Kharagjitsing; +Cc: emacs-orgmode

Hi Krishan,

Krishan Kharagjitsing <krishan404@gmail.com> writes:

> Hello, I found the following weird behaviour. 

What is M-x org-version RET ?

> 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,

-- 
 Bastien


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycling through TODO workflow joins the next line onto the current one
  2020-09-23  7:17 ` Bastien
@ 2020-09-23 13:28   ` Richard Kim
  2020-09-23 13:48     ` Richard Kim
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Kim @ 2020-09-23 13:28 UTC (permalink / raw)
  To: Bastien; +Cc: Krishan Kharagjitsing, emacs-orgmode

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycling through TODO workflow joins the next line onto the current one
  2020-09-23 13:28   ` Richard Kim
@ 2020-09-23 13:48     ` Richard Kim
  2020-09-23 14:22       ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Kim @ 2020-09-23 13:48 UTC (permalink / raw)
  To: Bastien; +Cc: Krishan Kharagjitsing, emacs-orgmode

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)
  )


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycling through TODO workflow joins the next line onto the current one
  2020-09-23 13:48     ` Richard Kim
@ 2020-09-23 14:22       ` Ihor Radchenko
  2020-09-23 23:49         ` Samuel Wales
  2020-09-29  3:22         ` Kyle Meyer
  0 siblings, 2 replies; 8+ messages in thread
From: Ihor Radchenko @ 2020-09-23 14:22 UTC (permalink / raw)
  To: emacs18, Bastien; +Cc: Krishan Kharagjitsing, emacs-orgmode

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

> On my emacs 27, following demonstrates the problem.

The patch is attached. It should fix the problem.


[-- 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: 1516 bytes --]



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)
>   )

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: Cycling through TODO workflow joins the next line onto the current one
  2020-09-23 14:22       ` Ihor Radchenko
@ 2020-09-23 23:49         ` Samuel Wales
  2020-09-29  3:22         ` Kyle Meyer
  1 sibling, 0 replies; 8+ messages in thread
From: Samuel Wales @ 2020-09-23 23:49 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs-orgmode, Krishan Kharagjitsing, emacs18

i can confirm visual [not physical] joining of entries [plausibly
doneified tasks] frequently since at least the previous maint, in
vanilla emacs 24 and 25.


On 9/23/20, Ihor Radchenko <yantar92@gmail.com> wrote:
>> On my emacs 27, following demonstrates the problem.
>
> The patch is attached. It should fix the problem.
>
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Cycling through TODO workflow joins the next line onto the current one
  2020-09-23 14:22       ` Ihor Radchenko
  2020-09-23 23:49         ` Samuel Wales
@ 2020-09-29  3:22         ` Kyle Meyer
  1 sibling, 0 replies; 8+ messages in thread
From: Kyle Meyer @ 2020-09-29  3:22 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Bastien, emacs18, Krishan Kharagjitsing, emacs-orgmode

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 <yantar92@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 <krishan404@gmail.com>
    +    Ref: https://orgmode.org/list/CAKXDJO2xUgBoTx-XcL7WbXyvP2Oj8iVEmdmRNCVzdRTEwzNR+Q@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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-29  3:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-20  6:37 Cycling through TODO workflow joins the next line onto the current one Krishan Kharagjitsing
2020-09-20 11:56 ` Nicholas Savage
2020-09-23  7:17 ` Bastien
2020-09-23 13:28   ` Richard Kim
2020-09-23 13:48     ` Richard Kim
2020-09-23 14:22       ` Ihor Radchenko
2020-09-23 23:49         ` Samuel Wales
2020-09-29  3:22         ` Kyle Meyer

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).