geiser-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Send s-exp to the REPL for evaluation


From: Jérémy Korwin-Zmijowski
Subject: Send s-exp to the REPL for evaluation
Date: Thu, 6 Jun 2024 12:01:47 +0200
User-agent: Mozilla Thunderbird

Dear Geiser users,

I look for a way to programmatically evaluate a Guile s-exp like Geiser would do it when I hit `C-x C-e`.

Let say the s-exp I want to evaluate is ((run-tests) gunit64-tests)

If I put the s-exp in my guile script and hit `C-x C-e`, it returns #t and the Geiser Debug buffer shows up with informations I displayed from code.

But here I want to remove the s-exp from the script and evaluate it when I hit a custom key binding, for example `C-c r m`

So I wrote a minor mode :

(define-minor-mode gunit64-mode
  "Spell out tests for your Guile app."
  :lighter " gunit64"
  :keymap (let ((map (make-sparse-keymap)))
            (define-key map (kbd "C-c r m") 'run-module-tests)
            map))

With the run-module-tests function :

(defun run-module-tests ()
  "Execute the gunit64 test suite."
  (interactive)
  ;; code to evaluate s-exp here
  )

I tried few things with no luck haha.

(geiser-eval--send/result '(:eval (:scm ((run-tests) gunit64-tests))))
(geiser-eval--send/wait '(:eval (:scm ((run-tests) gunit64-tests))))
(geiser-eval--send/wait '((run-tests) gunit64-tests))
(geiser-eval--code-str '((run-tests) gunit64-tests))

The try approaching the most what I want is :

(defun run-module-tests ()
  "Execute the gunit64 test suite."
  (interactive)
  (message "%s" (geiser-eval--send/wait "((run-tests) gunit64-tests)")))

Which print the output in the minibuffer (or messages buffer), but I have to extract the relevant part of the return value of geiser-eval--send/wait.

I would like it to trigger the geiser debug buffer instead.

Maybe someone here can point me what I missed…

Thank you !

-- 
Jérémy Korwin-Zmijowski

GPG: AD1945EC4F03FC79

reply via email to

[Prev in Thread] Current Thread [Next in Thread]