emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fixing endless loop of org-reveal with inline-task


From: Marc-Oliver Ihm
Subject: [PATCH] Fixing endless loop of org-reveal with inline-task
Date: Fri, 7 Jun 2024 17:07:41 +0200 (CEST)

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]