emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Rudolf Adamkovič" <rudolf@adamkovic.org>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ob-lua: Support all types and multiple values in results
Date: Tue, 23 Apr 2024 19:05:13 +0200	[thread overview]
Message-ID: <m2frvc103a.fsf@adamkovic.org> (raw)
In-Reply-To: <20240423164458.33702-1-rudolf@adamkovic.org>

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

> +Lua code blocks can now return values of any type and can also return
> +multiple values.  Previously, values of certain types were incorrectly
> +converted to the empty string =""=, which broke HTML export for inline
> +code blocks, and multiple values were incorrectly concatenated, where
> +~return 1, 2, 3~ was evaluated as =123=.

Also,

  #+BEGIN_SRC lua
  return {1, 2, 3}
  #+END_SRC

previously crashed, as did

  #+BEGIN_SRC lua
  function divide()
     error("oops")
     return divident / divisor
  end
  return pcall(oops)
  #+END_SRC

All that works now, with no more crashes.

P.S. #1

We still have an old bug where

  src_lua{return string.match("A {B} C", "%b{}")}

is misjudged to be a table:

  org-babel-insert-result: Inline error: list result cannot be used

P.S. #2

I did not update any session-related code.

Currently,

  #+BEGIN_SRC lua :session x
  print 1
  #+END_SRC

gives

  ... Sessions currently not supported, work in progress

This is also documented in the header

  ;; Requirements:
  ;; for session support, lua-mode is needed.
  ;; [...]
  ;; However, sessions are not yet working.

This half-finished session support should be removed, IMHO.

If someone needs it and are willing to finish it, they can still dig it
up it in the history.  That is what VC is for, after all.

As of now, all that session-related dead code only pollutes the file,
making it harder to change, as it drifts out of sync...

Rudy
-- 
"All you have to do is write one true sentence.  Write the truest
sentence that you know."  --- Ernest Miller Hemingway (1899-1961)

Rudolf Adamkovič <rudolf@adamkovic.org> [he/him]
Studenohorská 25, 84103 Bratislava, Slovakia, European Union


  reply	other threads:[~2024-04-23 17:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 16:44 [PATCH] ob-lua: Support all types and multiple values in results Rudolf Adamkovič
2024-04-23 17:05 ` Rudolf Adamkovič [this message]
2024-04-24 14:20   ` Ihor Radchenko
2024-04-24 13:05 ` Ihor Radchenko
2024-04-24 15:01   ` Rudolf Adamkovič
2024-04-26 13:40     ` Ihor Radchenko
2024-04-27 10:57       ` Max Nikulin
2024-04-27 16:33       ` Rudolf Adamkovič
2024-04-28 12:36         ` Ihor Radchenko
2024-04-29 15:57           ` Rudolf Adamkovič
2024-04-29 20:26             ` Rudolf Adamkovič
2024-04-30 10:24               ` Ihor Radchenko
2024-05-02 15:57                 ` Rudolf Adamkovič
2024-05-02 15:58                 ` Rudolf Adamkovič
2024-05-02 16:02                   ` Rudolf Adamkovič
2024-05-01 11:05               ` Max Nikulin
2024-05-02 16:00                 ` Rudolf Adamkovič
2024-05-02 16:41                   ` Ihor Radchenko

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2frvc103a.fsf@adamkovic.org \
    --to=rudolf@adamkovic.org \
    --cc=emacs-orgmode@gnu.org \
    /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 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).