Emacs keybindings
Moderator: Camino Developers
-
- Posts: 2
- Joined: September 19th, 2004, 2:03 am
Emacs keybindings
Is there a way to enable Emacs keybinding support in Camino again?
This used to work, but it doesn't anymore. I even tried putting the binding settings in ~/Library/KeyBindings/DefaultKeyBinding.dict but Camino is the only Cocoa app that ignores that.
Any thoughts on this anyone?
This used to work, but it doesn't anymore. I even tried putting the binding settings in ~/Library/KeyBindings/DefaultKeyBinding.dict but Camino is the only Cocoa app that ignores that.
Any thoughts on this anyone?
- cflawson
- Posts: 4721
- Joined: December 26th, 2004, 2:54 pm
- Location: Flying over your house in a red, white, and blue jet
- Contact:
Which version of Camino?
This should be fixed on trunk. See
https://bugzilla.mozilla.org/show_bug.cgi?id=229473
for more details.
cl
This should be fixed on trunk. See
https://bugzilla.mozilla.org/show_bug.cgi?id=229473
for more details.
cl
-
- Posts: 8
- Joined: March 8th, 2006, 5:14 pm
emacs bindings work fine. You just have to know where to put them. However I still don't understand why all the Mozilla-based applications make this so hard to do. This is a really common request, particularly on the Mac, where emacs editing is the default for native applications.
cd /Applications/Camino.app/Contents/MacOS/chrome
jar xf embed.jar content/global/platformHTMLBindings.xml
emacs content/global/platformHTMLBindings.xml
jar uf embed.jar content/global/platformHTMLBindings.xml
Now, as to what you do when you emacs the file. Add the following after the <handler> in 3 places: inputFields, textAreas, and editor. For the first, you only need the single-line commands, i.e. the first section below.
<!-- Emacsish single-line motion and delete keys -->
<handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
<handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
<handler event="keypress" id="key_left" key="b" modifiers="control" command="cmd_charPrevious"/>
<handler event="keypress" id="key_right" key="f" modifiers="control" command="cmd_charNext"/>
<handler event="keypress" id="key_delback" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
<handler event="keypress" id="key_delforw" key="d" modifiers="control" command="cmd_deleteCharForward"/>
<handler event="keypress" id="key_delwback" key="w" modifiers="control" command="cmd_deleteWordBackward"/>
<handler event="keypress" id="key_del_bol" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
<handler event="keypress" id="key_del_eol" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>
<!-- Emacsish multi-line motion and delete keys -->
<handler event="keypress" id="key_linedown" key="n" modifiers="control" command="cmd_lineNext"/>
<handler event="keypress" id="key_lineup" key="p" modifiers="control" command="cmd_linePrevious"/>
Incidentally the same instructions work for Firefox and Thunderbird, except that you use toolkit.jar rather than the embed.jar. In addition to this, depending upon OS you sometimes have to change hidden preferences so that control isn't stolen as the accelerator key. And of course on Linux you use gconf-editor or edit .gtkrc-2.0 (depending upon version of Gnome).
cd /Applications/Camino.app/Contents/MacOS/chrome
jar xf embed.jar content/global/platformHTMLBindings.xml
emacs content/global/platformHTMLBindings.xml
jar uf embed.jar content/global/platformHTMLBindings.xml
Now, as to what you do when you emacs the file. Add the following after the <handler> in 3 places: inputFields, textAreas, and editor. For the first, you only need the single-line commands, i.e. the first section below.
<!-- Emacsish single-line motion and delete keys -->
<handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
<handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
<handler event="keypress" id="key_left" key="b" modifiers="control" command="cmd_charPrevious"/>
<handler event="keypress" id="key_right" key="f" modifiers="control" command="cmd_charNext"/>
<handler event="keypress" id="key_delback" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
<handler event="keypress" id="key_delforw" key="d" modifiers="control" command="cmd_deleteCharForward"/>
<handler event="keypress" id="key_delwback" key="w" modifiers="control" command="cmd_deleteWordBackward"/>
<handler event="keypress" id="key_del_bol" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
<handler event="keypress" id="key_del_eol" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>
<!-- Emacsish multi-line motion and delete keys -->
<handler event="keypress" id="key_linedown" key="n" modifiers="control" command="cmd_lineNext"/>
<handler event="keypress" id="key_lineup" key="p" modifiers="control" command="cmd_linePrevious"/>
Incidentally the same instructions work for Firefox and Thunderbird, except that you use toolkit.jar rather than the embed.jar. In addition to this, depending upon OS you sometimes have to change hidden preferences so that control isn't stolen as the accelerator key. And of course on Linux you use gconf-editor or edit .gtkrc-2.0 (depending upon version of Gnome).
- cflawson
- Posts: 4721
- Joined: December 26th, 2004, 2:54 pm
- Location: Flying over your house in a red, white, and blue jet
- Contact:
-
- Posts: 1
- Joined: April 19th, 2006, 11:22 am
hedrick wrote:...
Incidentally the same instructions work for Firefox and Thunderbird, except that you use toolkit.jar rather than the embed.jar.
Unfortunately, they don't work in Thunderbird (1.5) in the unix/FreeBSD versions. (Curiously, they do work under OS X, I believe.) Thunderbird still steals such emacs essentials as Ctrl-f, Ctrl-b, Ctrl-n and Ctrl-p. Very frustrating.
txlogic
-
- Posts: 11
- Joined: October 17th, 2003, 10:21 pm
Simple script to add these bindings
I've written a Pyton script to add these bindings to whichever Mozilla-based app you want. (Well, I think it's whichever. I've tested with Firefox, Thunderbird, and the Intel OS X-optimized Firefox being called DeerPark.) The script is here: http://toscano.org/~pete/blog/archives/105. You give it one argument: the name of the app you want to update. For example, say you want to add these bindings to Firefox. Run ./addemacsbindings.py Firefox. It'll do everything else, including backing up your toolkit.jar file to toolkit.jar-backup-<timestamp>.
Please let me know if you have any problems with it.
-sig
[UPDATE: I should add that it's only for OS X.]
Please let me know if you have any problems with it.
-sig
[UPDATE: I should add that it's only for OS X.]
- froodiantherapy
- Camino Developer
- Posts: 732
- Joined: June 11th, 2005, 8:44 am
- Location: Massachusetts, Connecticut
- Contact:
Re: Simple script to add these bindings
sigsegv wrote:[UPDATE: I should add that it's only for OS X.]
Not really. This is a Camino forum, and camino only runs on OS X, so...
"Also, I can kill you with my brain."
10.4.x iBook G4 1.33 GHz
<a href="http://www.jonagold.org/~froodian/MoreCamino/">MoreCamino - More preferences for Camino</a>
10.4.x iBook G4 1.33 GHz
<a href="http://www.jonagold.org/~froodian/MoreCamino/">MoreCamino - More preferences for Camino</a>
-
- Posts: 11
- Joined: October 17th, 2003, 10:21 pm
Re: Simple script to add these bindings
froodiantherapy wrote:sigsegv wrote:[UPDATE: I should add that it's only for OS X.]
Not really. This is a Camino forum, and camino only runs on OS X, so...
Um, d'oh! I had forgotten that. This doesn't work with Camino. Yet. I feel that, due to my own stupidity, the least I could do is try to get it working there too. I don't think it'll be too tough. Give me a few and I'll post back here with an update.
-sig
-
- Posts: 11
- Joined: October 17th, 2003, 10:21 pm
Re: Simple script to add these bindings
sigsegv wrote:Um, d'oh! I had forgotten that. This doesn't work with Camino. Yet. I feel that, due to my own stupidity, the least I could do is try to get it working there too. I don't think it'll be too tough. Give me a few and I'll post back here with an update.
Should be fixed now. Sorry.
-sig
- Uncle Asad
- Camino Developer
- Posts: 3957
- Joined: July 24th, 2004, 1:38 pm
- Location: بين العالمين
- Contact:
These bindings will be in Camino 1.1 by default, too, against the better judgement of many
Mac OS X 10.3.9 • PowerBook G4 17" 1.33 GHz | Mac OS X 10.5.x • MacBook Pro 15" 2.2 GHz
Snow7's Camino Forum FAQ Search the Forum Camino. Help Troubleshoot Camino
Snow7's Camino Forum FAQ Search the Forum Camino. Help Troubleshoot Camino
-
- Posts: 1
- Joined: January 23rd, 2007, 10:16 am
- Contact:
keybindings not quite right
so i followed the steps above and it mostly works with two (or three) exceptions:
- cntrl-f is the emacs key-binding for forward-char. The above seems to bind this, but in camino nightly build 2007012202 (1.1a2+) control-f moves me to the first input field on the page and not forward-char.
- There are no bindings for forward-word or backward-word. I tried adding the following with no success:
Code: Select all
<handler event="keypress" id="word_left" key="b" modifiers="alt" command="cmd_wordPrevious"/> <handler event="keypress" id="word_left" key="f" modifiers="alt" command="cmd_wordNext"/>
- Uncle Asad
- Camino Developer
- Posts: 3957
- Joined: July 24th, 2004, 1:38 pm
- Location: بين العالمين
- Contact:
1. Make sure you're not on a page with access keys defined; they'll override any other bindings.
2. This is probably either bug 348271 or bug 282097
There's a way to configure Gecko to do Mac keybindings right (mentioned in the latter bug), but no one's written the code to do it....
2. This is probably either bug 348271 or bug 282097
There's a way to configure Gecko to do Mac keybindings right (mentioned in the latter bug), but no one's written the code to do it....
Mac OS X 10.3.9 • PowerBook G4 17" 1.33 GHz | Mac OS X 10.5.x • MacBook Pro 15" 2.2 GHz
Snow7's Camino Forum FAQ Search the Forum Camino. Help Troubleshoot Camino
Snow7's Camino Forum FAQ Search the Forum Camino. Help Troubleshoot Camino
- cflawson
- Posts: 4721
- Joined: December 26th, 2004, 2:54 pm
- Location: Flying over your house in a red, white, and blue jet
- Contact: