* [BUG] inline src blocks in caption of not-inline src blocks do not execute
@ 2023-08-14 7:50 Tom Gillespie
2023-08-14 8:01 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Tom Gillespie @ 2023-08-14 7:50 UTC (permalink / raw)
To: emacs-orgmode
I've found a bug where inline source blocks cannot be executed and
org-element cannot find/parse them if they are in #+captions: where
the caption is affiliated with a not-inline source block. Example
below. Best,
Tom
Issue present in:
Org mode version 9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)
GNU Emacs 29.1 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version
1.17.8) of 2023-08-0
This inline src block works with C-c C-c.
#+caption: src_elisp[:results drawer]{"All good!"} {{{results(All good!)}}}
[[file:./images/happy-figure.png]]
This one fails to work with C-c C-c, and org-element-at-point returns
the bash src block below.
#+caption: src_elisp[:results drawer]{"I've made a horrible mistake"}
#+begin_src bash
echo OH NO
#+end_src
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-14 7:50 [BUG] inline src blocks in caption of not-inline src blocks do not execute Tom Gillespie
@ 2023-08-14 8:01 ` Ihor Radchenko
2023-08-14 8:59 ` Tom Gillespie
0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-08-14 8:01 UTC (permalink / raw)
To: Tom Gillespie; +Cc: emacs-orgmode
Tom Gillespie <tgbugs@gmail.com> writes:
> This one fails to work with C-c C-c, and org-element-at-point returns
> the bash src block below.
>
> #+caption: src_elisp[:results drawer]{"I've made a horrible mistake"}
> #+begin_src bash
> echo OH NO
> #+end_src
org-element-at-point is not supposed to return objects. So, there is no
problem here.
Also, C-c C-c works for me on bugfix in the above example.
--
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] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-14 8:01 ` Ihor Radchenko
@ 2023-08-14 8:59 ` Tom Gillespie
2023-08-16 3:31 ` Tom Gillespie
2023-08-16 8:09 ` Ihor Radchenko
0 siblings, 2 replies; 10+ messages in thread
From: Tom Gillespie @ 2023-08-14 8:59 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
> org-element-at-point is not supposed to return objects. So, there is no
> problem here.
Right. My original issue description is wrong for this part. It seems that
org-babel-get-src-block-info returns nil when immediately before the start
of the ala |src_ in #+caption: but will return non-nil in other contexts. In
the #+caption: it will only work if the cursor is past the s ala s|rc_. Or
if in non evil mode when the cursor is on the s in src_.
I can workaround the issue for now with forward-char, but it seems there
is an off-by-one error involving #+caption: followed immediately by src_,
if there is anything in between #+caption: and src_ then it works correctly.
> Also, C-c C-c works for me on bugfix in the above example.
Hrm, I can't get it to work, but I haven't done a proper control that
loads only bugfix and nothing else. Will report back if I get it to work.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-14 8:59 ` Tom Gillespie
@ 2023-08-16 3:31 ` Tom Gillespie
2023-08-16 8:09 ` Ihor Radchenko
1 sibling, 0 replies; 10+ messages in thread
From: Tom Gillespie @ 2023-08-16 3:31 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
I have tested this again against bugfix, the issue is still present
when the cursor is on the s in #+caption: src_. Best,
Tom
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-14 8:59 ` Tom Gillespie
2023-08-16 3:31 ` Tom Gillespie
@ 2023-08-16 8:09 ` Ihor Radchenko
2023-08-16 9:01 ` Tom Gillespie
1 sibling, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-08-16 8:09 UTC (permalink / raw)
To: Tom Gillespie; +Cc: emacs-orgmode
Tom Gillespie <tgbugs@gmail.com> writes:
>> org-element-at-point is not supposed to return objects. So, there is no
>> problem here.
>
> Right. My original issue description is wrong for this part. It seems that
> org-babel-get-src-block-info returns nil when immediately before the start
> of the ala |src_ in #+caption: but will return non-nil in other contexts. In
> the #+caption: it will only work if the cursor is past the s ala s|rc_. Or
> if in non evil mode when the cursor is on the s in src_.
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=54c09c84e
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9fd547dd3
--
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] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-16 8:09 ` Ihor Radchenko
@ 2023-08-16 9:01 ` Tom Gillespie
2023-08-16 9:22 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Tom Gillespie @ 2023-08-16 9:01 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Confirming fixed. Thanks!
PS A new issue arises however caused by
487f39efa68fa2d857f8d446d1c4b3a3b3e3f482,
which is that it is now confusing to get the {{{results(=value=)}}}
macro without verbatim which is what :results drawer meant in
that context. I expect that change will break things for a number
of people beyond myself. A bit of reading the code revealed that
setting :wrap t makes it possible to get {{{results(value)}}} again,
but line 2647 [1] seems to indicate that drawer is an expected
and valid value for inline :results.
1.
((or (member "drawer" result-params)
;; Stay backward compatible with <7.9.2
(member "wrap" result-params))
(goto-char beg) (when (org-at-table-p) (org-cycle))
(funcall wrap ":results:" ":end:" 'no-escape nil
"{{{results(" ")}}}"))
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-16 9:01 ` Tom Gillespie
@ 2023-08-16 9:22 ` Ihor Radchenko
2023-08-16 9:36 ` Tom Gillespie
0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-08-16 9:22 UTC (permalink / raw)
To: Tom Gillespie; +Cc: emacs-orgmode
Tom Gillespie <tgbugs@gmail.com> writes:
> PS A new issue arises however caused by
> 487f39efa68fa2d857f8d446d1c4b3a3b3e3f482,
> which is that it is now confusing to get the {{{results(=value=)}}}
> macro without verbatim which is what :results drawer meant in
> that context. I expect that change will break things for a number
> of people beyond myself. A bit of reading the code revealed that
> setting :wrap t makes it possible to get {{{results(value)}}} again,
> but line 2647 [1] seems to indicate that drawer is an expected
> and valid value for inline :results.
>
>
> 1.
> ((or (member "drawer" result-params)
> ;; Stay backward compatible with <7.9.2
> (member "wrap" result-params))
> (goto-char beg) (when (org-at-table-p) (org-cycle))
> (funcall wrap ":results:" ":end:" 'no-escape nil
> "{{{results(" ")}}}"))
It was a slip when the patch was applied.
See the table of :results params vs. expected output that Nicolas
provided in
https://list.orgmode.org/orgmode/87zjbqrapy.fsf@nicolasgoaziou.fr/
Or maybe I miss something.
May you please explain more about {{{results(=value=)}}} problem?
Isn't it sufficient to do src_elisp[:results verbatim]{'value} {{{results(=value=)}}}?
--
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] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-16 9:22 ` Ihor Radchenko
@ 2023-08-16 9:36 ` Tom Gillespie
2023-08-16 9:57 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Tom Gillespie @ 2023-08-16 9:36 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
> It was a slip when the patch was applied.
> See the table of :results params vs. expected output that Nicolas
> provided in
> https://list.orgmode.org/orgmode/87zjbqrapy.fsf@nicolasgoaziou.fr/
>
> Or maybe I miss something.
>
> May you please explain more about {{{results(=value=)}}} problem?
> Isn't it sufficient to do src_elisp[:results verbatim]{'value} {{{results(=value=)}}}?
The issue is the opposite I think. Currently the default value (i.e. absent)
for :results does not produce {{{results(value)}}} as suggested, and instead
producers {{{results(=value=)}}}. This means that without :results drawer
there isn't an obvious way to get {{{results(value)}}} because you can't e.g.
use [:results default], or if a user overrides the default value for
inline header
args at file level then they have no way to reset to the default.
It looks like there used to be an option [:results wrap] which was deprecated
a _very_ long time ago. [:results drawer] replaced that, and while there is
some confusion about the name (because there is no actual drawer in an
inline result) the behavior was meant to replace the old :results wrap behavior
where the name does make sense since {{{results(value)}}} do "wrap" the value.
I think that covers it, but let me know if something doesn't make sense. Best,
Tom
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-16 9:36 ` Tom Gillespie
@ 2023-08-16 9:57 ` Ihor Radchenko
2024-05-11 7:49 ` Ihor Radchenko
0 siblings, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-08-16 9:57 UTC (permalink / raw)
To: Tom Gillespie, Bastien; +Cc: emacs-orgmode
Tom Gillespie <tgbugs@gmail.com> writes:
>> It was a slip when the patch was applied.
>> May you please explain more about {{{results(=value=)}}} problem?
>> Isn't it sufficient to do src_elisp[:results verbatim]{'value} {{{results(=value=)}}}?
>
> The issue is the opposite I think. Currently the default value (i.e. absent)
> for :results does not produce {{{results(value)}}} as suggested, and instead
> producers {{{results(=value=)}}}. ...
>
> It looks like there used to be an option [:results wrap] which was deprecated
> a _very_ long time ago. [:results drawer] replaced that, and while there is
> some confusion about the name (because there is no actual drawer in an
> inline result) the behavior was meant to replace the old :results wrap behavior
> where the name does make sense since {{{results(value)}}} do "wrap" the value.
Thanks!
In addition, the docstring of `org-babel-insert-result' says
drawer -- results are added directly to the Org file as with
"raw", but are wrapped in a RESULTS drawer or results
macro, allowing them to later be replaced or removed
automatically.
But not in the manual:
‘drawer’
Result wrapped in a ‘RESULTS’ drawer. Useful for containing ‘raw’
or ‘org’ results for later scripting and automated processing.
Usage example: ‘:results value drawer’.
Also, removal of :results wrap seemingly missed the inline src block use
case: https://list.orgmode.org/orgmode/876271cjpb.fsf@bzg.ath.cx/
Bastien, may you comment?
:results drawer feels confusing for inline src blocks.
--
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] 10+ messages in thread
* Re: [BUG] inline src blocks in caption of not-inline src blocks do not execute
2023-08-16 9:57 ` Ihor Radchenko
@ 2024-05-11 7:49 ` Ihor Radchenko
0 siblings, 0 replies; 10+ messages in thread
From: Ihor Radchenko @ 2024-05-11 7:49 UTC (permalink / raw)
To: Tom Gillespie; +Cc: Bastien, emacs-orgmode
Ihor Radchenko <yantar92@posteo.net> writes:
>>> It was a slip when the patch was applied.
>>> May you please explain more about {{{results(=value=)}}} problem?
>>> Isn't it sufficient to do src_elisp[:results verbatim]{'value} {{{results(=value=)}}}?
>>
>> The issue is the opposite I think. Currently the default value (i.e. absent)
>> for :results does not produce {{{results(value)}}} as suggested, and instead
>> producers {{{results(=value=)}}}. ...
This is expected. The defaults for paragraph-level source blocks are the
same - to treat results as verbatim and quote them using fixed width
markup or example block.
> Thanks!
> In addition, the docstring of `org-babel-insert-result' says
>
> drawer -- results are added directly to the Org file as with
> "raw", but are wrapped in a RESULTS drawer or results
> macro, allowing them to later be replaced or removed
> automatically.
>
> But not in the manual:
>
> ‘drawer’
> Result wrapped in a ‘RESULTS’ drawer. Useful for containing ‘raw’
> or ‘org’ results for later scripting and automated processing.
> Usage example: ‘:results value drawer’.
For now, I updated the manual to reflect the reality.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4deb06ea0
:results drawer is still confusing for inline src blocks, but we have
what we have. I have no good ideas what can be done to improve the
situation.
Handled.
--
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] 10+ messages in thread
end of thread, other threads:[~2024-05-11 7:49 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-14 7:50 [BUG] inline src blocks in caption of not-inline src blocks do not execute Tom Gillespie
2023-08-14 8:01 ` Ihor Radchenko
2023-08-14 8:59 ` Tom Gillespie
2023-08-16 3:31 ` Tom Gillespie
2023-08-16 8:09 ` Ihor Radchenko
2023-08-16 9:01 ` Tom Gillespie
2023-08-16 9:22 ` Ihor Radchenko
2023-08-16 9:36 ` Tom Gillespie
2023-08-16 9:57 ` Ihor Radchenko
2024-05-11 7:49 ` Ihor Radchenko
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.