emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fixing endless loop of org-reveal with inline-task
@ 2024-06-07 15:07 Marc-Oliver Ihm
  2024-06-08 15:28 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Marc-Oliver Ihm @ 2024-06-07 15:07 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Hi all,

If I have this simple buffer:

* foo

*************** bar
*************** END

i.e. one node with a single inline node.
If now I place the cursor at the end of the buffer and invoke (org-reveal), I get stuck in an endless loop.
(of course one needs to (require 'org-inlinetask) before)

I think this can be fixed by patching org-goto-sibling as shown below (against HEAD). Could you please consider accepting this patch, as the problem hits me every few days.

Background: In my opinion the current behavior of org-goto-sibling is wrong if the cursor is at the end of the given example-buffer. In that case cursor gets placed at the start of the END-line and the return value is t. This contradicts the documentation, which states "Returns t
when a sibling was found.  When none is found, return nil and don’t
move point."
My patch corrects this, so that when invoking org-goto-sibling in this case, cursor is not moved and return value is nil.
I did not notice any negative effects with this patch in the past few weeks.

Thanx a lot
Marc Ihm

diff --git a/lisp/org.el b/lisp/org.el
index cf4c9a99e..c786f7719 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -21530,6 +21530,10 @@ move point."
       (when (org-element-type-p (org-element-at-point) 'inlinetask)
         (org-up-heading-safe))
       (setq level (funcall outline-level))
+      (when (org-inlinetask-at-task-p)
+        (if previous
+            (org-inlinetask-goto-beginning)
+          (org-inlinetask-goto-end)))
       (catch 'exit
        (or previous (forward-char 1))
        (while (funcall fun re nil t)


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

* Re: [PATCH] Fixing endless loop of org-reveal with inline-task
  2024-06-07 15:07 [PATCH] Fixing endless loop of org-reveal with inline-task Marc-Oliver Ihm
@ 2024-06-08 15:28 ` Ihor Radchenko
  2024-06-08 20:54   ` Marc Ihm
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-06-08 15:28 UTC (permalink / raw)
  To: Marc-Oliver Ihm; +Cc: emacs-orgmode@gnu.org

Marc-Oliver Ihm <marc@ihm.name> writes:

> Hi all,
>
> If I have this simple buffer:
>
> * foo
>
> *************** bar
> *************** END
>
> i.e. one node with a single inline node.
> If now I place the cursor at the end of the buffer and invoke (org-reveal), I get stuck in an endless loop.
> (of course one needs to (require 'org-inlinetask) before)
>
> I think this can be fixed by patching org-goto-sibling as shown below (against HEAD). Could you please consider accepting this patch, as the problem hits me every few days.

I am unable to reproduce using the latest Org 9.7.3.
May you please try with the same Org version and let me know if you can
see the endless loop?

-- 
Ihor Radchenko // yantar92,
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

* Re: [PATCH] Fixing endless loop of org-reveal with inline-task
  2024-06-08 15:28 ` Ihor Radchenko
@ 2024-06-08 20:54   ` Marc Ihm
  2024-06-09  8:23     ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Ihm @ 2024-06-08 20:54 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org

Yes, you are right !

With head there is no problem (probably forgot to adjust my load-path 
before ...)

Thanx for the help !

Rgards
Marc

Am 08.06.2024 um 17:28 schrieb Ihor Radchenko:

> Marc-Oliver Ihm <marc@ihm.name> writes:
>
>> Hi all,
>>
>> If I have this simple buffer:
>>
>> * foo
>>
>> *************** bar
>> *************** END
>>
>> i.e. one node with a single inline node.
>> If now I place the cursor at the end of the buffer and invoke (org-reveal), I get stuck in an endless loop.o
>> (of course one needs to (require 'org-inlinetask) before)
>>
>> I think this can be fixed by patching org-goto-sibling as shown below (against HEAD). Could you please consider accepting this patch, as the problem hits me every few days.
> I am unable to reproduce using the latest Org 9.7.3.
> May you please try with the same Org version and let me know if you can
> see the endless loop?
>


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

* Re: [PATCH] Fixing endless loop of org-reveal with inline-task
  2024-06-08 20:54   ` Marc Ihm
@ 2024-06-09  8:23     ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-06-09  8:23 UTC (permalink / raw)
  To: Marc Ihm; +Cc: emacs-orgmode@gnu.org

Marc Ihm <marc@ihm.name> writes:

> With head there is no problem (probably forgot to adjust my load-path 
> before ...)

Thanks for the update!
Canceled. (patch)

-- 
Ihor Radchenko // yantar92,
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

end of thread, other threads:[~2024-06-09  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-07 15:07 [PATCH] Fixing endless loop of org-reveal with inline-task Marc-Oliver Ihm
2024-06-08 15:28 ` Ihor Radchenko
2024-06-08 20:54   ` Marc Ihm
2024-06-09  8:23     ` 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).