emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Anders Johansson <mejlaandersj@gmail.com>
To: mejlaandersj@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] Fix for inlinetask visibility cycling causes infinite loop for
Date: Thu, 18 Aug 2022 12:00:16 +0200	[thread overview]
Message-ID: <20220818100016.47442-1-mejlaandersj@gmail.com> (raw)
In-Reply-To: <CAKJdtO8+bh4G-Mzhp7k1x9SGfjo9PxdmncdHcUJKCk6PbK9d=g@mail.gmail.com>

Something like this could work. Just ensuring that we haven’t ended back at the start of the current (degenerate) inlinetask. I don’t know if this would be the most elegant solution though. I also considered whether org-inlinetask-goto-end should really move to the point after the last line of an inlinetask (is this consistent with org-element BTW?), but that would require changes across a big part of org-inlinetask and probably complicate other things.



diff --git a/lisp/org-inlinetask.el b/lisp/org-inlinetask.el
index 07aa94f32..c28f5e7b4 100644
--- a/lisp/org-inlinetask.el
+++ b/lisp/org-inlinetask.el
@@ -334,12 +334,15 @@ (defun org-inlinetask-hide-tasks (state)
 	   (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)
-         (backward-char))))))
+       (let ((startpoint-at-bol -1))
+         (while
+	     (or (and (org-inlinetask-at-task-p)
+                      (not (eq startpoint-at-bol (point-at-bol))))
+	         (and (outline-next-heading) (org-inlinetask-at-task-p)))
+           (setq startpoint-at-bol (point-at-bol))
+	   (org-inlinetask-toggle-visibility)
+	   (org-inlinetask-goto-end)
+           (backward-char)))))))
 
 (defun org-inlinetask-remove-END-maybe ()
   "Remove an END line when present."


  reply	other threads:[~2022-08-18 10:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18  8:58 [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks Anders Johansson
2022-08-18 10:00 ` Anders Johansson [this message]
2022-08-19  6:28 ` Ihor Radchenko
     [not found]   ` <CAKJdtO8Nhy1VVORRo0+piTgMC1Oxj2do80U+tuVdDep79GEX5Q@mail.gmail.com>
2022-08-20  6:54     ` 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=20220818100016.47442-1-mejlaandersj@gmail.com \
    --to=mejlaandersj@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).