emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: No Wayman <iarchivedmywholelife@gmail.com>
Cc: emacs-orgmode@gnu.org, mick.dauer@gmail.com
Subject: Re: Visibility cycling with inline tasks 2
Date: Fri, 01 Oct 2021 14:17:28 +0800	[thread overview]
Message-ID: <8735ple0av.fsf@localhost> (raw)
In-Reply-To: <874ka1ifhs.fsf@gmail.com>

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


  reply	other threads:[~2021-10-01  6:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01  3:26 Visibility cycling with inline tasks 2 No Wayman
2021-10-01  6:17 ` Ihor Radchenko [this message]
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

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=8735ple0av.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=iarchivedmywholelife@gmail.com \
    --cc=mick.dauer@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).