From: Ihor Radchenko <yantar92@posteo.net>
To: rswgnu@gmail.com
Cc: Gregor Zattler <grfz@gmx.de>,
emacs-orgmode@gnu.org, hyperbole-users@gnu.org
Subject: Re: [BUG] hyperbole action key on path name results in org-element-cache warning [9.6-pre (release_9.5.5-997-ge58bd0 @ /home/grfz/src/org-mode/lisp/)]
Date: Mon, 12 Dec 2022 11:47:37 +0000 [thread overview]
Message-ID: <87sfhkhmhy.fsf@localhost> (raw)
In-Reply-To: <CA+OMD9jO6f=NRJ3eoX8y+50ymipGKuN+iT=0iaqts+Oe4SEf1Q@mail.gmail.com>
Robert Weiner <rsw@gnu.org> writes:
> So if we want to determine the Org type of an element outside of an Org
> buffer (when using org-type minor modes for example), how would we change
> this 'let' code:
>
> (let* ((context
> ;; Only consider supported types, even if they are not
> ;; the closest one.
> (org-element-lineage
> ;; Next line can trigger an error when `looking-at' is called
> ;; with a `nil' value of `org-complex-heading-regexp'.
> (org-element-context)
> '(clock footnote-definition footnote-reference headline
> inlinetask link timestamp)
> t))
> (type (org-element-type context))
> ...)
Strictly speaking, thing at point outside Org buffers is ambiguous
because Org syntax is recursive, and we often need to parse buffer from
the very beginning to determine what is at point. One needs to load
org-mode on text in buffer to know for sure.
So, one way to address the issue may be creating an indirect buffer,
switching it to Org mode and calling `org-element-context'. Or you can
use `org-export-copy-buffer'.
The performance may be affected though.
Also, you may get unexpected result when trying to match Org object in
non-Org buffer when some other text there looks like Org.
If necessary, we may also define generic versions of predicates, similar
to what is done in `org-at-table-p': When in Org mode, use accurate
parser data, but fallback to regexp matching otherwise.
Then, we can also modify `org-context' to be generic.
If you want the latter, you can help us by searching all the predicate
functions to be converted in Org codebase. Then, I can extract them into
a separate library org-context.el.
--
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>
prev parent reply other threads:[~2022-12-12 11:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-21 22:28 [BUG] hyperbole action key on path name results in org-element-cache warning [9.6-pre (release_9.5.5-997-ge58bd0 @ /home/grfz/src/org-mode/lisp/)] Gregor Zattler
2022-10-22 7:43 ` Ihor Radchenko
2022-12-11 18:13 ` Robert Weiner
2022-12-12 11:47 ` Ihor Radchenko [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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sfhkhmhy.fsf@localhost \
--to=yantar92@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=grfz@gmx.de \
--cc=hyperbole-users@gnu.org \
--cc=rswgnu@gmail.com \
/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.