From 1dd9eeb3cb80260738a5683e9a41b6f66acd7460 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 16 Jun 2009 22:35:21 +0200 Subject: Better parsing of scheme retorts in the Emacs end. --- elisp/geiser-connection.el | 10 +++++++--- elisp/geiser-syntax.el | 21 ++++----------------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el index 33579f6..33668e0 100644 --- a/elisp/geiser-connection.el +++ b/elisp/geiser-connection.el @@ -160,10 +160,14 @@ (defun geiser-con--comint-buffer-form () (with-current-buffer (geiser-con--comint-buffer) - (geiser-syntax--prepare-scheme-for-elisp-reader) (condition-case nil - (let ((form (read (current-buffer)))) - (if (listp form) form (error))) + (progn + (goto-char (point-min)) + (re-search-forward "((\\(result\\|error\\) ") + (goto-char (match-beginning 0)) + (geiser-syntax--prepare-scheme-for-elisp-reader) + (let ((form (read (current-buffer)))) + (if (listp form) form (error)))) (error `((error (key . geiser-con-error) (msg . ,(buffer-string)))))))) (defun geiser-con--process-next (con) diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el index 14d996c..c70aacb 100644 --- a/elisp/geiser-syntax.el +++ b/elisp/geiser-syntax.el @@ -89,23 +89,10 @@ (goto-char (point-max)) (and (re-search-backward "(output \\. \"" nil t) (point))))) - (goto-char (point-min)) - (while (re-search-forward "#\<\\([^>]*?\\)\>" end t) - (let ((from (match-beginning 1)) - (to (match-end 1))) - (goto-char from) - (while (re-search-forward "\\([ ;'`]\\)" to t) - (replace-match "\\\\\\1")) - (goto-char from) - (while (re-search-forward "[()]" to t) - (replace-match "")) - (goto-char to))) - (goto-char (point-min)) - (while (re-search-forward "#(" end t) (replace-match "(vector ")) - (goto-char (point-min)) - (while (re-search-forward "#" end t) (replace-match "\\\\#")) - (goto-char (point-min)) - (skip-syntax-forward "^("))) + (save-excursion + (while (re-search-forward "#(" end t) (replace-match "(vector ")) + (goto-char (point-min)) + (while (re-search-forward "#" end t) (replace-match "\\\\#"))))) (defsubst geiser-syntax--del-sexp (arg) (let ((p (point))) -- cgit v1.2.3