Subject: bug#6035: M-x gdb crashes

From: Arni Magnusson <[email-masked]>
Date: Tue, 6 Jul 2010 00:27:25 +0000 (UTC)

Thank you Dmitry, for the feedback.

As a maintainer of two major modes, I'm familiar with the keybinding 
conventions that you mention. My interpretation of the conventions is that 
Emacs developers should try to use C-c C-char when providing keybindings 
for their modes.

Emacs users, on the other hand, are not restricted when binding any 
keystroke to any command. This is what makes Emacs such an efficient 
working environment: users customize all keybindings to their liking, and 
everything just work. The worst thing that can happen is that a command is 
not available with the keystroke that the developer intended, but the 
command is still available as M-x foo, and can also be bound to whatever 
keystroke the user finds practical.

In my experience, all modes load and work fine, regardless of the 
keybindings in my .emacs file. The only exception is `gdb' and C-x C-a. 
The Emacs Manual demonstrates how users can rebind keystrokes like C-x l, 
overriding the default binding of that keystroke. I can find no warning 
against redefining C-x C-char, such as C-x C-a. The default Emacs 
keybindings are suggestions, not set in stone.

I realize gud-mode is big, and that it provides keybindings beyond the 
standard C-c C-char range that most modes use. But I hope that its 
robustness can be improved, providing C-x C-a rather than depending on it, 
so that it loads and runs even if users have redefined the C-x C-a key in 
their .emacs file.

Cheers,

Arni

On Mon, 26 Apr 2010, Dmitry Dzhus wrote:

> Arni Magnusson wrote:
>
>> When there is no .emacs file, M-x gdb works fine.
>>
>> When the .emacs file defines a keybinding for C-x C-a, for example,
>>
>>   (global-set-key [?\C-x ?\C-a] 'align)
>>
>> then M-x gdb crashes with the following error message:
>>
>>   Key sequence C-x C-a C-l starts with non-prefix key C-x C-a
>
>
> C-x C-a is GUD prefix. gdb-mi.el is based on GUD, so it uses its 
> keybindings too.
>
>> The Emacs documentation indicates that users are allowed to bind C-x C- 
>> keystrokes to functions that they use in their work.
>
> Which section of Emacs manual says that?
>
> `C-c LETTER` keyspace is reserved for users' needs, as stated in section 
> D.2 Key binding conventions of Emacs Lisp manual.
>
> You can type C-x C-h and see that pretty much of C-x C- keychords are 
> already occupied by default global bindings.
>
> --
>
> Happy Hacking.
>