这样貌似可行:
(let ((s ""))
(while t
(setq s (concat s "\n" (read-from-minibuffer "ELPL> ")))
(condition-case err
(progn
(print (eval (read s)))
(setq s ""))
(end-of-file)
(error
(setq s "")
(print err)))))
效果:
"foo
bar"
ELPL>
"foo
bar"
ELPL> "foo
bar
baz"
ELPL>
"foo
bar
baz"
ELPL> (+ 1
2
3
)
ELPL>
6
ELPL> (+ 1
ELPL> 2
ELPL> 3
ELPL> 4
ELPL> )
10
ELPL>