diff options
author | jao <jao@gnu.org> | 2021-12-27 16:55:43 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-12-27 16:56:30 +0000 |
commit | f5e7004bf2f5af381dbf3387108cde210a190733 (patch) | |
tree | d934e5bbcb267e0cd84a132677401219f2b7ce77 /elisp/geiser-mode.el | |
parent | 48e6a6671571ef60ae764b165a2f152fc6d9e227 (diff) | |
download | geiser-f5e7004bf2f5af381dbf3387108cde210a190733.tar.gz geiser-f5e7004bf2f5af381dbf3387108cde210a190733.tar.bz2 |
New helper, geiser-eval-wait, to facilitate synchronous evaluations
This should address, for instance, issue #30
Diffstat (limited to 'elisp/geiser-mode.el')
-rw-r--r-- | elisp/geiser-mode.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index 1e5df0b..06e6655 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -95,11 +95,22 @@ result is an error msg." (push-mark) (goto-char (point-max))) +(defun geiser-eval-wait (req timeout) + "Use REQ, the result of computing an evaluation, to wait for its result. + +TIMEOUT is the number of seconds to wait for evaluation +completion. Functions returning a waitable REQ are +`geiser-eval-region' and its derivatives evaluating buffers or +individual sexps." + (geiser-con--wait req timeout)) + (defun geiser-eval-region (start end &optional and-go raw nomsg) "Eval the current region in the Geiser REPL. With prefix, goes to the REPL buffer afterwards (as -`geiser-eval-region-and-go')" +`geiser-eval-region-and-go'). The evaluation is performed +asynchronously: this function's return value can be used to wait +for its completion using `geiser-eval-wait'." (interactive "rP") (save-restriction (narrow-to-region start end) |