[slime-devel] changing slime-keys

What function should I call when I change slime-keys to have them taken into account immediately? -- __Pascal Bourguignon__ http://www.informatimago.com/ There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him. -- Robert Heinlein

Pascal J.Bourguignon <pjb@informatimago.com> writes:
What function should I call when I change slime-keys to have them taken into account immediately?
(load "slime") and reopen your Lisp buffer(s) should do it. Or `M-x slime-init-keymaps' might be sufficient. -Luke

Luke Gorrie writes:
Pascal J.Bourguignon <pjb@informatimago.com> writes:
What function should I call when I change slime-keys to have them taken into account immediately?
(load "slime") and reopen your Lisp buffer(s) should do it.
Or `M-x slime-init-keymaps' might be sufficient.
That was my first try, but it does not work. (defun pjb-slime-eval-last-expression () "Evaluate the expression preceding point." (interactive) (setf *pjb-slime-buffer* (current-buffer)) (pjb-slime-interactive-eval (slime-last-expression)) );;pjb-slime-eval-last-expression (defun equiv (&rest args) (if (null args) t (let ((val (not (pop args)))) (while (and args (eq val (not (car args)))) (pop args)) (not args))));;equiv (defvar *pjb-slime-keys-dynamic* nil) (defun pjb-slime-substitute-command (key command &rest keys) (unless *pjb-slime-keys-dynamic* (setf slime-keys (copy-seq slime-keys) *pjb-slime-keys-dynamic* t)) (let ((prefixedp (cadr (member :prefixed keys))) (skeys slime-keys)) (while skeys (when (and (string= key (first (car skeys))) (equiv prefixedp (cadr (member :prefixed (car skeys))))) (setf (second (car skeys)) command skeys nil)) (pop skeys))) (slime-init-keymaps));;pjb-slime-substitute-command (pjb-slime-substitute-command "\M-." 'slime-edit-definition-other-window) (pjb-slime-substitute-command "\C-e" 'pjb-slime-eval-last-expression :prefixed t) slime-keys is correctly changed: (show (assoc "" slime-keys)) ;; --> ("" pjb-slime-eval-last-expression :prefixed t :sldb t :inferior t) but C-c C-e is still bound to slime-eval-last-expression, in current slime-mode buffers (or new ones, if I kill and re-open a .lisp file for example). When I (trace slime-init-keymaps slime-init-keymaps slime-define-key), slime-define-key is called as expected thought: | 2 -> slime-define-key: key="" command=pjb-slime-eval-last-expression --rest--42917=(:allow-other-keys t :prefixed t :sldb t :inferior t) | 2 <- slime-define-key: pjb-slime-eval-last-expression -- __Pascal Bourguignon__ http://www.informatimago.com/ There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him. -- Robert Heinlein

Pascal J.Bourguignon <pjb@informatimago.com> writes:
What function should I call when I change slime-keys to have them taken into account immediately?
I think there's no easy way to do that. define-minor-mode uses some opaque magic to associate the keymap with the minor-mode; it somehow tests if there's already a keymap and does nothing the second time. Well, at least that's the situation in Emacs 20. You could try to remove slime-mode completely from the minor-mode-map-alist and then reload slime.el, but that's quite a bit of work. Helmut.

Helmut Eller writes:
Pascal J.Bourguignon <pjb@informatimago.com> writes:
What function should I call when I change slime-keys to have them taken into account immediately?
I think there's no easy way to do that. define-minor-mode uses some opaque magic to associate the keymap with the minor-mode; it somehow tests if there's already a keymap and does nothing the second time. Well, at least that's the situation in Emacs 20. You could try to remove slime-mode completely from the minor-mode-map-alist and then reload slime.el, but that's quite a bit of work.
And perhaps collect the list of buffer in slime minor modes before and reset them in the same slime minor mode after? -- __Pascal Bourguignon__ http://www.informatimago.com/ There is no worse tyranny than to force a man to pay for what he does not want merely because you think it would be good for him. -- Robert Heinlein
participants (3)
-
Helmut Eller
-
Luke Gorrie
-
Pascal J.Bourguignon