Harald Hanche-Olsen hanche@math.ntnu.no writes:
I just can't figure out what is going on
There seems to be a lot of confusion. The problem is <return> vs <RET> (C-m) (and keymap inheritance). If you change the original code to use (kbd "RET") everything should work.
The <return> function key is mapped into RET if otherwise unbound. lisp-mode-map is the parent map of slime-repl-mode-map. slime-repl-mode-map binds RET, but has no binding of its own for <return>, so any binding for <return> in lisp-mode-map is visible. Better leave <return> alone.