all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Marc-Oliver Ihm <marc@ihm.name>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: [PATCH] Fixing endless loop of org-reveal with inline-task
Date: Fri, 7 Jun 2024 17:07:41 +0200 (CEST)	[thread overview]
Message-ID: <677194399.53008.1717772861672@ud-mail.de> (raw)

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	other threads:[~2024-06-08  0:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 15:07 Marc-Oliver Ihm [this message]
2024-06-08 15:28 ` [PATCH] Fixing endless loop of org-reveal with inline-task Ihor Radchenko
2024-06-08 20:54   ` Marc Ihm
2024-06-09  8:23     ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=677194399.53008.1717772861672@ud-mail.de \
    --to=marc@ihm.name \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.