GNU bug report logs - #6035
gud-key-prefix

Previous Next

Package: emacs;

Reported by: Arni Magnusson <arnima <at> hafro.is>

Date: Mon, 26 Apr 2010 01:38:02 UTC

Severity: minor

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6035 in the body.
You can then email your comments to 6035 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6035; Package emacs. (Mon, 26 Apr 2010 01:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arni Magnusson <arnima <at> hafro.is>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 26 Apr 2010 01:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arni Magnusson <arnima <at> hafro.is>
To: bug-gnu-emacs <at> gnu.org
Subject: M-x gdb crashes
Date: Mon, 26 Apr 2010 01:37:35 +0000 (GMT)
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

The Emacs documentation indicates that users are allowed to bind C-x C- 
keystrokes to functions that they use in their work. Most likely, M-x gdb 
can be implemented so that it doesn't crash with the above example.

Arni





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6035; Package emacs. (Mon, 26 Apr 2010 18:59:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Dzhus <dima <at> sphinx.net.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#6035: M-x gdb crashes
Date: Mon, 26 Apr 2010 22:54:48 +0400
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.

http://sphinx.net.ru

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6035; Package emacs. (Tue, 06 Jul 2010 00:28:01 GMT) Full text and rfc822 format available.

Message #11 received at 6035 <at> debbugs.gnu.org (full text, mbox):

From: Arni Magnusson <arnima <at> hafro.is>
To: 6035 <at> debbugs.gnu.org, Dmitry Dzhus <dima <at> sphinx.net.ru>
Subject: Re: M-x gdb crashes
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.
>




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6035; Package emacs. (Tue, 06 Jul 2010 01:08:02 GMT) Full text and rfc822 format available.

Message #14 received at 6035 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Arni Magnusson <arnima <at> hafro.is>
Cc: 6035 <at> debbugs.gnu.org, Dmitry Dzhus <dima <at> sphinx.net.ru>
Subject: Re: bug#6035: M-x gdb crashes
Date: Tue, 6 Jul 2010 03:06:58 +0200
On Tue, Jul 6, 2010 at 2:27 AM, Arni Magnusson <arnima <at> hafro.is> 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.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6035; Package emacs. (Tue, 06 Jul 2010 08:48:01 GMT) Full text and rfc822 format available.

Message #17 received at 6035 <at> debbugs.gnu.org (full text, mbox):

From: Arni Magnusson <arnima <at> hafro.is>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 6035 <at> debbugs.gnu.org, Dmitry Dzhus <dima <at> sphinx.net.ru>
Subject: Re: bug#6035: M-x gdb crashes
Date: Tue, 6 Jul 2010 08:47:20 +0000 (GMT)
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 <arnima <at> hafro.is> 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.
>




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6035; Package emacs. (Tue, 06 Jul 2010 09:34:02 GMT) Full text and rfc822 format available.

Message #20 received at 6035 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Arni Magnusson <arnima <at> hafro.is>
Cc: 6035 <at> debbugs.gnu.org, Dmitry Dzhus <dima <at> sphinx.net.ru>
Subject: Re: bug#6035: M-x gdb crashes
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 <arnima <at> hafro.is> 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 <arnima <at> hafro.is> 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.
>>
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6035; Package emacs. (Sat, 04 Dec 2021 20:48:01 GMT) Full text and rfc822 format available.

Message #23 received at 6035 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: Arni Magnusson <arnima <at> hafro.is>, 6035 <at> debbugs.gnu.org,
 Dmitry Dzhus <dima <at> sphinx.net.ru>
Subject: Re: bug#6035: gud-key-prefix
Date: Sat, 04 Dec 2021 21:47:05 +0100
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

Lennart Borgman <lennart.borgman <at> gmail.com> writes:

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

Yes, there's no rules for binding things under `C-x' -- the users can do
that, but modes are free to bind them, too, which is what gdb does.

> 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!!")))

I don't think a mode here is necessary -- just defining a submap the
normal way should be sufficient.  So I've now done that in Emacs 29,
which makes the test case no longer bug out.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 6035 <at> debbugs.gnu.org and Arni Magnusson <arnima <at> hafro.is> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 04 Dec 2021 20:48:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 02 Jan 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.