diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-09-12 23:26:22 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-09-12 23:26:22 +0200 |
commit | b131c3e5c1e954c9ce3b1324937ba89a54bc66d1 (patch) | |
tree | 7a988567763c174c3d6da5e75f599a5b7e9b1fe5 /elisp | |
parent | 41dbd0eda13fb41706c74174f13434e22ffe6843 (diff) | |
download | geiser-guile-b131c3e5c1e954c9ce3b1324937ba89a54bc66d1.tar.gz geiser-guile-b131c3e5c1e954c9ce3b1324937ba89a54bc66d1.tar.bz2 |
New function: `geiser-syntax--read-from-string', analogous to elisp's `read-from-string'.
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-syntax.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el index 6d05f57..e22344e 100644 --- a/elisp/geiser-syntax.el +++ b/elisp/geiser-syntax.el @@ -171,6 +171,14 @@ ((char string atom) (cdr token)) (t (error "Reading scheme syntax: unexpected token: %s" token))))) +(defun geiser-syntax--read-from-string (string &optional start end) + (when (stringp string) + (let ((start (or start 0)) + (end (or end (length string)))) + (with-temp-buffer + (save-excursion (insert string)) + (cons (ignore-errors (geiser-syntax--read)) (point)))))) + (defsubst geiser-syntax--read/keyword-value (s) (and (consp s) (eq (car s) :keyword) (cdr s))) |