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 | 0bba2eac2a3354324e185c2a1256c6c56f667e80 (patch) | |
tree | 83730b5cc6ca4dc3842b9c2c32565159dca0146d /elisp/geiser-syntax.el | |
parent | 458119f413b527e81fa2ca088e06a3208b3d6ceb (diff) | |
download | geiser-0bba2eac2a3354324e185c2a1256c6c56f667e80.tar.gz geiser-0bba2eac2a3354324e185c2a1256c6c56f667e80.tar.bz2 |
New function: `geiser-syntax--read-from-string', analogous to elisp's `read-from-string'.
Diffstat (limited to 'elisp/geiser-syntax.el')
-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))) |