summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-09 21:59:23 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-02-09 21:59:23 +0100
commit4e16a7a00ffdc62d46143f614055d7aaf191ad9e (patch)
treec02d842ec2cfd510f2ef6b2ee25a6857dc9570b1 /elisp
parent8190670d6c47aea92871bc6f196dbc2c05904812 (diff)
downloadgeiser-4e16a7a00ffdc62d46143f614055d7aaf191ad9e.tar.gz
geiser-4e16a7a00ffdc62d46143f614055d7aaf191ad9e.tar.bz2
Better preparation of Scheme results for the Elisp reader.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-connection.el9
-rw-r--r--elisp/geiser-syntax.el17
2 files changed, 18 insertions, 8 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index 060ab7b..c18e7b2 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -26,6 +26,7 @@
;;; Code:
(require 'geiser-log)
+(require 'geiser-syntax)
(require 'geiser-base)
(require 'comint)
@@ -156,15 +157,9 @@
(defsubst geiser-con--comint-buffer ()
(get-buffer-create " *geiser connection retort*"))
-(defun geiser-con--cleaunp-result-str ()
- (goto-char (point-min))
- (while (re-search-forward "#(" nil t) (replace-match "(vector "))
- (goto-char (point-min))
- (while (re-search-forward "#" nil t) (replace-match "\\\\#")))
-
(defun geiser-con--comint-buffer-form ()
(with-current-buffer (geiser-con--comint-buffer)
- (geiser-con--cleaunp-result-str)
+ (geiser-syntax--prepare-scheme-for-elisp-reader)
(goto-char (point-min))
(condition-case nil
(let ((form (read (current-buffer))))
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index fa8e9b2..5e45470 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -53,7 +53,7 @@
;;; Code parsing:
(defsubst geiser-syntax--end-of-thing ()
- (let ((sc (syntax-class (syntax-after (point)))))
+ (let ((sc (or (syntax-class (syntax-after (point))) 0)))
(when (= sc 7) (forward-char))
(cond ((nth 3 (syntax-ppss))
(skip-syntax-forward "^\"")
@@ -77,6 +77,21 @@
(when (< (point) p) (setq arg-no (1+ arg-no))))
(cons proc arg-no)))))
+(defun geiser-syntax--prepare-scheme-for-elisp-reader ()
+ (goto-char (point-min))
+ (while (re-search-forward "#\<\\([^>]*?\\)\>" nil t)
+ (let ((from (match-beginning 1))
+ (to (match-end 1)))
+ (goto-char from)
+ (while (re-search-forward "\\([() ;'`]\\)" to t)
+ (replace-match "\\\\\\1"))
+ (goto-char to)))
+ (goto-char (point-min))
+ (while (re-search-forward "#(" nil t) (replace-match "(vector "))
+ (goto-char (point-min))
+ (while (re-search-forward "#" nil t) (replace-match "\\\\#")))
+
+
;;; Fontify strings as Scheme code: