emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is raw output from Common Lisp and Scheme broken?


From: Ihor Radchenko
Subject: Re: Is raw output from Common Lisp and Scheme broken?
Date: Sat, 10 Aug 2024 14:19:37 +0000

Rudolf Adamkovič <rudolf@adamkovic.org> writes:

> I would like to output
>
>   raw Org/LaTeX from Common Lisp and Scheme
>
> but it does not seem to work:
>
> EMACS LISP - ALL OK:
> ...
> LUA - ALL OK:
> ...
> COMMON LISP - *NOT* OK:
>
> (1) DOUBLE BACKSLASHES

You can "print" it to format to make things work.

Currently, ob-lisp simply does (org-strip-quotes result) in contrast to

(if (or (member "scalar" result-params)
                (member "verbatim" result-params))
            (format "%S" result)
          (format "%s" result))

in ob-emacs-lisp.

However, I am not sure if Elisp version of `format' can correctly
unquote Lisp strings.

> (2) RESULTS GROW

That's expected for raw output - Org is unable to know the result
boundaries in such scenario.

> SCHEME - *NOT* OK:
>
> (1) SUPERFLUOUS QUOTES
> (2) DOUBLE BACKSLASHES
> (3) RESULTS GROW
>
>   #+BEGIN_SRC scheme :results raw
>   "\\begin{array}{cc|cc} 1 & 2 & 3 & 4\\end{array}"
>   #+END_SRC
>   
>   #+RESULTS:
>   "\\begin{array}{cc|cc} 1 & 2 & 3 & 4\\end{array}"

This is technically the actual value returned by scheme, but we indeed
do format the returned strings for Lua and Elisp.

You can try

#+begin_src scheme :results raw output
(display "\\begin{array}{cc|cc} 1 & 2 & 3 & 4\\end{array}")
#+end_src

#+RESULTS:
\begin{array}{cc|cc} 1 & 2 & 3 & 4\end{array}

> Is escaping and quoting broken for Common Lisp and Scheme, ...
>
> ... or am I using something incorrectly?

It is broken.
We should use Lisp/Scheme equivalents of `format' to solve the problem.
Something akin `org-babel-lua-wrapper-method'.
Patches welcome!

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]