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

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).