* bug#6035: M-x gdb crashes @ 2010-04-26 1:37 Arni Magnusson 2010-04-26 18:54 ` Dmitry Dzhus 2010-07-06 0:27 ` Arni Magnusson 0 siblings, 2 replies; 7+ messages in thread From: Arni Magnusson @ 2010-04-26 1:37 UTC (permalink / raw) To: 6035 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#6035: M-x gdb crashes 2010-04-26 1:37 bug#6035: M-x gdb crashes Arni Magnusson @ 2010-04-26 18:54 ` Dmitry Dzhus 2010-07-06 0:27 ` Arni Magnusson 1 sibling, 0 replies; 7+ messages in thread From: Dmitry Dzhus @ 2010-04-26 18:54 UTC (permalink / raw) To: bug-gnu-emacs 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 む ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#6035: M-x gdb crashes 2010-04-26 1:37 bug#6035: M-x gdb crashes Arni Magnusson 2010-04-26 18:54 ` Dmitry Dzhus @ 2010-07-06 0:27 ` Arni Magnusson 2010-07-06 1:06 ` Lennart Borgman 1 sibling, 1 reply; 7+ messages in thread From: Arni Magnusson @ 2010-07-06 0:27 UTC (permalink / raw) To: 6035, Dmitry Dzhus 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. > ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#6035: M-x gdb crashes 2010-07-06 0:27 ` Arni Magnusson @ 2010-07-06 1:06 ` Lennart Borgman 2010-07-06 8:47 ` Arni Magnusson 0 siblings, 1 reply; 7+ messages in thread From: Lennart Borgman @ 2010-07-06 1:06 UTC (permalink / raw) To: Arni Magnusson; +Cc: 6035, Dmitry Dzhus On Tue, Jul 6, 2010 at 2:27 AM, Arni Magnusson <arnima@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. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#6035: M-x gdb crashes 2010-07-06 1:06 ` Lennart Borgman @ 2010-07-06 8:47 ` Arni Magnusson 2010-07-06 9:32 ` Lennart Borgman 0 siblings, 1 reply; 7+ messages in thread From: Arni Magnusson @ 2010-07-06 8:47 UTC (permalink / raw) To: Lennart Borgman; +Cc: 6035, Dmitry Dzhus 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@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. > ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#6035: M-x gdb crashes 2010-07-06 8:47 ` Arni Magnusson @ 2010-07-06 9:32 ` Lennart Borgman 2021-12-04 20:47 ` bug#6035: gud-key-prefix Lars Ingebrigtsen 0 siblings, 1 reply; 7+ messages in thread From: Lennart Borgman @ 2010-07-06 9:32 UTC (permalink / raw) To: Arni Magnusson; +Cc: 6035, Dmitry Dzhus 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@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@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. >> > ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#6035: gud-key-prefix 2010-07-06 9:32 ` Lennart Borgman @ 2021-12-04 20:47 ` Lars Ingebrigtsen 0 siblings, 0 replies; 7+ messages in thread From: Lars Ingebrigtsen @ 2021-12-04 20:47 UTC (permalink / raw) To: Lennart Borgman; +Cc: Arni Magnusson, 6035, Dmitry Dzhus (I'm going through old bug reports that unfortunately weren't resolved at the time.) Lennart Borgman <lennart.borgman@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 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-12-04 20:47 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-04-26 1:37 bug#6035: M-x gdb crashes Arni Magnusson 2010-04-26 18:54 ` Dmitry Dzhus 2010-07-06 0:27 ` Arni Magnusson 2010-07-06 1:06 ` Lennart Borgman 2010-07-06 8:47 ` Arni Magnusson 2010-07-06 9:32 ` Lennart Borgman 2021-12-04 20:47 ` bug#6035: gud-key-prefix Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).