From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id kM2DCtsWt2X6hAAAe85BDQ:P1 (envelope-from ) for ; Mon, 29 Jan 2024 04:09:15 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id kM2DCtsWt2X6hAAAe85BDQ (envelope-from ) for ; Mon, 29 Jan 2024 04:09:15 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gTVXdV5y; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1706497755; a=rsa-sha256; cv=none; b=jwfonfeHkD4eEG+T6sdEFBAsXgFzaxFK1+/pc2A2DCe/7K6JIZkqsI11HhuKeVDLR9xh50 nFpeiOLYFe07ahd8zKBMTZd9VsbNe9L7Yzqr4un8/623suYyrIpLzDT5hwht5mYlb7q/QA tMHouDReuaGySyqONd1TUO9+npa2/z1sjwnRJ9pPXEBlwL6WrCD64IrLqu/Wl40Z3y5mPZ c4M94JjsCg4bm/0cjGYmMsYd9fxuPEoFZGM4LUfqZBBRRd7/fAdiWBvv5KaV26vYs7f7qg NiYWdKlfMYPHJX/eI/3rnyfYXK0bk3yCyddBjEPmQUwTo4B/VNrv9utlqQJ3vQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gTVXdV5y; dmarc=pass (policy=none) header.from=gmail.com; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1706497755; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=vQ7GJTODzKKVHQByOPsN7+1B0T7cj8WzrKgJ15zZQgo=; b=hXBB2EzyUEYViCRO5Y2lHAqLxwRNrN7RdZIPCSEymzUkxUfDdjUwddWBSJlpPpX0wsoXtS FnS0GkuV57TbEnjk/dz6Bn11zmRRlzveUJFLKgeOjrfSK0b5H+jbC9vcw+aj29kE4AQTJy CCPXJIjNYvM3C+3gZOd0DMUacOSwAkYguketJWVES9puRGqROh8rifoSHrXdtFm8RcE9K3 cwJCZqwKsvv+j7joWMG7TM2Zp13gr15qYo5dPq2+fzJCNyvlgajzbhhzN1n/r04ErsFgRX 3/Rhww7bjv5h72BRzT+rM1Ar9RJ9IACfb62JPNPQQ5AOKDnofCjhpRmDOEbwFw== 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 AFCF176E54 for ; Mon, 29 Jan 2024 04:09:14 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUI0d-0004QY-6A; Sun, 28 Jan 2024 22:08:31 -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 1rUI0b-0004ON-Ee for emacs-orgmode@gnu.org; Sun, 28 Jan 2024 22:08:29 -0500 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUI0Y-0003NZ-QM for emacs-orgmode@gnu.org; Sun, 28 Jan 2024 22:08:29 -0500 Received: by mail-qv1-xf2b.google.com with SMTP id 6a1803df08f44-686a92a8661so18839966d6.0 for ; Sun, 28 Jan 2024 19:08:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706497703; x=1707102503; darn=gnu.org; h=mime-version:user-agent:message-id:date:mail-followup-to:references :in-reply-to:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=vQ7GJTODzKKVHQByOPsN7+1B0T7cj8WzrKgJ15zZQgo=; b=gTVXdV5ydg61bALbW5XyVkwr9ULnCMJAnOCzzP5kynGByuEHsykM4vANLvqQsdHX0+ kmncyUL1pFO/wqb6etjuw1ZEeYgtucxd5B2z+SD77l0i1bTDonG9sGSneP/4mdFRz2J+ FzBQiN3TuXIxbVm6T8ugJSPfcdp8WKrp12nK2vrjpi1BBOrVLQ+C0pVbd43aEn+zBEGx 8dE+bYZD5jVVzegq8iiYiPmEiDPGFRANIjqtmpBJsHB22soiZWpffsuaxewYHLqb+0rr VzmtIf3vwTX7MkxZhtMNHjThwKfY1Iy4v0PQ5MkqFwYyJes3JxLySpx85WYJLDDXQeov 1CBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706497703; x=1707102503; h=mime-version:user-agent:message-id:date:mail-followup-to:references :in-reply-to:subject:to:from:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=vQ7GJTODzKKVHQByOPsN7+1B0T7cj8WzrKgJ15zZQgo=; b=AI/k7t9mGWJkhRSfST1xp7mScysiCevqJcLgHAiBCEn6MAZSmQ2fLjvNnkzlE6X6m8 dvvPD3GqAZQtXKIzOZTtG4mxLqTRjsFqZTCd/IGsx99hjaFPEKCEU5aBAksDZaa2+zCB DkbPUTPVl6GwfCtQiqwXyGzEVfsSQcfVN43nR5JRHBN11OVnpb/NO7dhhp6j0Yv1TdKz oOzh0A0oTZYVpsURjhPJOOihkzcvD2C5Ofb4Ix2b3tPO9pE3Ay2KsrZ2KP0eabgauKZM cv0qsym2pjOyaXuSJu27h5dPMP0omHusI3prFWaTyjcPBKVpr4j0QZTtpzqhi23et3he hjDg== X-Gm-Message-State: AOJu0Yyf3ZcGnZ/7KuOcd5oc72SA/+TcVp0rN88676xkMnNs01tptvYA l0uqgNV645enMIWmfzNXH9qFnwbctNhn8uc02W1/DabERhXLl2xhET81gngdMoc= X-Google-Smtp-Source: AGHT+IG/fKGw65q2Mvy1tijB2sBpOUVs6bJZwycz8AAnUpV2paPW9x+Sfr1CqegJI2JxbUG1ev9OaA== X-Received: by 2002:a05:6214:29c2:b0:68c:4d6f:5e5d with SMTP id gh2-20020a05621429c200b0068c4d6f5e5dmr1557164qvb.119.1706497703386; Sun, 28 Jan 2024 19:08:23 -0800 (PST) Received: from tekunen ([2601:547:1500:6340::f92c]) by smtp.gmail.com with ESMTPSA id pj2-20020a0562144b0200b0068c445b747bsm1536585qvb.59.2024.01.28.19.08.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 19:08:22 -0800 (PST) From: Hunter Jozwiak To: emacs-orgmode@gnu.org Subject: Re: Connecting to an Already Running Scheme REPL with org-babel In-Reply-To: <87v87dm613.fsf@localhost> (Ihor Radchenko's message of "Sun, 28 Jan 2024 22:45:12 +0000") References: <874jex3xxh.fsf@gmail.com> <87v87dm613.fsf@localhost> Mail-Followup-To: emacs-orgmode@gnu.org Date: Sun, 28 Jan 2024 22:08:21 -0500 Message-ID: <87r0i03kgq.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="====-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=2607:f8b0:4864:20::f2b; envelope-from=hunter.t.joz@gmail.com; helo=mail-qv1-xf2b.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, MPART_ALT_DIFF=0.79, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 X-Migadu-Scanner: mx10.migadu.com X-Spam-Score: -12.07 X-Migadu-Queue-Id: AFCF176E54 X-Migadu-Spam-Score: -12.07 X-TUID: a3TBx2QXQkj9 --====-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: multipart/alternative; boundary="==-=-=" --==-=-= Content-Type: text/plain --==-=-= Content-Type: multipart/alternative; boundary="===-=-=" --===-=-= Content-Type: text/plain Ihor Radchenko writes: > Hunter Jozwiak writes: > >> i am curious whether or not it is possible to connect Org babel to a remotely running scheme REPL, more >> specifically the Guile REPL that you get by running something like guix repl --listen=tcp:37146 > > ob-scheme does not have such feature. > Although, it might not be hard to implement. > > Check out `org-babel-scheme-get-repl' function. Now, it calls > (geiser impl) > You would need > (geiser-connect impl host port) > to connect to server. > > Of course, you'd also need to somehow get HOST and PORT values. For > example, passing them all the way down from the header argument plist > stored in PARAMS argument of `org-babel-execute:scheme' (-> > org-babel-scheme-execute-with-geiser -> org-babel-scheme-get-repl) > > Patches welcome! Hello, Here is a patch that provides this functionality. --===-=-= Content-Type: text/html

Ihor Radchenko <yantar92@posteo.net> writes:

Hunter Jozwiak <hunter.t.joz@gmail.com> writes:

i am curious whether or not it is possible to connect Org babel to a remotely running scheme REPL, more specifically the Guile REPL that you get by running something like guix repl –listen=tcp:37146

ob-scheme does not have such feature. Although, it might not be hard to implement.

Check out `org-babel-scheme-get-repl' function. Now, it calls (geiser impl) You would need (geiser-connect impl host port) to connect to server.

Of course, you'd also need to somehow get HOST and PORT values. For example, passing them all the way down from the header argument plist stored in PARAMS argument of `org-babel-execute:scheme' (-> org-babel-scheme-execute-with-geiser -> org-babel-scheme-get-repl)

Patches welcome!

Hello,

Here is a patch that provides this functionality.

--===-=-=-- --==-=-= Content-Type: text/html

<#multipart type=alternative> <#part type=text/plain> Ihor Radchenko <yantar92@posteo.net> writes:

Hunter Jozwiak <hunter.t.joz@gmail.com> writes:

i am curious whether or not it is possible to connect Org babel to a remotely running scheme REPL, more specifically the Guile REPL that you get by running something like guix repl –listen=tcp:37146

ob-scheme does not have such feature. Although, it might not be hard to implement.

Check out `org-babel-scheme-get-repl' function. Now, it calls (geiser impl) You would need (geiser-connect impl host port) to connect to server.

Of course, you'd also need to somehow get HOST and PORT values. For example, passing them all the way down from the header argument plist stored in PARAMS argument of `org-babel-execute:scheme' (-> org-babel-scheme-execute-with-geiser -> org-babel-scheme-get-repl)

Patches welcome!

Hello,

Here is a patch that provides this functionality.

<#part type=text/html> <p> Ihor Radchenko &lt;yantar92@posteo.net&gt; writes: </p>

<p> <blockquote class="gmailquote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>Hunter Jozwiak &lt;hunter.t.joz@gmail.com&gt; writes: </div> <div> <br /></div> <div><blockquote class="gmailquote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>i am curious whether or not it is possible to connect Org babel to a remotely running scheme REPL, more specifically the Guile REPL that you get by running something like guix repl &#x2013;listen=tcp:37146

</div></blockquote> </div> <div> <br /></div> <div>ob-scheme does not have such feature. Although, it might not be hard to implement. </div> <div> <br /></div> <div>Check out `org-babel-scheme-get-repl' function. Now, it calls (geiser impl) You would need (geiser-connect impl host port) to connect to server. </div> <div> <br /></div> <div>Of course, you'd also need to somehow get HOST and PORT values. For example, passing them all the way down from the header argument plist stored in PARAMS argument of `org-babel-execute:scheme' (-&gt; org-babel-scheme-execute-with-geiser -&gt; org-babel-scheme-get-repl) </div> <div> <br /></div> <div>Patches welcome!

</div></blockquote> </p>

<p> Hello, </p>

<p> Here is a patch that provides this functionality. </p> <#/multipart>

--==-=-=-- --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-mode-allow-ob-scheme-to-accept-a-remote-connecti.patch Content-Transfer-Encoding: quoted-printable Content-Description: Patch for ob-scheme to allow for remote connections. From=20f64f82b34a7ec6418687fb9b028dda7a80059811 Mon Sep 17 00:00:00 2001 From: Hunter Jozwiak Date: Sun, 28 Jan 2024 21:48:05 -0500 Subject: [PATCH] org-mode: allow ob-scheme to accept a remote connection. * lisp/org/ob-scheme.el (org-babel-scheme-get-repl): introduce two optional variables host and port. If there are not given, just run Geiser as before. In the case when both are given, connect to the remotely running Scheme process. * lisp/org/ob-scheme (org-babel-scheme-execute-with-geiser, org-babel-execute:scheme): take these optional arguments into account. =2D-- lisp/org/ob-scheme.el | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el index d13b975084c..c9779185903 100644 =2D-- a/lisp/org/ob-scheme.el +++ b/lisp/org/ob-scheme.el @@ -1,4 +1,4 @@ =2D;;; ob-scheme.el --- Babel Functions for Scheme -*- lexical-binding= : t; -*- +;; ob-scheme.el --- Babel Functions for Scheme -*- lexical-binding: t= ; -*- =20 ;; Copyright (C) 2010-2024 Free Software Foundation, Inc. =20 @@ -54,7 +54,7 @@ geiser-debug-show-debug-p (defvar geiser-debug-jump-to-debug-p) ; Defined in geiser-debug.el (defvar geiser-repl-use-other-window) ; Defined in geiser-repl.el (defvar geiser-repl-window-allow-split) ; Defined in geiser-repl.el =2D +(declare-function geiser-connect "ext:geiser-repl" (impl &optional host po= rt)) (declare-function run-geiser "ext:geiser-repl" (impl)) (declare-function geiser "ext:geiser-repl" (impl)) (declare-function geiser-mode "ext:geiser-mode" ()) @@ -116,13 +116,17 @@ org-babel-scheme-get-buffer-impl (with-current-buffer (set-buffer buffer) geiser-impl--implementation)) =20 =2D(defun org-babel-scheme-get-repl (impl name) =2D "Switch to a scheme REPL, creating it if it doesn't exist." +(defun org-babel-scheme-get-repl (impl name &optional host port) + "Switch to a scheme REPL, creating it if it doesn't exist. + +If the variables host and port are set, connect to the running Scheme REPL= ." (let ((buffer (org-babel-scheme-get-session-buffer name))) (or buffer (progn (if (fboundp 'geiser) =2D (geiser impl) + (if (and host port) + (geiser-connect impl host port) + (geiser impl)) ;; Obsolete since Geiser 0.26. (run-geiser impl)) (when name @@ -159,7 +163,7 @@ org-babel-scheme-capture-current-message ,@body (current-message)))) =20 =2D(defun org-babel-scheme-execute-with-geiser (code output impl repl) +(defun org-babel-scheme-execute-with-geiser (code output impl repl &optio= nal host port) "Execute code in specified REPL. If the REPL doesn't exist, create it using the given scheme implementation. @@ -175,7 +179,7 @@ org-babel-scheme-execute-with-geiser (let ((geiser-repl-window-allow-split nil) (geiser-repl-use-other-window nil)) (let ((repl-buffer (save-current-buffer =2D (org-babel-scheme-get-repl impl repl)))) + (org-babel-scheme-get-repl impl repl host port)))) (when (not (eq impl (org-babel-scheme-get-buffer-impl (current-buffer)))) (message "Implementation mismatch: %s (%s) %s (%s)" impl (symbolp imp= l) @@ -231,6 +235,8 @@ org-babel-execute:scheme geiser-scheme-implementation geiser-default-implementation (car geiser-active-implementations))) + (host (cdr (assq :host params))) + (port (cdr (assq :port params))) (session (org-babel-scheme-make-session-name source-buffer-name (cdr (assq :session params)) impl)) (full-body (org-babel-expand-body:scheme body params)) @@ -240,7 +246,7 @@ org-babel-execute:scheme full-body ; code (string=3D result-type "output") ; output? impl ; implementation =2D (and (not (string=3D session "none")) session)))) ; session + (and (not (string=3D session "none")) session) host port))) ; ses= sion (let ((table (org-babel-reassemble-table result =2D-=20 2.43.0 --=-=-=-- --====-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFLBAEBCAA1FiEE8JmX63p3mcKAxtRbc+osy8QJTuEFAmW3FqUXHGh1bnRlci50 LmpvekBnbWFpbC5jb20ACgkQc+osy8QJTuFwXwf/XycBUY5D1/+qW7CuzPCKA4Yt 7KKFI8SE7taHEeJTzV2qmsg/LsMNKCnMI70kBk7ajgK9aWvLWjLgEQQAkUwWovBi bqKtKX8AismHpFK3+6sEjLTcT70b5tZZ1nDxB6DAxbhmTW+/GhuWWge2CwfP0bzu UNNR5nFMWcs7UwvS6QtzgyqHZYslkKCwv7YZGmwGHbeeE3IY0NrqfEtqMee/6cfa EOLOYs8uiPqCjM8tFFOen3Z+6sq99jg9JxMnL3pAS8HI82+PvwXdXxcA19NTahRd yY0PrlpiOdr8VJ+zpJkNv1Ib014TbnTTyUxRmOdxvWpIIm506DFysSFzyNw4pg== =sJkE -----END PGP SIGNATURE----- --====-=-=--