From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id QFMlKee3m2O3DQEAbAwnHQ (envelope-from ) for ; Fri, 16 Dec 2022 01:12:23 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id GOFMKOe3m2Ov6AAAG6o9tA (envelope-from ) for ; Fri, 16 Dec 2022 01:12:23 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 394E5E81A for ; Fri, 16 Dec 2022 01:12:23 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5yK5-0006cQ-PA; Thu, 15 Dec 2022 19:11:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5yK4-0006cG-4L for emacs-orgmode@gnu.org; Thu, 15 Dec 2022 19:11:32 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5yK1-0003zv-TF for emacs-orgmode@gnu.org; Thu, 15 Dec 2022 19:11:31 -0500 Received: by mail-wr1-x436.google.com with SMTP id i7so984500wrv.8 for ; Thu, 15 Dec 2022 16:11:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=+pRRFFxwS+gFckBRz9EFlkVnvjtM8MHdrs5/1Nc2yMc=; b=ONdDXFdStuvqX2RhTcndoiR5mutRnAerxB57muccpbUCT/f0fAfr/TTPIm/HW0hUzo wMiKDV7Q5VurHILOukxeRy06sB91M0sCagBndpEHHW5MZR/KRaNnAxJAp06tMgQyR3Ug KJufQNsYR5Tv3fP9aJUBDJrxWLdil4egof73KE2xw0rTRnqw76bL/z62rzcQRcavgDHb 6Og1w7JA6Aa8XzWbSEzwQ90aS7SLvMLDVPnFvBQ5uygl7nXrdYmBZgctUGT1cqxZILxN mzr4JeTbKKolAIQLTwPDwk9ER1ZU0CotC2QFJ8d6SqyClvscvY8RlBYwSKt3tOjlI2vs lz+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+pRRFFxwS+gFckBRz9EFlkVnvjtM8MHdrs5/1Nc2yMc=; b=K4Iq6HXaqyRluB4IQPsLpblsZdlz2DZR4CHTz/IuA53o59AluTFKu64ZD+cIyG2d5r YtqPKP/icjpVjCzT8AefkH74dLd6C/kMJ9xrVOZJPFJRlU78gqpLEuvKhxoBm1MOyKrh 0xto3yNny+Y6JPMrTRoMDOQ8QNPXmQ+bzAw5gUeAStep0pf1rY0xrEzL8qjey8q8pc49 nE2kBLcMP9rmA/xPfldTij4Uq7py/nbpYxLUY5WNo+irrZZ4QK4D82pP9Phooo0Va9Yn /mD03b0J2WgQQ/ZbDC5/B+mrcoC9GioaIfFVVcCAIa1qJ5UN4n88ZWU6+ThwQddHXJN0 crTg== X-Gm-Message-State: ANoB5pmoExOf5adO4yn5tZ0PSoqJ3fEY1JYEIBw0PYlPKioyYA3Wy/Pl 4aj9t3Mk9h2ZkpU8hmPX6isT3QSgyfnWu3W0hyAo5auwDAM= X-Google-Smtp-Source: AA0mqf5GtAGEidEa6oQWCYucGsvpQDJgS4T6QoDAeYwx6nDgDt0ZAGq3aQXccR564h5VvdRn0BBHOZc6iCYwPsNqviE= X-Received: by 2002:adf:ee0f:0:b0:242:17c7:d98d with SMTP id y15-20020adfee0f000000b0024217c7d98dmr28530171wrn.87.1671149487578; Thu, 15 Dec 2022 16:11:27 -0800 (PST) MIME-Version: 1.0 From: dalanicolai Date: Fri, 16 Dec 2022 01:11:16 +0100 Message-ID: Subject: [FR] Add support for racket images in org-babel To: emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="00000000000092e80105efe6cf69" Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=dalanicolai@gmail.com; helo=mail-wr1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ONdDXFdS; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1671149543; a=rsa-sha256; cv=none; b=RdtOoHhzj6248cSAZpvRujRWiopIJYAnTvPzRRL+/KlVvSYDySNtpnpSPEt5AmP/p3H3B0 30n/CUk/uirsghcqSpDwjmhugaRy7JTeADiCrGpb/WxNmBBZ0OGjoP/9kp9ZqWxSDLV8nB TwwG9m/W3LlQtygo++p1Fgk+GfSg2FZMtOG8n0x6u+G0KB6ZiQBoshrj2cu/jcE37XrfV1 EMT+4cnVdI+oEBiSZME+BOE560Kady8GEfYCAUWCvY21z6hvCa7HLHYKhTj8MC6mUmUsHC thDJh2iNjEmCG+35o9KVjK6H7sBPDOYfSGB9DkCEDjVqliaudePAehX6U75NyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1671149543; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+pRRFFxwS+gFckBRz9EFlkVnvjtM8MHdrs5/1Nc2yMc=; b=hxijEKDhT/Kaiqg92MrxWgXer4GRpi9SOhwSlPP4cOHnzusfxWqL9ZT7vPKYwVXk1tzGcQ XnW9RBSMr7pmyYEyaoVOvcwXiClveaOUhuKAzTzHHZ6bgT72TMLbod5kRN/q3jwttKHxHq YmzqFtpR1Ts0zOh0P83PrXb2CMIEsDBsO2fI1Og4iA/3eALkyAkiD+S34XvUShv9UeUQGb phWTLwaaRguQr5yYjuv4GtqCcnhrPfC4Jv1ktSZcIDywQSrwmb+BqDg658MfX/5jEcGOS4 zS0BrBHcwCY09TX4Yy4s8Is5RAU5dBv7LFSaAED3xrc2eS+7nKGekRo0b0aLTg== X-Migadu-Spam-Score: -9.77 X-Spam-Score: -9.77 X-Migadu-Queue-Id: 394E5E81A Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ONdDXFdS; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com X-Migadu-Scanner: scn0.migadu.com X-TUID: lbCDzrH+knWw --00000000000092e80105efe6cf69 Content-Type: text/plain; charset="UTF-8" Hello, I am trying out racket which seems to provide a quite nice plotting package . Also, it is easy to install and configure, easy to learn. and it has great learning material. It looks like a great simple (compared to common-lisp or clojure) alternative to python (so far for the enthusiasm). I have not asked anywhere yet, but I do not know a 'standard org-mode' way to make org-mode show the plot images. Racket creates a temp image file and returns a string that includes the path to the file. The actual format of the string is: "\"#\"" I could create a patch for it, but I am not sure how to best implement it (in a clean way). Currently, I am simply using the following advice (while including in the header ':results file'): (with-eval-after-load 'ob-scheme > (defun ob-racket-advice (orig-fun &rest args) > (let ((result (print (apply orig-fun args)))) > (if (string-match "\"# (nth 1 (string-split result " " nil ">\"")) > result))) > > (advice-add 'org-babel-execute:scheme :around #'ob-racket-advice)) > however, it would be great if support could be added to ob-scheme itself. I would be happy to do it, but as mentioned before I don't think I know how to do it in the proper way. I would probably just add a condition around the 'result' in 'org-babel-execute:scheme' as follows: (org-babel-result-cond result-params > (if (and (eq impl 'racket) > (string-match "\"# (nth 1 (string-split result " " nil ">\"")) > result) > (org-babel-scheme--table-or-string table))))))) > Thank you! --00000000000092e80105efe6cf69 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I am trying out racket which seems to= provide a quite nice plotting package.
Also, it is easy to i= nstall and configure, easy to learn. and it has great learning material.
It looks like a great simple (compared to common-lisp or clojure) a= lternative to python
(so far for the enthusiasm).

<= /div>
I have not asked anywhere yet, but I do not know a 'standard = org-mode' way
to make org-mode show the plot images. Racket c= reates a temp image file and
returns a string that includes the p= ath to the file. The actual format of the string is:

"\"#<Image: /var/tmp/geiser-img-16711484841671148484684.png= >\""

I could create a patch for it, b= ut I am not sure how to best implement it (in a clean way).

<= /div>
Currently, I am simply using the following advice (while includin= g in the header ':results file'):

=C2=A0 (with-eval-after-load = 'ob-scheme
=C2=A0 =C2=A0 (defun ob-racket-advice (orig-fun &rest= args)
=C2=A0 =C2=A0 =C2=A0 (let ((result (print (apply orig-fun args)))= )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (string-match "\"#<Image:= " (print result))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (nth 1= (string-split result " " nil ">\""))
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 result)))

=C2=A0 =C2=A0 (advice-add = 9;org-babel-execute:scheme :around #'ob-racket-advice))

however, it would be great if support could be a= dded to ob-scheme itself.
I would be happy to do it, but as menti= oned before I don't think I know how
to do it in the proper w= ay. I would probably just add a condition around the
'result&= #39; in 'org-babel-execute:scheme' as follows:

=
=C2=A0 (org-babel-re= sult-cond result-params
=C2=A0 =C2=A0(if (and (eq impl 'racket)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(string-match "\"#<Image: " (print result)))
=C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (nth 1 (string-split resu= lt " " nil ">\""))
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 result)
=C2=A0 =C2=A0(org-babel-scheme--table= -or-string table)))))))

Thank you= !
--00000000000092e80105efe6cf69--