emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to put a string produced by an Elisp form in an Org source block in the Org file?
@ 2023-08-04  7:58 Marcin Borkowski
  2023-08-04  8:03 ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Marcin Borkowski @ 2023-08-04  7:58 UTC (permalink / raw)
  To: Org-Mode mailing list

Hi Orgers,

I have an Elisp form in an Org source block, returning a (multi-line)
string.  I'd like to put that string into the same Org buffer.  I tried
`:results raw', but the string contains `|' characters, so Org treats
its as a table and tries to format it as such, which is not what I want.

How to do that?

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to put a string produced by an Elisp form in an Org source block in the Org file?
  2023-08-04  7:58 How to put a string produced by an Elisp form in an Org source block in the Org file? Marcin Borkowski
@ 2023-08-04  8:03 ` Ihor Radchenko
  2023-08-04 20:20   ` Marcin Borkowski
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2023-08-04  8:03 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

> I have an Elisp form in an Org source block, returning a (multi-line)
> string.  I'd like to put that string into the same Org buffer.  I tried
> `:results raw', but the string contains `|' characters, so Org treats
> its as a table and tries to format it as such, which is not what I want.
>
> How to do that?

Maybe :wrap 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] 8+ messages in thread

* Re: How to put a string produced by an Elisp form in an Org source block in the Org file?
  2023-08-04  8:03 ` Ihor Radchenko
@ 2023-08-04 20:20   ` Marcin Borkowski
  2023-08-05  9:17     ` Marcin Borkowski
  2023-08-05  9:49     ` Ihor Radchenko
  0 siblings, 2 replies; 8+ messages in thread
From: Marcin Borkowski @ 2023-08-04 20:20 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode mailing list


On 2023-08-04, at 10:03, Ihor Radchenko <yantar92@posteo.net> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> I have an Elisp form in an Org source block, returning a (multi-line)
>> string.  I'd like to put that string into the same Org buffer.  I tried
>> `:results raw', but the string contains `|' characters, so Org treats
>> its as a table and tries to format it as such, which is not what I want.
>>
>> How to do that?
>
> Maybe :wrap example?

Thanks a lot, that works!  (Apart from the issue with lines beginning
with a star, possibly preceded by whitespace, which are "escaped" with
a comma - but that is a known thing in Org, and I can easily circumvent
it.)

BTW, that means that my blog post for this weekend (about plotting
charts from Org tables, all within Org mode and using ASCII art) is
basically almost ready!

Best,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to put a string produced by an Elisp form in an Org source block in the Org file?
  2023-08-04 20:20   ` Marcin Borkowski
@ 2023-08-05  9:17     ` Marcin Borkowski
  2023-08-08 13:23       ` Ihor Radchenko
  2023-08-05  9:49     ` Ihor Radchenko
  1 sibling, 1 reply; 8+ messages in thread
From: Marcin Borkowski @ 2023-08-05  9:17 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode mailing list


On 2023-08-04, at 22:20, Marcin Borkowski <mbork@mbork.pl> wrote:

> On 2023-08-04, at 10:03, Ihor Radchenko <yantar92@posteo.net> wrote:
>
>> Marcin Borkowski <mbork@mbork.pl> writes:
>>
>>> I have an Elisp form in an Org source block, returning a (multi-line)
>>> string.  I'd like to put that string into the same Org buffer.  I tried
>>> `:results raw', but the string contains `|' characters, so Org treats
>>> its as a table and tries to format it as such, which is not what I want.
>>>
>>> How to do that?
>>
>> Maybe :wrap example?
>
> Thanks a lot, that works!  (Apart from the issue with lines beginning
> with a star, possibly preceded by whitespace, which are "escaped" with
> a comma - but that is a known thing in Org, and I can easily circumvent
> it.)
>
> BTW, that means that my blog post for this weekend (about plotting
> charts from Org tables, all within Org mode and using ASCII art) is
> basically almost ready!

And here it is:
https://mbork.pl/2023-08-05_Plotting_ASCII_art_charts_from_Org_mode_tables

Thanks again!

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to put a string produced by an Elisp form in an Org source block in the Org file?
  2023-08-04 20:20   ` Marcin Borkowski
  2023-08-05  9:17     ` Marcin Borkowski
@ 2023-08-05  9:49     ` Ihor Radchenko
  2023-08-06  5:53       ` Marcin Borkowski
  1 sibling, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2023-08-05  9:49 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

> Thanks a lot, that works!  (Apart from the issue with lines beginning
> with a star, possibly preceded by whitespace, which are "escaped" with
> a comma - but that is a known thing in Org, and I can easily circumvent
> it.)

May you elaborate why you consider this a bug?

-- 
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] 8+ messages in thread

* Re: How to put a string produced by an Elisp form in an Org source block in the Org file?
  2023-08-05  9:49     ` Ihor Radchenko
@ 2023-08-06  5:53       ` Marcin Borkowski
  2023-08-06  8:50         ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Marcin Borkowski @ 2023-08-06  5:53 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org-Mode mailing list


On 2023-08-05, at 11:49, Ihor Radchenko <yantar92@posteo.net> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> Thanks a lot, that works!  (Apart from the issue with lines beginning
>> with a star, possibly preceded by whitespace, which are "escaped" with
>> a comma - but that is a known thing in Org, and I can easily circumvent
>> it.)
>
> May you elaborate why you consider this a bug?

I wouldn't call it a bug per se.  If my chart looks like this:

|
*
|*
| *
+--*-

it is displayed in Org example block as

|
,*
|*
| *
+--*-

If I change the character to `#' (which does not have a special meaning
to Org like the asterisk), I get the correct

|
#
|#
| #
+--#-

Sorry for the misunderstanding.  I'm not sure how to word it better,
though...

Best,

-- 
Marcin Borkowski
http://mbork.pl


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

* Re: How to put a string produced by an Elisp form in an Org source block in the Org file?
  2023-08-06  5:53       ` Marcin Borkowski
@ 2023-08-06  8:50         ` Ihor Radchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2023-08-06  8:50 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

>> May you elaborate why you consider this a bug?
>
> I wouldn't call it a bug per se.  If my chart looks like this:
>
> |
> *
> |*
> | *
> +--*-
>
> it is displayed in Org example block as
>
> |
> ,*
> |*
> | *
> +--*-

Is there any problem with the default results handling? By default, Org
uses fixed-width like

: |
: *
: |*
: | *
: +--*-

Except very long outputs. But see `org-babel-min-lines-for-block-output'.

-- 
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] 8+ messages in thread

* Re: How to put a string produced by an Elisp form in an Org source block in the Org file?
  2023-08-05  9:17     ` Marcin Borkowski
@ 2023-08-08 13:23       ` Ihor Radchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Ihor Radchenko @ 2023-08-08 13:23 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Org-Mode mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

> And here it is:
> https://mbork.pl/2023-08-05_Plotting_ASCII_art_charts_from_Org_mode_tables

There is also
(org-babel-ref-resolve "weight-data[-60:-1]")

-- 
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] 8+ messages in thread

end of thread, other threads:[~2023-08-08 13:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-04  7:58 How to put a string produced by an Elisp form in an Org source block in the Org file? Marcin Borkowski
2023-08-04  8:03 ` Ihor Radchenko
2023-08-04 20:20   ` Marcin Borkowski
2023-08-05  9:17     ` Marcin Borkowski
2023-08-08 13:23       ` Ihor Radchenko
2023-08-05  9:49     ` Ihor Radchenko
2023-08-06  5:53       ` Marcin Borkowski
2023-08-06  8:50         ` 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).