summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2011-06-23 00:32:27 +0200
committerjao <jao@gnu.org>2011-06-23 00:32:27 +0200
commit830a0036f43341b2c5e1451ef1d7ed09b70768ec (patch)
treec252ed4afbbd6dcaa22b2203a00a28bf510109e3
parent2efa614b7de69a3dc4de66f81f0de3fb48110524 (diff)
downloadgeiser-chez-830a0036f43341b2c5e1451ef1d7ed09b70768ec.tar.gz
geiser-chez-830a0036f43341b2c5e1451ef1d7ed09b70768ec.tar.bz2
Avoid (read) breakage (fixes #33090)
Autodoc was firing while the REPL was waiting for input of a (read) call, causing all kinds of misbehaviour. We now inhibit autodoc on sending a form for evaluation and re-inhibit it once a prompt is read back again.
-rw-r--r--elisp/geiser-autodoc.el8
-rw-r--r--elisp/geiser-connection.el4
-rw-r--r--elisp/geiser-repl.el11
3 files changed, 18 insertions, 5 deletions
diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index 88b94a1..550cb16 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -1,6 +1,6 @@
;; geiser-autodoc.el -- autodoc mode
-;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010, 2011 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
@@ -180,6 +180,12 @@ when `geiser-autodoc-display-module-p' is on."
(and geiser-autodoc--inhibit-function
(funcall geiser-autodoc--inhibit-function)))
+(defsubst geiser-autodoc--inhibit-autodoc ()
+ (setq geiser-autodoc--inhibit-function (lambda () t)))
+
+(defsubst geiser-autodoc--disinhibit-autodoc ()
+ (setq geiser-autodoc--inhibit-function nil))
+
(defsubst geiser-autodoc--autodoc-at-point ()
(geiser-autodoc--autodoc (geiser-syntax--scan-sexps)))
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index 12a9f46..d14fe0e 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -158,6 +158,10 @@
(and (not (geiser-con--connection-is-debugging con))
(geiser-con--connection-update-debugging con answer)))
+(defun geiser-con--connection-eot-p (con txt)
+ (and txt
+ (string-match-p (geiser-con--connection-eot con) txt)))
+
(defun geiser-con--connection-close (con)
(let ((tq (geiser-con--connection-tq con)))
(and tq (tq-close tq))))
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 74a1207..5027c28 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -253,8 +253,10 @@ module command as a string")
(geiser-repl--host)
(geiser-repl--port)))))
-(defun geiser-repl--update-debugging (txt)
- (geiser-con--connection-update-debugging geiser-repl--connection txt))
+(defun geiser-repl--output-filter (txt)
+ (geiser-con--connection-update-debugging geiser-repl--connection txt)
+ (when (geiser-con--connection-eot-p geiser-repl--connection txt)
+ (geiser-autodoc--disinhibit-autodoc)))
(defun geiser-repl--start-repl (impl address)
(message "Starting Geiser REPL for %s ..." impl)
@@ -281,7 +283,7 @@ module command as a string")
(geiser-repl--autodoc-mode 1)
(geiser-company--setup geiser-repl-company-p)
(add-hook 'comint-output-filter-functions
- 'geiser-repl--update-debugging
+ 'geiser-repl--output-filter
nil
t)
(message "%s up and running!" (geiser-repl--repl-name impl))))
@@ -334,7 +336,8 @@ module command as a string")
(setq geiser-eval--default-connection-function 'geiser-repl--connection)
(defun geiser-repl--prepare-send ()
- (geiser-con--connection-deactivate geiser-repl--connection))
+ (geiser-con--connection-deactivate geiser-repl--connection)
+ (geiser-autodoc--inhibit-autodoc))
(defun geiser-repl--send (cmd)
(when (and cmd (eq major-mode 'geiser-repl-mode))