emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Incorrect link is stored (org-elements?)
Date: Thu, 11 Nov 2021 21:45:57 +0700	[thread overview]
Message-ID: <smjab6$ubb$1@ciao.gmane.io> (raw)
In-Reply-To: <87zgqcktob.fsf@localhost>

On 10/11/2021 20:48, Ihor Radchenko wrote:
> 
> I pushed the patch upstream.
> 
>> P.S. I am puzzled that `org-element-at-point' returns paragraph even
>> when patch is not applied. After such call `org-store-link' does what I
>> expect. However "after undo" erroneous state survives emacs restart,
>> thanks to org-persist, I believe.
> 
> The bug was in very specific case. org-element-at-point now has a
> special fast mode of operation when CACHED-ONLY argument is non-nil. In
> this mode, it does not try to parse anything, but only checks the
> nearest cached element and returns it if point is at the element
> beginning, within +begin/end line of the element, or inside a
> non-greater element. The error happened when the cached element was a
> section and point was within blank lines at the end of the section
> exactly one symbol before the following headline. In such cases,
> org-element-at-point must follow some special rules (see comments in
> org-element--parse-to), but it did not in this specific scenario.
> On top of that, org-element-parse-to cannot return section and the
> current code assumes that we ever attempt to return section when point
> is at the beginning of section. So, it returns
> (org-element-at-point (1+ pos)) instead. Hence, the next headline
> was wrongly returned when (1) point is 1- beginning of next headline
> (2) we are within blank lines at the end of section (3) some edit in
> buffer just cleared everything in cache inside current section
> (4) org-element-at-point is called with non-nil CACHED-ONLY argument.

Thank you for the fix and for the detailed explanation, Ihor. I was 
naively suspecting some weird issue with undo, maybe similar to the one 
found with interference of tables and non-latin input methods.




      reply	other threads:[~2021-11-11 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 17:01 Incorrect link is stored (org-elements?) Max Nikulin
2021-11-09 11:46 ` Ihor Radchenko
2021-11-10 12:52   ` Max Nikulin
2021-11-10 13:48     ` Ihor Radchenko
2021-11-11 14:45       ` Max Nikulin [this message]

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to='smjab6$ubb$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --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 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).