all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felipe Lema <felipelema@mortemale.org>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] update ob-scheme to latest changes in geiser package
Date: Thu, 30 Dec 2021 16:01:37 -0300	[thread overview]
Message-ID: <3462869.oopU1TnKvU@felipe-thinkpad-x200> (raw)
In-Reply-To: <3749511.XVzDg1PN9u@felipe-thinkpad-x200>

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

On Thursday, 30 December 2021 22:50:20 +07 Max Nikulin wrote:
> On Wednesday, 29 December 2021 22.53.18 -03 Felipe Lema wrote:
> > On Wednesday, 29 December 2021 15.03.47 -03 Felipe Lema wrote:
> > > Sup, y'all
> > > 
> > > The geiser package had a recent update in which `geiser-eval-region` behaves like an async function and does not return evaluation result. In exchange, the newly introduced `geiser-eval-region/wait` does that now.
> > > 
> > > I've attached a patch to update ob-scheme.el to reflect these changes. Without them, evaluating scheme dialect code blocks in Org will end up with empty results.
> > > 
> > > To learn more about the change (and how it impacted other people's flows) see issue thread below
> > > 
> > > https://gitlab.com/emacs-geiser/geiser/-/issues/30
> > > 
> > > Felipe
> > > 
> > > 
> > 
> > I was pointed out that I was missing the corresponding `declare-function`.
> > 
> > I've included it in the attached patch. Sorry about the double-posting
> > 
> > Felipe
> > 
> 
> I am not a geiser user, so maybe I missed something. Does this change mean that org becomes incompatible with older geiser versions? E,g, debian and ubuntu have elpa-geiser system package.
> 
> 
> I would consider testing if `geiser-eval-region/wait' is bound and fallback to `geiser-eval-region' otherwise. 

I've wrapped an `if` to fallback to previous API before this breaking change in attached patch.

Felipe

[-- Attachment #2: org-babel-scheme-geiser-eval-region.wait_v3.diff --]
[-- Type: text/x-patch, Size: 1542 bytes --]

update to new API call to evaluate region and wait for result

* ob-scheme.el replace `geiser-eval-region` with `geiser-eval-region/wait` (only available in newer versions) as the former changed expected behaviour; the latter returns the result of evaluating.
diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index f4836b23fe..ffbd62bf97 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -53,8 +53,6 @@ geiser-repl-window-allow-split

 (declare-function run-geiser "ext:geiser-repl" (impl))
 (declare-function geiser-mode "ext:geiser-mode" ())
-(declare-function geiser-eval-region "ext:geiser-mode"
-                  (start end &optional and-go raw nomsg))
 (declare-function geiser-repl-exit "ext:geiser-repl" (&optional arg))
 (declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
 (declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix))
@@ -176,7 +174,14 @@ org-babel-scheme-execute-with-geiser
 	  (setq geiser-impl--implementation nil)
 	  (let ((geiser-debug-jump-to-debug-p nil)
 		(geiser-debug-show-debug-p nil))
-	    (let ((ret (geiser-eval-region (point-min) (point-max))))
+	    (let ((ret (funcall
+			;; use `geiser-eval-region/wait' only when available
+			;; in newer versions of `geiser'
+			(if (fboundp 'geiser-eval-region/wait)
+			    'geiser-eval-region/wait
+			  'geiser-eval-region)
+			(point-min)
+			(point-max))))
 	      (setq result (if output
 			       (or (geiser-eval--retort-output ret)
 				   "Geiser Interpreter produced no output")

  parent reply	other threads:[~2021-12-30 19:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29 18:03 [PATCH] update ob-scheme to latest changes in geiser package Felipe Lema
2021-12-30  1:53 ` Felipe Lema
2021-12-30 15:50   ` Max Nikulin
2021-12-30 19:01   ` Felipe Lema [this message]
2021-12-31  4:22     ` Max Nikulin
2022-02-06  9:50       ` Ihor Radchenko
     [not found] <878rrw0w3x.fsf@terra.tmtvl.info>
2022-04-23 13:29 ` Tim Van den Langenbergh
2022-04-26 15:04   ` Felipe Lema
2022-04-27  8:44   ` Ihor Radchenko
2022-05-07 12:04     ` Tim Van den Langenbergh
2022-05-08 10:02       ` 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

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

  git send-email \
    --in-reply-to=3462869.oopU1TnKvU@felipe-thinkpad-x200 \
    --to=felipelema@mortemale.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.