This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 99403 - Emacs bindings should be 'C' instead of 'D' (e.g. control key always)
Summary: Emacs bindings should be 'C' instead of 'D' (e.g. control key always)
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Key bindings (show other bugs)
Version: 6.x
Hardware: Macintosh All
: P2 blocker (vote)
Assignee: Max Sauer
URL:
Keywords: REGRESSION
: 67006 104574 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-03-29 16:14 UTC by enebo
Modified: 2007-11-05 13:40 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description enebo 2007-03-29 16:14:53 UTC
It appears that emacs keybindings are specified with 'D' instead of 'C' (e.g.
D-P instead of C-P).  This ends up binding emacs keybindings to the command key
on MacOS instead of the control key.  I cannot think of one system where emacs
binds those keys to anything other than the control key.  The list of ones I
noticed that are wrong are:

Other->Insertion Point Backward: Ctrl+B
Other->Insertion Point Forward: Ctrl+F
Other->Insertion Point Up: Ctrl+P
Other->Insertion Point Down: Ctrl+N
Other->Insertion Point to Beginning of Line: Ctrl+A
Other->Insertion Point to End of Line: Ctrl+E
Edit->Delete Next Character: Ctrl+D 

It is possible I missed others, but theae are the ones I use all the time.
Comment 1 Vitezslav Stejskal 2007-04-11 04:15:11 UTC
I am sorry for a silly question, but are you sure this should be changed?
Comment 2 _ tboudreau 2007-04-11 06:32:45 UTC
Emacs keybindings should match emacs, period.  The only choice is to collect
emacs variants for mac and see how their keybindings work and compare them, and
know something about their popularity.  Emacs makes liberal use of META which is
Command on Mac OS, but the key arrangement on a Mac keyboard is different from a
PC.  The important thing is what are the majority of Mac-based-emacs users
really used to.

The point of D- bindings is to
a.  Get the common case right without anybody having to own a mac or think too
much about it
b.  Not accidentally bind things like Cmd-H and Cmd-Q which you can't actually
bind on a mac because the O/S will consume the keystrokes before they ever reach
the application
Comment 3 enebo 2007-04-11 16:22:14 UTC
I have used both the Carbon version of GNU Emacs and also Aquamacs and both use
Control key for these bindings.  I also have never used an emacs on any system
that did not use control by default.  I have used emacs on various Unix variants
and Windows as well and these keys have always used the control key.
Comment 4 chrispcampbell 2007-05-13 00:34:44 UTC
Can we please bump the priority on this issue?  I reported these same problems in the comments 
section of related issue 67006, but it's probably worth inlining them here as well:

----
I just tried the latest 6.0 dev build (200703291800) on Mac OS X (don't have another machine handy at 
the moment) and found that many of the Emacs keybindings are not correct at all.  For example:
    Other / Cut from insertion point to line end  ---->  [Meta+K]  (this should be [Ctrl+K])
    Other / Delete next word ----> [Ctrl+D] (this binding is usually for "Edit / Delete next character")
    Other / Insertion point to beginning of line ----> [Meta+A] (this should be [Ctrl+A])
    Go To / Go to line... ----> [Ctrl+G] (this is usually [Meta+G], I believe)

This is just a small sample that I noticed.  I'm not enough an Emacs power user, so I don't know all the 
keybindings, but I do know that the ones above are incorrect.  So it's good to see that the keybindings 
interface now exposes things that were previously missing (such as "Cut from insertion point to..."), but 
the bindings are still incorrect for a number of them.
----

I've verified that this issue is still unresolved as of 6.0 M9.  This is a clear regression from NB 5.x... I 
won't be spending much time testing the NB 6.0 milestones until this issue is fixed (that is, until the 
Emacs keybindings are restored with the proper Ctrl+* bindings as they were in NB 5.5 and earlier).  
Yes, they're that important to me :)
Comment 5 Miloslav Metelka 2007-05-14 12:21:15 UTC
As a regression against 5.5 marking as P2.
Comment 6 Petr Hrebejk 2007-08-13 17:50:44 UTC
OK looks like the emacs keybindings should be C instead of D in order to get them correct. This means that Max has to
revert the changes done Emacs-keybindings in ide/defaults from version 1.18 to 1.19. And it also means that people using
daily builds and emacs keybindings will get some warnings in console about using D instead of C in key bindings
definitions. 

Reassigning to Max.
Comment 7 _ tboudreau 2007-08-13 20:42:15 UTC
Presumably Alt bindings should be Meta (Command) in Emacs, since Emacs makes real use of the meta key (but maps it to alt on poor PCs that don't have a 
meta key [well, some do, it's that windows menu key but windows will eat it]).

Cc'ing Jesse as our resident emacs guru.
Comment 8 Jesse Glick 2007-08-13 21:18:51 UTC
I suppose Ctrl- on all platforms is correct, or so says enebo.

Emacs may call the key "Meta" but Java considers it plain old Alt.
Comment 9 enebo 2007-08-13 21:18:51 UTC
Though I didn't put this in this bug, All emacs implementations also allow all meta bindings to also be escape bindings
for platforms that do not have a proper meta key.  Since I have been using emacs I have used escape since I began on
hardware which lacked this key.

I am sure I am not the only emacs user who uses escape instead of meta.
Comment 10 _ tboudreau 2007-08-14 03:36:01 UTC
Well, except on Mac OS, where you have a real meta key called the Command key...and an Alt key you can't use for accelerators...

Isn't this fun?
Comment 11 enebo 2007-08-14 16:14:29 UTC
I should have phrased my last comment as all platforms whether they have a meta key or not also allow escape key bindings.

Meta-F is also bound as ESC F for example.

I sure keybindings are the love and joy of netbeans engineers everywhere :)
Comment 12 chrispcampbell 2007-08-14 18:57:31 UTC
>> I am sure I am not the only emacs user who uses escape instead of meta.

Yep, I do too, on machines where the meta key isn't properly configured, or otherwise not available.

On Mac keyboards (with the "Command" key) it would be nice if NetBeans properly mapped that
to mean "Meta", since that's most natural.  However, I agree with enebo that it would be nice if
NetBeans automatically treated ESC-W and META-W as being identical, for example.  In other words,
the two should be interchangeable without requiring users to manually hack the keybindings
options in NetBeans to get this behavior.
Comment 13 Vitezslav Stejskal 2007-08-20 12:40:42 UTC
*** Issue 104574 has been marked as a duplicate of this issue. ***
Comment 14 Max Sauer 2007-08-28 14:25:44 UTC
I've changed all C's to D's. Please verify. As for the meta key, please file an enhancement and describe how it should
work, thanks. 
---
Checking in Emacs-keybindings.xml;
/cvs/ide/defaults/src/org/netbeans/modules/defaults/Emacs-keybindings.xml,v  <--  Emacs-keybindings.xml
new revision: 1.24; previous revision: 1.23
done
IDE: [8/28/07 3:22 PM] Committing "Emacs-keybindings.xml" finished
Comment 15 chrispcampbell 2007-08-30 19:42:56 UTC
Thanks for fixing this.  I've verified that many keybindings are now working properly again as Ctrl+*.

However, there are still a number of incorrect mappings, as mentioned in an earlier comment.
I've decided to file these as a new defect so that they will be addressed separately; see 114278:
http://www.netbeans.org/issues/show_bug.cgi?id=114278

In that bug report I've listed some inconsistencies that I've found in a short amount of time;
there are likely many others, so please, for those emacs users listening here, please look at
that bug report and add any other incorrect bindings that you may have found.

Also, I've filed a separate enhancement for the Meta/ESC issue that both enebo and I were
discussing here; see 114281:
http://www.netbeans.org/issues/show_bug.cgi?id=114281
Comment 16 chrispcampbell 2007-08-30 19:47:44 UTC
*** Issue 67006 has been marked as a duplicate of this issue. ***