In display-form-eval, the clojure.core/eval call that was done should be done after the namespace is changed, so I have moved it inside the macro eval-in-file-ns.
Load was done in namespace textmate. Now its done by default in namespace user (for those files which does not have ns or in-ns). If the file has an explicit ns or in-ns, load-file will take care of it.
I have done two clean-ups: deleting macro eval-in-ns which is never used and renaming the parameter to eval-in-file-ns from 'forms' to 'form' (and removing the & in the parameters definition) because we always pass only one form.
I have some questions about what it is considered proper functioning:
If I have a file with this content:
(def name 12)
(ns myns)
(def name 15)
and load it, user/name is defined with value 12 and myns/name with value 15. I think this is right.
But if I put the caret after the first line and do ^X, the expression gets evaluated in myns (because the namespace assigned to the whole file does not take caret's position into account).
Is this the way it is suppose to work or one has to find the last ns or in-ns before the caret?
Command-Shift-X (eval) now it evaluates the first one in selection.
Should be capable of evaluating more than one sexpr (and returning the value of the last one)?
Eval and eval-last-sexpr behaviour differently. For instance, if I append name to the file, that is:
(def name 12)
(ns myns)
(def name 15)
name
and I put the cursos after name, if I do ^X I get #'myns/name as result, but if I select name and do Command-Shift-X I get 15.
Is this the way it is supposed to be?
the current behavior file <-> namespace behavior is correct. Once a namespace is associated with a file, all evaluation when using that file will happen in that namespace. TextMate is not really sophisticated enough to allow for more subtle behaviors w/o out processing the entire file (which is possible, but I'm not sure that's a direction I want to investigate).
eval perhaps should allow multiple forms, I'd be willing to take a patch for this.
eval-last-sexpr looks for parens, it should probably be smarter. I'd be willing to take a patch for this as well.
I have some questions about what it is considered proper functioning:
and load it, user/name is defined with value 12 and myns/name with value 15. I think this is right.
and I put the cursos after name, if I do ^X I get #'myns/name as result, but if I select name and do Command-Shift-X I get 15. Is this the way it is supposed to be?