MozillaZine

Emacs keybindings

Talk about the native Mac OS X browser.

Moderator: Camino Developers

andykim78
 
Posts: 2
Joined: September 19th, 2004, 2:03 am

Post Posted February 16th, 2006, 6:46 pm

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?

cflawson

User avatar
 
Posts: 4721
Joined: December 26th, 2004, 2:54 pm
Location: Flying over your house in a red, white, and blue jet

Post Posted February 16th, 2006, 6:48 pm

Which version of Camino?

This should be fixed on trunk. See

https://bugzilla.mozilla.org/show_bug.cgi?id=229473

for more details.

cl

hedrick
 
Posts: 8
Joined: March 8th, 2006, 5:14 pm

Post Posted March 8th, 2006, 5:24 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).

cflawson

User avatar
 
Posts: 4721
Joined: December 26th, 2004, 2:54 pm
Location: Flying over your house in a red, white, and blue jet

Post Posted March 8th, 2006, 6:53 pm

See the second post in this thread.

cl

TXLogic
 
Posts: 1
Joined: April 19th, 2006, 11:22 am

Post Posted April 19th, 2006, 11:27 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

sigsegv
 
Posts: 11
Joined: October 17th, 2003, 10:21 pm

Post Posted June 11th, 2006, 11:36 am

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.]

froodiantherapy
Camino Developer

User avatar
 
Posts: 732
Joined: June 11th, 2005, 8:44 am
Location: Massachusetts, Connecticut

Post Posted June 11th, 2006, 12:34 pm

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>

sigsegv
 
Posts: 11
Joined: October 17th, 2003, 10:21 pm

Post Posted June 11th, 2006, 12:49 pm

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

sigsegv
 
Posts: 11
Joined: October 17th, 2003, 10:21 pm

Post Posted June 11th, 2006, 1:08 pm

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

User avatar
 
Posts: 3957
Joined: July 24th, 2004, 1:38 pm
Location: بين العالمين

Post Posted June 12th, 2006, 12:00 am

These bindings will be in Camino 1.1 by default, too, against the better judgement of many :P
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 FAQSearch the Forum  Camino. HelpTroubleshoot Camino

dougalcorn
 
Posts: 1
Joined: January 23rd, 2007, 10:16 am

Post Posted January 23rd, 2007, 10:22 am

so i followed the steps above and it mostly works with two (or three) exceptions:

  1. 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.
  2. 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

User avatar
 
Posts: 3957
Joined: July 24th, 2004, 1:38 pm
Location: بين العالمين

Post Posted January 23rd, 2007, 12:12 pm

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....
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 FAQSearch the Forum  Camino. HelpTroubleshoot Camino

cflawson

User avatar
 
Posts: 4721
Joined: December 26th, 2004, 2:54 pm
Location: Flying over your house in a red, white, and blue jet

Post Posted January 23rd, 2007, 4:38 pm

There's also the possibly related <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=185751">bug 185751</a>.

(There are several weird keybindings bugs in Gecko still.)

cl

Return to Camino


Who is online

Users browsing this forum: No registered users and 0 guests