emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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
* 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 related	[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-09-29 14:48 Visibility cycling with inline tasks 2 Michael Dauer
2021-09-29 15:09 ` Ihor Radchenko
2021-09-29 18:38   ` Michael Dauer
2021-09-30  7:57     ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2021-10-01  3:26 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

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