how to abort a function

David <dajo <at> Rednose.Rhubarb>
2003-01-13 15:18:17 GMT

I wrote this some time ago but was unable to post to ilisp-help (a
now-resolved problem with my ISP, nothing wrong with the ilisp list).
> Pascal Bourguignon <pjb <at> informatimago.com> writes:
>
> > Why the quite useful function comint-interrupt-subjob is not mapped
> > to the keyboard in the subjob window?
>
> It seems you are using FSF bindings (this is selectable, see the
> manual) where the binding for compile-defun-lisp conflicts with the
> traditional subjob interruption binding. Why the former is favored
> over the latter in the inferior Lisp buffer is probably just an
> oversight.
>
> > For now, to stop a lisp program, I can only kill the buffer (which
> > gives me: error in process filter: Selecting deleted buffer [8 times]
>
> Huh? A command doesn't need to be bound to a key combination for
> you to be able to invoke it. That would be insane. You can always
> say M-x interrupt-subjob-ilisp RET or use the menu.
>
> And customizability of Emacs isn't there just for the heck of it,
> so if you find keybindings suboptimal, make your own bindings.
>
> > I note that there is a lisp-bindings function called by ilisp-bindings
> > over possibly these maps: ilisp-mode-map, lisp-mode-map and
> > scheme-mode-map, which puts interrupt-subjob-ilisp in the \C-c\C-c
> > slot of the keymap, but when I type:
>
> Yes, but if you read it further, you'll (maybe) see that
> compile-defun-lisp is also bound to C-c C-c.
>
> --
> Hannu
> Please don't send copies of list mail
I think that there is room for a little care in interpretation and
investigation. It seems to me that, since the context is discussion of a
keymap, it is indeed true that it is only possible to kill the buffer. We all
know that commands can be invoked with M-x, but the original question was:
> Why the quite useful function comint-interrupt-subjob is not mapped
> to the keyboard in the subjob window?.
And the central point is that if you use C-c C-c what you get is
compile-defun-lisp.
The reason the problem arises is not unique to ilisp, although ilisp
is a fairly bad case: the ilisp keymap is a *mess*; you can look at
ilisp-mode-map with M-x describe-variable. Emacs keymaps can become
garbled if they are not put together carefully; I suspect that people
get tired of fiddling and stop when it seems to work instead of doing
some organised testing.
If you look at the keymap and extract the C-c entries this is what you get:
(3 keymap
(3 . compile-defun-lisp)
(3 . comint-interrupt-subjob)
(3 . comint-interrupt-subjob)
(3 keymap
(3 . comint-interrupt-subjob)
Six entries for C-c. So, a keyboard entry of C-c C-c gets first a
keymap, and then a command, which is indeed compile-defun-lisp. The
rest of the C-c entries, from a functional point of view, are just
garbage. The keymap could be quite a lot smaller and still work as it
does.
A quick fix is to use define-key to replace compile-defun-lisp with
comint-interrupt-subjob.
dajo
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en