* [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks @ 2022-08-18 8:58 Anders Johansson 2022-08-18 10:00 ` [BUG] Fix for inlinetask visibility cycling causes infinite loop for Anders Johansson 2022-08-19 6:28 ` [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks Ihor Radchenko 0 siblings, 2 replies; 4+ messages in thread From: Anders Johansson @ 2022-08-18 8:58 UTC (permalink / raw) To: org-mode-email [-- Attachment #1: Type: text/plain, Size: 1115 bytes --] Hi, I use "degenerate" inlinetasks (without an "*** END" line) quite a lot (for example for "coding" snippets in my orgqda package https://git.sr.ht/~andersjohansson/orgqda/). Degenerate inlinetasks are stated as allowed in the documentation at the beginning of org-inlinetask.el, but are maybe not so common since org-inlinetask-insert-task always inserts the END-line. Since April, an infinite loop is caused when cycling an entry containing degenerate inlinetasks by commit: 5f184b org-inlinetask.el: Fix visibility cycling for inlinetasks Sample for reproducing: ----- * Heading *************** Degenerate inlinetask ----- Cycling "Heading" will call org-inlinetask-hide-tasks where the last calls in the loop of `inlinetask-goto-end` takes us to the line below the inlinetask, but `backward-char` takes us back to the point at the end of the inlinetask, so `inlinetask-at-task-p` is still t and the loop continues infinitely in this fashion. I don’t have a good suggestion for a solution that would still solve the problem addressed in that commit. Best, Anders Johansson [-- Attachment #2: Type: text/html, Size: 1438 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [BUG] Fix for inlinetask visibility cycling causes infinite loop for 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 2022-08-19 6:28 ` [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks Ihor Radchenko 1 sibling, 0 replies; 4+ messages in thread From: Anders Johansson @ 2022-08-18 10:00 UTC (permalink / raw) To: mejlaandersj; +Cc: emacs-orgmode 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." ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks 2022-08-18 8:58 [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks Anders Johansson 2022-08-18 10:00 ` [BUG] Fix for inlinetask visibility cycling causes infinite loop for Anders Johansson @ 2022-08-19 6:28 ` Ihor Radchenko [not found] ` <CAKJdtO8Nhy1VVORRo0+piTgMC1Oxj2do80U+tuVdDep79GEX5Q@mail.gmail.com> 1 sibling, 1 reply; 4+ messages in thread From: Ihor Radchenko @ 2022-08-19 6:28 UTC (permalink / raw) To: Anders Johansson; +Cc: org-mode-email Anders Johansson <mejlaandersj@gmail.com> writes: > Since April, an infinite loop is caused when cycling an entry containing > degenerate inlinetasks by commit: > 5f184b org-inlinetask.el: Fix visibility cycling for inlinetasks > > Sample for reproducing: > ----- > * Heading > *************** Degenerate inlinetask > ----- I am unable to reproduce on main and on bugfix. What is your Org version (M-x org-version)? -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92 ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAKJdtO8Nhy1VVORRo0+piTgMC1Oxj2do80U+tuVdDep79GEX5Q@mail.gmail.com>]
* Re: [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks [not found] ` <CAKJdtO8Nhy1VVORRo0+piTgMC1Oxj2do80U+tuVdDep79GEX5Q@mail.gmail.com> @ 2022-08-20 6:54 ` Ihor Radchenko 0 siblings, 0 replies; 4+ messages in thread From: Ihor Radchenko @ 2022-08-20 6:54 UTC (permalink / raw) To: Anders Johansson; +Cc: emacs-orgmode Anders Johansson <mejlaandersj@gmail.com> writes: >> I am unable to reproduce on main and on bugfix. >> What is your Org version (M-x org-version)? > > Sorry I didn’t bother to reproduce with emacs -Q. I stepped through with > edebug and thought the problem was quite clear that way. I have reproduced > with Emacs -q (+ loading org from git) now and the problem persists on my > side, using a sample file consisting of just a heading with one degenerate > inlinetask below, as posted before: Thanks for checking again! I forgot to load org-inlinetask when checking, which is why I did not observe the problem. Fixed on main now via a0b8b7303. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=a0b8b7303b9683fae4503c57ee8ae191cb89a297 Best, Ihor ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-20 6:54 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-08-18 8:58 [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks Anders Johansson 2022-08-18 10:00 ` [BUG] Fix for inlinetask visibility cycling causes infinite loop for Anders Johansson 2022-08-19 6:28 ` [BUG] Fix for inlinetask visibility cycling causes infinite loop for "degenerate" inlinetasks Ihor Radchenko [not found] ` <CAKJdtO8Nhy1VVORRo0+piTgMC1Oxj2do80U+tuVdDep79GEX5Q@mail.gmail.com> 2022-08-20 6:54 ` 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).