Emacs-friendly Firefox

When i use Firefox, there’s nothing more annoying than editing a textarea. On a Mac, one has at least some Emacs-like shortcuts. Incomprehensibly, on GTK+ 2.0 Emacs shortcuts are no longer the default, and one has to put something like

include "/usr/share/themes/Emacs/gtk-2.0-key/gtkrc"

in ~/.gtkrc-2.0 to restore a minimum of sanity.

It's All Text!But still, what i really want is to edit those textareas using the real thing. I just stumbled upon the answer to my prayers: It’s All Text! is a Firefox add-on that provides an edit button on any text box. You click on it and, the first time, you’re asked for your editor of choice. As you’ll notice, the default option is wrong. Change it by /usr/bin/emacsclient (Emacs 21 users may use gnuclient instead), and don’t forget to start the Emacs server with (server-start) somewhere in your initialisation file.

Better, no?

MozexUpdate: Well, things can be even better, as pointed out by Victor below. The Mozex extension lets you not only edit textareas, but also assign shortcuts, view sources or choose the editor for mailto URLs. For some reason, using just emacsclient -e '(compose-mail "%a" "%s")' didn’t work for me, so i’ve created a simple shell script, gnumail:

    exec emacsclient -e "(compose-mail \"$1\" \"$2\")"

and told Mozex to use it. Don’t forget to set the variable mail-user-agent to something reasonable (for instance, since i use Gnus, i’ve got (setq mail-user-agent 'gnus-user-agent) in my configuration files).

Thanks, Victor!


18 Responses to “Emacs-friendly Firefox”

  1. Mark Simpson Says:

    Yes, this firefox extension is the best thing since the proverbial ‘sliced bread’. Now if i can just get gnuserv/emacsclient working on my work Windows XP machine!

  2. Víctor Rodríguez Says:

    Sure you know about the mozex plugin?


    You might find mozex more convenient, since you can configure it t o use Emacs not just to edit text areas, but also to view sources. Moreover, you can configure a shortcut to activate it, so as soon as you are confronted with a text area, hit your shortcut and listo! you in Emacs.


  3. Samuel Tardieu Says:


    I just can’t understand why the default is 7 seconds while it could be 1 (polling at 1 second interval doesn’t eat much CPU).

    Anyway, this is most convenient!

  4. Dr Jekyll & Mr Hyde » Blog Archive » Emacs Says:

    […] This Firefox extension called “It’s All Text!” might be the best thing since sliced bread: it adds an “Edit” button to any textarea component which, when clicked, opens your favourite text editor. […]

  5. Emacs-friendly Firefox « minor emacs wizardry « Gatika Says:

    […] Link Original: Emacs-friendly Firefox « minor emacs wizardry […]

  6. Tom Says:

    http://conkeror.mozdev.org/ — may be interesting for Emacs-Wizards as well.

  7. Phil Says:

    Add in another cheer for Conkeror; it’s hands-down my favourite extension, and fun to hack to boot!

  8. Jos'h Says:

    You should also look at the FireFox “View Source With” extension. You can set it to launch Emacs whenever you Ctrl-U. If you’re in a textbox, it will bring Emacs up with the box text. Otherwise, you get the page source. A nice thing about that when you’re working on something locally is that it brings up the actual source file for the page and you can change it, save then reload in FireFox.

  9. Ryan Says:

    Good tip. The mozex extension didn’t seem to work for me on OS X, and the mozex faq claims it’s just an “ugly hack” that needs to go away. I stuck with the All Text extension. I use Carbon Emacs. The extension prefs didn’t allow me to dive into the Emacs.app package to find emacsclient and the text field was read-only, so I performed the following:

    1) Open about:config in Firefox
    2) Find the “extensions.itsalltext.editor” key
    3) Manually set it to “/Applications/Emacs.app/Contents/MacOS/bin/emacsclient”
    4) Make sure (server-start) is in emacs init (of course).

    Worked after that.

  10. brad walker Says:

    mozev doesn’t escape command strings and appears to have problems with quotes around more than one substitution sequence. here’s another possible gnus command w/o a script, but probably can’t handle more than the subject substitution:

    emacsclient -e “(compose-mail (symbol-name ‘%a) “%s”)”

    p.s. the ‘debugging messages’ feature under mozex’s preference ‘General’ helps much when composing these incantations

  11. Andreas Says:

    You can also just say: gtk-key-theme-name = “Emacs” in your .gtkrc-2.0
    file and do not bother about finding the right path to your include file.

  12. Shazbot Blog » Blog Archive » minor emacs wizardry Says:

    […] Just noticed this emacs blog. Now as any fool knows, emacs is the one true editor, vi being better suited for editing passwd files or similar, and should never be allowed near code (my colleague Hampus strongly agrees on this point). This is an interesting post too: Emacs-friendly Firefox. […]

  13. John Sullivan Says:

    I posted my mozex, shell script and emacs configuration for handling the mailto links at http://journal.wjsullivan.net/185095.html . Might be useful.

  14. klang Says:

    ISO-8859-1 for those of us writing strange languages with wierd letters.

    This plugin made my year!

  15. Close, but no Cigar: Jasspa MicroEmacs with “It’s All Text!” on Firefox [on Windows] « Learning Lisp Says:

    […] to the anonymous coward that recently posted here (and also to minor Emacs wizardry) for spreading the good […]

  16. Christian Says:

    You should really take a look at the XULRunner App Conkeror… This is the future of webbrowers for us emacsers!

  17. tom Says:

    editing testing by emacs with it’s all text!

  18. Da Zhang Says:

    That is really cool and smart! Thanks for the tip! (I edited this response with my emacs).

    I use GNU emacs on my Windows XP box. The emacsclient seems not working for me. I use gnuclient.exe instead.

    In .emacs, put:
    (require ‘gnuserv)
    (setq gnuserv-frame (selected-frame))

    Also put
    into your emacs install directory, e.g., C:\Program Files\emacs\bin, which should also be in your PATH for convenience.

    Then gnuclient should be fine.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: