emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tim Van den Langenbergh <tmt_vdl@gmx.com>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: Felipe Lema <felipelema@mortemale.org>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] update ob-scheme to latest changes in geiser package
Date: Sat, 07 May 2022 14:04:35 +0200	[thread overview]
Message-ID: <87y1zd1r6t.fsf@terra.tmtvl.info> (raw)
In-Reply-To: <87r15ivru7.fsf@localhost>

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


Ihor Radchenko <yantar92@gmail.com> writes:

>
> Thanks! Since Felipe has no objections, your patch should be good to apply.
>
> Could you kindly add the geiser version info as a comment inside code?
> Commit message is an unlikely place to be checked regularly and be
> noticed as geiser is updated in future.
>
> Comments are generally preferred over commit messages:
>
> https://orgmode.org/worg/org-contribute.html#commit-messages ->
> -> https://git.savannah.gnu.org/cgit/emacs.git/plain/CONTRIBUTE
>>> - Explaining the rationale for a design choice is best done in comments
>>>   in the source code.  However, sometimes it is useful to describe just
>>>   the rationale for a change; that can be done in the commit message
>>>   between the summary line and the file entries.
>
> Best,
> Ihor

Hello Ihor,

thank you for pointing that out, seems I botched my reading comprehension skill
check.

I have updated the patch and enclosed it, feel free to drop a line if you
notice anything else obviously missing.

Vale,

- Tim


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ob-scheme.el-Use-synchronous-eval --]
[-- Type: text/x-patch, Size: 2158 bytes --]

From 3b4120d5b3fb41d4b0a5bbdee4cc7a3f4cd02642 Mon Sep 17 00:00:00 2001
From: Tim Van den Langenbergh <tmt_vdl@gmx.com>
Date: Sat, 23 Apr 2022 14:57:27 +0200
Subject: [PATCH] lisp/ob-scheme.el: Use synchronous eval.

* ob-scheme.el (org-babel-scheme-execute-with-geiser): If available,
use the synchronous `geiser-eval-region/wait' function to get the
evaluation result.

Works with geiser 0.18 (before introduction of async evaluation) and
geiser 0.22 (which introduces `geiser-eval-region/wait').

Modified from a patch proposal by Felipe Lema.

TINYCHANGE
---
 lisp/ob-scheme.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index 72d2e029e..b91c368a7 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -55,6 +55,8 @@
 (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-eval-region/wait "ext:geiser-mode"
+                  (start end &optional timeout))
 (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 +178,13 @@ is true; otherwise returns the last value."
 	  (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))))
+            ;; `geiser-eval-region/wait' was introduced to await the
+            ;; result of async evaluation in geiser version 0.22.
+	    (let ((ret (funcall (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")
--
2.36.0


  reply	other threads:[~2022-05-07 12:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <878rrw0w3x.fsf@terra.tmtvl.info>
2022-04-23 13:29 ` [PATCH] update ob-scheme to latest changes in geiser package 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 [this message]
2022-05-08 10:02       ` Ihor Radchenko
2021-12-29 18:03 Felipe Lema
2021-12-30  1:53 ` Felipe Lema
2021-12-30 15:50   ` Max Nikulin
2021-12-30 19:01   ` Felipe Lema
2021-12-31  4:22     ` Max Nikulin
2022-02-06  9:50       ` 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=87y1zd1r6t.fsf@terra.tmtvl.info \
    --to=tmt_vdl@gmx.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=felipelema@mortemale.org \
    --cc=yantar92@gmail.com \
    /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).