emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [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/)]
@ 2022-10-21 22:28 Gregor Zattler
  2022-10-22  7:43 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Gregor Zattler @ 2022-10-21 22:28 UTC (permalink / raw)
  To: emacs-orgmode, hyperbole-users


Dear org-mode and hyperbole developers, hitting hyperbole's
action-key with point in "~/src/org-mode/contrilb/lisp" in a
*Pp Eval Output* buffer holding my complete load-path
resulted in this org-element--cache warning:

 ■  Warning (org-element-cache): org-element--cache: Org parser error in *Pp Eval Output*::5288. Resetting.
 The error was: (error "rx ‘**’ range error")
 Backtrace:
"  backtrace-to-string(nil)
  org-element-at-point()
  org-element-context()
  hsys-org-link-at-p()
  ibtypes::org-link-outside-org-mode()
  ibut:at-p()
  hbut:at-p()
  eval((hbut:at-p))
  hkey-execute(nil)
  action-key-internal()
  action-key()
  funcall-interactively(action-key)
  call-interactively(action-key nil nil)
  command-execute(action-key)
"
 Please report this to Org mode mailing list (M-x org-submit-bug-report).

I wanted to know if this directory exists (it doesn't) and
thought it was easiest to use action-key in order to visit
it.


I assume hyperbole wrongly assumed that this was an org-mode
buffer and did something wrong with org-element, but I'm
only guessing, since this is way above my elisp foo.

I hope this somehow helps.

Emacs  : GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, cairo version 1.16.0)
 of 2022-10-19
Package: Org mode version 9.6-pre (release_9.5.5-997-ge58bd0 @ /home/grfz/src/org-mode/lisp/)

and hyperbole 8.0.0.

Ciao,
-- 
Gregor


^ permalink raw reply	[flat|nested] 4+ messages in thread

* 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/)]
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2022-10-22  7:43 UTC (permalink / raw)
  To: Gregor Zattler; +Cc: emacs-orgmode, hyperbole-users

Gregor Zattler <grfz@gmx.de> writes:

> Dear org-mode and hyperbole developers, hitting hyperbole's
> action-key with point in "~/src/org-mode/contrilb/lisp" in a
> *Pp Eval Output* buffer holding my complete load-path
> resulted in this org-element--cache warning:
>
>  ■  Warning (org-element-cache): org-element--cache: Org parser error in *Pp Eval Output*::5288. Resetting.
>  The error was: (error "rx ‘**’ range error")
>  Backtrace:
> "  backtrace-to-string(nil)
>   org-element-at-point()
>   org-element-context()
>   hsys-org-link-at-p()

This is a hyperbole bug.
The latest version of Org no longer supports calling
org-element-at-point in non-Org buffers. Previously it worked by
accident and did not throw an error.

I recommend using regexp constants from Org to match against org-like
constructs outside Org mode buffers.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* 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/)]
  2022-10-22  7:43 ` Ihor Radchenko
@ 2022-12-11 18:13   ` Robert Weiner
  2022-12-12 11:47     ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Weiner @ 2022-12-11 18:13 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Gregor Zattler, emacs-orgmode, hyperbole-users

[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]

Hi Ihor:

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

Thanks,

Bob

On Sat, Oct 22, 2022 at 3:53 AM Ihor Radchenko <yantar92@posteo.net> wrote:

> Gregor Zattler <grfz@gmx.de> writes:
>
> > Dear org-mode and hyperbole developers, hitting hyperbole's
> > action-key with point in "~/src/org-mode/contrilb/lisp" in a
> > *Pp Eval Output* buffer holding my complete load-path
> > resulted in this org-element--cache warning:
> >
> >  ■  Warning (org-element-cache): org-element--cache: Org parser error in
> *Pp Eval Output*::5288. Resetting.
> >  The error was: (error "rx ‘**’ range error")
> >  Backtrace:
> > "  backtrace-to-string(nil)
> >   org-element-at-point()
> >   org-element-context()
> >   hsys-org-link-at-p()
>
> This is a hyperbole bug.
> The latest version of Org no longer supports calling
> org-element-at-point in non-Org buffers. Previously it worked by
> accident and did not throw an error.
>
> I recommend using regexp constants from Org to match against org-like
> constructs outside Org mode buffers.
>
> --
> 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>
>
>

[-- Attachment #2: Type: text/html, Size: 3486 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* 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/)]
  2022-12-11 18:13   ` Robert Weiner
@ 2022-12-12 11:47     ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2022-12-12 11:47 UTC (permalink / raw)
  To: rswgnu; +Cc: Gregor Zattler, emacs-orgmode, hyperbole-users

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>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-12 11:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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

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