emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: Visibility cycling with inline tasks 2
@ 2021-10-01  3:26 No Wayman
  2021-10-01  6:17 ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: No Wayman @ 2021-10-01  3:26 UTC (permalink / raw)
  To: mick.dauer; +Cc: emacs-orgmode

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


I can confirm the issue you've outlined on latest 'main'.
To me it looks like the problem is in `org-inline-hide-tasks'.
I don't use inline tasks, so I'm not sure what the exact expected 
behavior is,
but that function uses a `while' during `org-cycle-hook' to 
iterate through all of the headings.
My intuition is that it's overshooting a boundary and toggling 
visibility on more than it should.

Does the attached patch behave more in line with what you expect? 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-inlinetask.el-Limit-children-visibility-toggle-t.patch --]
[-- Type: text/x-patch, Size: 1365 bytes --]

From 04ed84c36a4cc04838b5b75e18858996af125f77 Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholelife@gmail.com>
Date: Thu, 30 Sep 2021 23:31:50 -0400
Subject: [PATCH] org-inlinetask.el: Limit children visibility toggle to
 subtree

* org-inlinetask: (org-inlinetask-toggle-visibility): Limit toggling
to subtree.

Not sure if this is correct behavior or not. Just a suggestion.
---
 lisp/org-inlinetask.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index 3379a2e46..3bdc03ae4 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -334,11 +334,13 @@ This function is meant to be used in `org-cycle-hook'."
 	   (org-inlinetask-goto-end)))))
     (`children
      (save-excursion
-       (while
-	   (or (org-inlinetask-at-task-p)
-	       (and (outline-next-heading) (org-inlinetask-at-task-p)))
-	 (org-inlinetask-toggle-visibility)
-	 (org-inlinetask-goto-end))))))
+       (save-restriction
+         (org-narrow-to-subtree)
+         (while
+             (or (org-inlinetask-at-task-p)
+                 (and (outline-next-heading) (org-inlinetask-at-task-p)))
+           (org-inlinetask-toggle-visibility)
+           (org-inlinetask-goto-end)))))))
 
 (defun org-inlinetask-remove-END-maybe ()
   "Remove an END line when present."
-- 
2.33.0


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

* Re: Visibility cycling with inline tasks 2
  2021-10-01  3:26 Visibility cycling with inline tasks 2 No Wayman
@ 2021-10-01  6:17 ` Ihor Radchenko
  2021-10-01 14:44   ` No Wayman
  2021-10-01 17:04   ` Timothy
  0 siblings, 2 replies; 9+ messages in thread
From: Ihor Radchenko @ 2021-10-01  6:17 UTC (permalink / raw)
  To: No Wayman; +Cc: emacs-orgmode, mick.dauer

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

No Wayman <iarchivedmywholelife@gmail.com> writes:

> I can confirm the issue you've outlined on latest 'main'.
> To me it looks like the problem is in `org-inline-hide-tasks'.
> I don't use inline tasks, so I'm not sure what the exact expected 
> behavior is,
> but that function uses a `while' during `org-cycle-hook' to 
> iterate through all of the headings.
> My intuition is that it's overshooting a boundary and toggling 
> visibility on more than it should.
>
> Does the attached patch behave more in line with what you expect? 

Your patch will fail with the following counterexample (when there is a
subheading containing an inlinetask inside current heading):

* Example
** heading 1
xxxxx
** heading 2
*************** TODO Test access with provided credentials
xxxxx
*************** END
*** subheading
*************** TODO State "high value" targets
:@CB:
xxxxx
*************** END
** heading 3
xxxxx

The recepy is same with original:

1. emacs -Q
2. paste the following snipped (right into the scratch buffer)
3. execute the two commands at the end C-x C-e for each
4. collapse all (TAB TAB)
5. expand Example (TAB)
5. go to heading 2 and expand it (TAB)

I propose an alternative patch. See the attached.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-inlinetask.el-Fix-visibility-cycling-for-inlinet.patch --]
[-- Type: text/x-diff, Size: 1454 bytes --]

From ec78cbc00b4e2abf201149b76ce41df87869627f Mon Sep 17 00:00:00 2001
Message-Id: <ec78cbc00b4e2abf201149b76ce41df87869627f.1633068903.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Fri, 1 Oct 2021 14:03:47 +0800
Subject: [PATCH] org-inlinetask.el: Fix visibility cycling for inlinetasks

* lisp/org-inlinetask.el (org-inlinetask-hide-tasks): Make sure that
we loop over inlinetasks inside current section only.
`org-inlinetask-goto-end' moves point to the end of the inlinetask
element.  If an inlinetask is followed by a heading, the function
logic will treat the heading as the beginning of another inline task.
Prevent it by moving the point at the end of the END line of the
inlinetask.

Fixes
https://list.orgmode.org/orgmode/CAP7OBx+rs-7v4jstEFYC4u0=0NZ3xJKfb3CNrWeDvjmwRTvgxw@mail.gmail.com/
---
 lisp/org-inlinetask.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index 3379a2e46..6320be12b 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -338,7 +338,8 @@ (defun org-inlinetask-hide-tasks (state)
 	   (or (org-inlinetask-at-task-p)
 	       (and (outline-next-heading) (org-inlinetask-at-task-p)))
 	 (org-inlinetask-toggle-visibility)
-	 (org-inlinetask-goto-end))))))
+	 (org-inlinetask-goto-end)
+         (backward-char))))))
 
 (defun org-inlinetask-remove-END-maybe ()
   "Remove an END line when present."
-- 
2.32.0


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

* Re: Visibility cycling with inline tasks 2
  2021-10-01  6:17 ` Ihor Radchenko
@ 2021-10-01 14:44   ` No Wayman
  2021-10-01 17:04   ` Timothy
  1 sibling, 0 replies; 9+ messages in thread
From: No Wayman @ 2021-10-01 14:44 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode, mick.dauer


Ihor Radchenko <yantar92@gmail.com> writes:

> Your patch will fail with the following counterexample (when 
> there is a
> subheading containing an inlinetask inside current heading):

I wasn't really sure what the intended behavior is, but that makes 
sense.

> I propose an alternative patch. See the attached.

Haven't installed it, but at a glance it stands to reason.


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

* Re: Visibility cycling with inline tasks 2
  2021-10-01  6:17 ` Ihor Radchenko
  2021-10-01 14:44   ` No Wayman
@ 2021-10-01 17:04   ` Timothy
  2022-04-30  8:58     ` Ihor Radchenko
  1 sibling, 1 reply; 9+ messages in thread
From: Timothy @ 2021-10-01 17:04 UTC (permalink / raw)
  To: emacs-orgmode

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

Just marking this as a patch for <https://updates.orgmode.org/> :)

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

* Re: Visibility cycling with inline tasks 2
  2021-10-01 17:04   ` Timothy
@ 2022-04-30  8:58     ` Ihor Radchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2022-04-30  8:58 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode

Timothy <tecosaur@gmail.com> writes:

> Just marking this as a patch for <https://updates.orgmode.org/> :)

Applied.
on main as 5f184b5f2

Best,
Ihor


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

* Re: Visibility cycling with inline tasks 2
  2021-09-29 18:38   ` Michael Dauer
@ 2021-09-30  7:57     ` Ihor Radchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2021-09-30  7:57 UTC (permalink / raw)
  To: Michael Dauer; +Cc: emacs-orgmode

Michael Dauer <mick.dauer@gmail.com> writes:

> I wanted to help you with testing. But I could not find a branch dev in
> that repo.

I did not mean literally "dev" branch. The default branch there is my
local patches I plan to merge to Org eventually.

> Anyway, I'll wait for it to be populated into the main repo. When should I
> retry there?

I will prepare the patch for the main repo and post a reply to your
original bug report once I get time to do it.

Best,
Ihor


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

* Re: Visibility cycling with inline tasks 2
  2021-09-29 15:09 ` Ihor Radchenko
@ 2021-09-29 18:38   ` Michael Dauer
  2021-09-30  7:57     ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Dauer @ 2021-09-29 18:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Hi Ihor,

Thanks for the clarification.

I wanted to help you with testing. But I could not find a branch dev in
that repo.

Anyway, I'll wait for it to be populated into the main repo. When should I
retry there?

Regards,
Michael

Am Mi., 29. Sept. 2021 um 17:08 Uhr schrieb Ihor Radchenko <
yantar92@gmail.com>:

> Michael Dauer <mick.dauer@gmail.com> writes:
>
> > Hi,
> >
> > Was something wrong with my previous report or is nobody interested in
> > inline tasks?
>
> Your report is fine, but please note the following
> (https://orgmode.org/worg/org-mailing-list.html):
>
> >> What to do if you don't receive an answer
>
> >> If your email is referenced on updates.orgmode.org, it will get the
> >> attention of the maintainers when they have enough time. (Remember
> >> they work on a volunteer basis.)
> >>
> >> If your email is not referenced there and you think it deserves more
> >> attention, you can do this:
> >>
> >> If it is a bug report, check that you provided enough information,
> >> especially the Org and Emacs versions and a step-by-step recipe to
> >> reproduce the bug.
> >>
> >> If it is a question, give more information on what you tried, why you
> >> still have the question and why the answer may be of interest for
> >> other subscribers.
> >>
> >> If you have nothing special to add to your first message and just
> >> want to "bump" the thread, please wait at least one month before
> >> doing so.
>
> Your issue is probably fixed in my personal dev branch at
> https://github.com/yantar92/org
>
> Best,
> Ihor
>

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

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

* Re: Visibility cycling with inline tasks 2
  2021-09-29 14:48 Michael Dauer
@ 2021-09-29 15:09 ` Ihor Radchenko
  2021-09-29 18:38   ` Michael Dauer
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2021-09-29 15:09 UTC (permalink / raw)
  To: Michael Dauer; +Cc: emacs-orgmode

Michael Dauer <mick.dauer@gmail.com> writes:

> Hi,
>
> Was something wrong with my previous report or is nobody interested in
> inline tasks?

Your report is fine, but please note the following
(https://orgmode.org/worg/org-mailing-list.html):

>> What to do if you don't receive an answer

>> If your email is referenced on updates.orgmode.org, it will get the
>> attention of the maintainers when they have enough time. (Remember
>> they work on a volunteer basis.)
>> 
>> If your email is not referenced there and you think it deserves more
>> attention, you can do this:
>> 
>> If it is a bug report, check that you provided enough information,
>> especially the Org and Emacs versions and a step-by-step recipe to
>> reproduce the bug.
>>
>> If it is a question, give more information on what you tried, why you
>> still have the question and why the answer may be of interest for
>> other subscribers.
>>
>> If you have nothing special to add to your first message and just
>> want to "bump" the thread, please wait at least one month before
>> doing so.

Your issue is probably fixed in my personal dev branch at
https://github.com/yantar92/org 

Best,
Ihor


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

* Visibility cycling with inline tasks 2
@ 2021-09-29 14:48 Michael Dauer
  2021-09-29 15:09 ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Dauer @ 2021-09-29 14:48 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi,

Was something wrong with my previous report or is nobody interested in
inline tasks?

Inline tasks are a great feature of org-mode, very useful to include tasks
in all sorts of documents without interfering with the document structure.

I resend my report with now hopefully all information to reproduce it
quickly.

0. emacs -Q
1. Insert the below snippet into scratch buffer.
>>>
* Example
** heading 1
xxxxx
** heading 2
*************** TODO Test access with provided credentials
xxxxx
*************** END
** heading 3
*************** TODO State "high value" targets
xxxxx
*************** END
** heading 4
xxxxx

(org-mode)
(require 'org-inlinetask)
<<<

2. Execute each of the 2 elisp statements at the bottom (C-x C-e)
3. Cycle Example to show children
4. Cycle heading 2

This should show the issue: Parts of heading 3 are expanded too. This is
also true for the next to cycling steps. Then comes a correct full cycle
and the issue repeats.

This garbage shown from the next heading(s) can become huge in more complex
structures.

Org mode version 9.4.6 (9.4.6-gcf30f7

Please confirm the issue.

Regards,
Michael
AntwortenWeiterleiten
<https://drive.google.com/u/0/settings/storage?hl=de&utm_medium=web&utm_source=gmail&utm_campaign=storage_meter&utm_content=storage_normal>
<https://www.google.com/intl/de/policies/terms/>
<https://www.google.com/intl/de/policies/privacy/>
<https://www.google.com/gmail/about/policy/>

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

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

end of thread, other threads:[~2022-04-30  8:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01  3:26 Visibility cycling with inline tasks 2 No Wayman
2021-10-01  6:17 ` Ihor Radchenko
2021-10-01 14:44   ` No Wayman
2021-10-01 17:04   ` Timothy
2022-04-30  8:58     ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2021-09-29 14:48 Michael Dauer
2021-09-29 15:09 ` Ihor Radchenko
2021-09-29 18:38   ` Michael Dauer
2021-09-30  7:57     ` Ihor Radchenko

Code repositories for project(s) associated with this 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).