As I'm starting to play around with PLT Scheme, I'll try to keep a set of notes on special environment stuff that I've been using to make things more pleasant.

PLT Scheme 301

PLT Scheme v301 is more pleasant than v209. Get that version.

Emacs Quack mode

I'm an emacs person, but I've found that DrScheme works pretty darn well as a text editor. One critical setting that needs to be on (or in the case, off) is under Preferences/Editing/General. Turn off "Enable keybindings in Menus", and many of the familiar emacs keystrokes will be enabled.

But if I use Emacs, I find that although Emacs already comes with a scheme-mode, it's a bit outdated. There is a very nice enhanced Scheme mode that can be found here: quack. But you may also want to add some bindings for commenting blocks of code, so the following .emacs customizations may be useful:

;; When in scheme mode, make C-c C-c stick around as comment-region
(add-hook 'scheme-mode-hook
          (function (lambda ()
                      (local-set-key [(control c) (control c)] 'comment-region )
                      (local-unset-key [(control c) (meta c)])

;; When in scheme mode, also add C-\ as lambda
(add-hook 'scheme-mode-hook
          (function (lambda ()
                      (local-set-key "\C-\\"
                                     (lambda () (interactive nil) (insert "lambda"))))))
In newer versions of Emacs (22?), at least on my Mac, the shell starts echoing back its input in certain situations. I've had to add:
;; Keep the shell from echoing; necessary in Emacs 22 to prevent going ;; nuts. See ;; ;; for details. (add-hook 'shell-mode-hook (lambda nil (setq comint-process-echoes t))) ;; Also done for scheme (add-hook 'scheme-mode-hook (lambda nil (setq comint-process-echoes t)))
to make my life more joyful and to prevent the shell from echoing everything I write.


The next thing to have is readline, to make the mzscheme terminal interface more pleasant. The readline bindings can be found in the readline collection, and enabling readline support in the read-eval-print loop is a matter of:

(require (lib """readline"))
This should be added to ~/.mzschemerc to allow readline's support to persist between mzscheme sessions.


mzscheme doesn't display error traces by default. Enabling them isn't too difficult though. Adding the following to .mzschemerc should do the trick.

(require (lib "" "errortrace"))
errortrace was added in release 104 alpha 4, but for some reason, I haven't been able to find any reference to it in the reference manuals.