wuub/SublimeREPL — pull request #134 by lionandoil (2013-02-17 19:20:49+00:00)
Title: Adding clojure sender that evaluates selections in the right namespace

Added a clojure sender that wraps (load-string) around the selection sent to the repl for execution so that syntax errors are caught and signalled immediately instead of potentially blocking the repl.

Also added functionality to detect any namespace declarations at the beginning of clojure files and have selections be evaluated in that namespace (see #133). This is a language-specific feature that works (and is equally necessary) for all Clojure repls. The code might look a bit adventurous but rest assured that other repl interfaces do exactly the same thing (the last version of slime I used was only able to detect a namespace declaration if it started at position 0 of the file - I dare say that my implementation is much more robust than that ;))

To enable the sender to inspect the content of the view for namespace declarations I had to change ReplSend and ReplViewWrite from WindowCommands to TextCommands which doesn't affect the existing commands, and all readers now take a 'view' argument instead of the old 'file_name' one.

Don't worry about maintenance of that sender, I'll be using it intensively for the foreseeable future so I'll take good care of it :) - although I think it should be pretty robust anyway since I'm not actually manipulating the commands that are passed for execution, just wrapping them in core clojure functions/macros.