Okay, one of my usual habits seems to be to answer my own questions... I figured this out. In the quest to get emacs talking to a separately started swank-server I made a too light emacs setup and totally skipped the swank-clojure.el and swank-clojure-autoload.el files. In them was the solution. In swank-clojure-autoload.el a hook is added to clojure-mode. That hook (swank-clojure-slime-mode-hook), among other things, sets up a value for slime-find-buffer-package-function, which, as you can guess from the name, sets up a function that will find the package of the current file/buffer. My mistake was to not load those two elisp files but also, in one setup where I did load the, to not load clojure-mode so that the hook was run.
So, I made two convenience commands that I can use depending on if I want to start a swank-server from emacs or to use one started "externally" (outside emacs) and connect to that. Assuming emacs -Q and all the latest versions of the included components (here is a good guide: http://riddell.us/tutorial/slime_swank/slime_swank.html) placed under ~/clj, this works for me: (defvar clojure-stuff-path "~/clj" "Where all cool Clojure stuff lies.") (defun slime-clojure-internal-swank () (interactive) (add-to-list 'load-path (concat clojure-stuff-path "/clojure-mode")) (add-to-list 'load-path (concat clojure-stuff-path "/swank- clojure")) (require 'swank-clojure-autoload) (require 'clojure-mode) (clojure-slime-config clojure-stuff-path) (slime)) (defun slime-clojure-external-swank () (interactive) (add-to-list 'load-path (concat clojure-stuff-path "/clojure-mode")) (add-to-list 'load-path (concat clojure-stuff-path "/swank- clojure")) (add-to-list 'load-path (concat clojure-stuff-path "/slime")) (require 'swank-clojure-autoload) (require 'clojure-mode) (clojure-slime-config clojure-stuff-path ) ;; The order of the line above and below is important (require 'slime) (slime-setup '(slime-fancy)) (call-interactively 'slime-connect)) Hope this can help someone. /Mathias On Sep 5, 9:09 pm, Mathias Dahl <mathias.d...@gmail.com> wrote: > I have the same problem and I have the latest version of all involved > components. I run Emacs 23.1 on Ubuntu. > > Any ideas on how to resolve it? The trick of using `ns' and `use' > separately does not seem to solve the problem for me. > > It feels like there are two or even more environments behind the > scenes, having their own opinions on the state of affair of things, > like in which namespace I am in. Any pointers to where I should start > if I want to debug this? The internal workings of slime is very deep > and it is hard to understand it. > > /Mathias > > On Jul 28, 4:19 pm, Daniel Janus <nath...@gmail.com> wrote: > > > > The following steps should show the "problem" I'm having: > > > [...] > > > This sequence works perfectly well for me withSLIME2009-07-15, > > clojure-mode 8c333628bf507749dd78b312333130b00e6ec06f, swank-clojure > > 6cd3057d48e00da485cdf43b2b170816e5187c40, Emacs 22.2.1 (on Ubuntu > > 9.04), and both Clojure 1.0.0 and current git. Perhaps you should try > > upgrading your setup? > > > Best, > > Daniel Janus --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---