On 23 Jan 2007 17:03:25 +0200, Ariel Badichi abadichi@bezeqint.net wrote:
Hello,
"Attila Lendvai" attila.lendvai@gmail.com writes:
So a better fix is:
(defvar slime-scratch-mode-map (let ((map (make-sparse-keymap))) (set-keymap-parent map lisp-mode-map) map))
without knowing too much about keymaps, minor/major modes and their interactions... (so take it with a piece of salt...) but how about (set-keymap-parent slime-mode-map lisp-mode-map)?
Hmm. Lisp is a major mode, so it sets up lisp-mode-map as a local keymap. Slime is a minor mode, and it can be used with major modes other than Lisp, though that doesn't seem terribly useful. Why should Slime be a keymap hog and absorb lisp-mode-map into slime-mode-map? Especially when in the general case (non-scratch Lisp Slime buffers) lisp-mode-map bindings are already active, so there'll be duplication of bindings, unless you change the local keymap but that seems perverse. The SLIME scratch buffer is a special case, and needs its own local keymap anyway. Since it gets created with a Lisp major mode we can reasonably say that its local keymap should be based on lisp-mode-map. It would also change the order of key lookup; if someone comes up with another minor mode that is supposed, say, to override some Lisp mode keybindings, it could conflict with Slime then.
What's confusing for me is that (if I do a "C-h m" in the SLIME scratch buffer) both lisp mode and slime mode are shown as being active in the SLIME scratch buffer. And, (again, if you do "C-h m") the "C-M-q" key chord is shown as being bound to indent-sexp in lisp mode but that it is being "shadowed". But there is no alternative binding for C-M-q. So, presumably some other minor mode must be removing the "C-M-q" binding? But, slime-scratch-buffer does the following: (with-current-buffer (get-buffer-create "*slime-scratch*") (lisp-mode) (use-local-map slime-scratch-mode-map) (slime-mode t) (current-buffer))
so, I would have thought that the same bindings that are in effect for lisp-mode and slime-mode would also be in effect for the slime-scratch buffer (with the addition of any keys that were added to slime-scratch-mode-map - only C-j at the moment). I don't see what could be "shadowing" the C-M-q binding in lisp-mode.
- Bill