Subject: bug#6035: M-x gdb crashes

From: Lennart Borgman <[email-masked]>
Date: Tue, 6 Jul 2010 11:32:59 +0200

Ah, my bad, C-x C-char, I thought it was C-c C-char you were looking at.

C-c C-char is reserved for major modes only and should not be used by
minor modes AFAICS.

Yes, the manual says nothing about C-x. In my opinion it should, but
others disagreed in a recent discussion.

And yes, M-x gdb could use a global minor mode for the C-x C-a binding
to avoid the problem:

(define-key global-map "\C-x\C-a" (lambda () (interactive) (message
"C-x C-a here!!")))

(defvar my-test-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map "\C-x\C-a\C-l" (lambda () (interactive) (message
"C-x C-a C-l there!!")))
    (define-key map "\C-l" (lambda () (interactive) (message "C-l also!!")))
    map))

(define-minor-mode my-test-mode "Testing key binding"
  :global t
  )

On Tue, Jul 6, 2010 at 10:47 AM, Arni Magnusson <[email-masked]> wrote:
> C-c C-char: reserved for major and minor modes (source: elisp manual)
>
> C-x C-char: free game for anyone, potential tug-of-wars between users and
> modes, but no should pose no danger of crashing a mode (source: my
> interpretation and experience)
>
> Given the nature of Emacs, some tug-of-war of keybindings can be expected.
> Many of my mode hooks, for example, rebind M-n and M-p to what I like them
> to do, overriding what the mode author thought I might like. This is
> harmless, and has not crashed any mode. The elisp manual (23.2.2) allows
> major modes to use these and other keystrokes, but I'm sure many Emacs users
> have bound them to generic functions they find useful in all modes.
>
> We sound like lawyers here, but all I'm asking is whether it's easy to
> prevent M-x gdb from crashing if C-x C-a is bound. If it's not easy, then so
> be it; the current error message accurately describes the quirk.
>
> Cheers,
>
> Arni
>
>
>
> On Tue, 6 Jul 2010, Lennart Borgman wrote:
>
>> On Tue, Jul 6, 2010 at 2:27 AM, Arni Magnusson <[email-masked]> wrote:
>>>
>>> I can find no warning
>>> against redefining C-x C-char, such as C-x C-a.
>>
>> The elisp manual chapter mentioned before here
>>
>>  (info "(elisp) Key Binding Conventions")
>>
>> says that
>>
>>  * Sequences consisting of `C-c' followed by a control character or a
>>    digit are reserved for major modes.
>>
>> So it looks to me like GUD does follow that rule.
>>
>> Maybe the error message could include a link to that part of the elisp
>> manual, but that would rather be a general thing in Emacs, not
>> specific to GUD.
>>
>