I want to study SICP in my Emacs. I've installed MIT Scheme, Emacs 24 and downloaded sicp info (using this guide http://www.pchristensen.com/blog/articles/setting-up-and-using-emacs-infomode/). Now I'm able to run scheme interpreter in dedicated buffer(M-x run-scheme), but I get the following error when I try to send one of define expressions from info buffer (C-x C-e):
Debugger entered--Lisp error: (void-function define)
(define (abs x) (cond ((> x 0) x) ((= x 0) 0) ((< x 0) (- x))))
eval((define (abs x) (cond ((> x 0) x) ((= x 0) 0) ((< x 0) (- x)))) nil)
eval-last-sexp-1(nil)
eval-last-sexp(nil)
call-interactively(eval-last-sexp nil nil)
Looks like Emacs is trying to execute this code with Lisp interpreter. As workaround for this issue now I open scheme buffer (*.scm file), copy code to it from info, and them execute it with C-x C-e. But I want to execute it directly from info buffer. How can I setup this?
When you press (C-x C-e) in info mode Emacs is invoking eval-last-sexp because that is what the key combination is bound to in info-mode
What is (C-x C-e) bound to in scheme-mode? You can find out using (C-h c)? You can bind some other key combination to that function in info mode and use that key combination.
Note that info mode is read-only. If the scheme-eval function inserts the results in current buffer you will need a work-around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With