summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-base.el5
-rw-r--r--elisp/geiser-connection.el27
-rw-r--r--elisp/geiser-repl.el4
-rw-r--r--elisp/geiser.el4
4 files changed, 25 insertions, 15 deletions
diff --git a/elisp/geiser-base.el b/elisp/geiser-base.el
index 4194da5..71aa8b4 100644
--- a/elisp/geiser-base.el
+++ b/elisp/geiser-base.el
@@ -41,9 +41,14 @@
;;; Utilities:
+(require 'ansi-color)
+
(defsubst geiser--chomp (str)
(if (string-match-p ".*\n$" str) (substring str 0 -1) str))
+(defsubst geiser--strip-ansi (s)
+ (replace-regexp-in-string "" "" (ansi-color-filter-apply s)))
+
(defun geiser--shorten-str (str len &optional sep)
(let ((str-len (length str)))
(if (<= str-len len)
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index 5f1e782..b59d109 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -1,6 +1,6 @@
;;; geiser-connection.el --- Talking to a scheme process -*- lexical-binding: t; -*-
-;; Copyright (C) 2009-2011, 2013, 2021-2022, 2025-2026 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009-2011, 2013, 2021-2022, 2025, 2026 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -23,7 +23,6 @@
(require 'geiser-impl)
(require 'tq)
-(require 'ansi-color)
(eval-when-compile (require 'subr-x))
@@ -40,7 +39,7 @@
;;; Request datatype:
(defun geiser-con--make-request (con str cont &optional sender-buffer)
- (list (cons :id (geiser-con--connection-inc-count con))
+ (list (cons :id (and (car con) (geiser-con--connection-inc-count con)))
(cons :string str)
(cons :continuation cont)
(cons :buffer (or sender-buffer (current-buffer)))
@@ -82,7 +81,7 @@
(progn (geiser-log--error "Unexpected queue input:\n %s" in)
(delete-region (point-min) (point-max)))
(goto-char (point-max))
- (insert (ansi-color-filter-apply in))
+ (insert (geiser--strip-ansi in))
(goto-char (point-min))
(when (re-search-forward (tq-queue-head-regexp tq) nil t)
(unwind-protect
@@ -264,7 +263,8 @@
(defun geiser-con--send-string (con str cont &optional sbuf)
(let ((req (geiser-con--make-request con str cont sbuf)))
- (geiser-con--connection-add-request con req)
+ (when (geiser-con--request-id req)
+ (geiser-con--connection-add-request con req))
req))
(defvar geiser-connection-timeout 30000
@@ -284,12 +284,17 @@
(id (geiser-con--request-id req))
(timeout (/ (or timeout geiser-connection-timeout) 1000.0))
(step (/ timeout 10)))
- (with-timeout (timeout (geiser-con--request-deactivate req))
- (condition-case nil
- (while (and (geiser-con--connection-process con)
- (not (geiser-con--connection-completed-p con id)))
- (accept-process-output proc step))
- (error (geiser-con--request-deactivate req))))))
+ (if (null (geiser-con--request-id req)) ;; request sent with paused conn
+ (when-let* ((cont (geiser-con--request-continuation req)))
+ (with-current-buffer (or (geiser-con--request-buffer req)
+ (current-buffer))
+ (funcall cont '((result)))))
+ (with-timeout (timeout (geiser-con--request-deactivate req))
+ (condition-case nil
+ (while (and (geiser-con--connection-process con)
+ (not (geiser-con--connection-completed-p con id)))
+ (accept-process-output proc step))
+ (error (geiser-con--request-deactivate req)))))))
(defun geiser-con--send-string/wait (con str cont &optional timeout sbuf)
(when (and (stringp str) (not (string-blank-p str)))
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 84ff8ce..ce638cb 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -592,6 +592,7 @@ to standard output face."
geiser-repl-auto-display-images-p)
(when (string-match-p (geiser-con--connection-prompt geiser-repl--connection)
txt)
+ (geiser-con--connection-activate geiser-repl--connection)
(geiser-autodoc--disinhibit-autodoc)))
(defun geiser-repl--check-version (impl)
@@ -743,7 +744,6 @@ to standard output face."
(defun geiser-repl--prepare-send ()
(geiser-image--clean-cache)
(geiser-autodoc--inhibit-autodoc)
- (geiser-eval--wait )
(geiser-con--connection-deactivate geiser-repl--connection))
(defun geiser-repl--send (cmd &optional save-history)
@@ -1155,7 +1155,7 @@ buffer."
(geiser-repl-autoeval-mode 1))
(when geiser-repl-superparen-mode-p
(geiser-repl-superparen-mode 1))
-
+ (add-hook 'comint-preoutput-filter-functions #'geiser--strip-ansi nil t)
;; enabling compilation-shell-minor-mode without the annoying highlighter
(compilation-setup t))
diff --git a/elisp/geiser.el b/elisp/geiser.el
index 47ce75e..687f50b 100644
--- a/elisp/geiser.el
+++ b/elisp/geiser.el
@@ -1,6 +1,6 @@
;;; geiser.el --- GNU Emacs and Scheme talk to each other -*- lexical-binding: t; -*-
-;; Copyright (C) 2009-2013, 2015, 2018, 2021-2025 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009-2013, 2015, 2018, 2021-2026 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -13,7 +13,7 @@
;; Homepage: https://gitlab.com/emacs-geiser/
;; Package-Requires: ((emacs "27.1") (project "0.8.1"))
;; SPDX-License-Identifier: BSD-3-Clause
-;; Version: 0.32
+;; Version: 0.33
;;; Commentary: