Editing Web Forms With a Real Editor

John Smathers 7/10/2004

One of the biggest drags about using web based applications is that graphical web browsers provide such lame interfaces for editing <textarea> fields. If you're used to the rich interface of an editor like Emacs, using web-based e-mail can feel pretty frustrating. A workaround for this that I have started using is the Mozex extension for the Mozilla web browser. Mozex adds an option to the right-click context menu, which allows you to pipe the textarea content to an external editor, such as Emacs. After editing, simply left-click in the textarea and the text is copied into place. The screenshots at http://mozex.mozdev.org/screenshots.html help to explain.

Installation

Mozex is an XPI package, that can be picked up at http://mozex.mozdev.org. See that page for instructions on how to install the XPI file.

Go Edit->Preferences->Mozex to configure the options.

Usage

Right-click in the textarea and go mozex->Edit Textarea. Your external editor will launch. Edit your text. Save the temporary file when finished. Left click in the textarea and your text will be copied into place.

Advanced Options

If you use Emacs a lot, it can be moderately annoying to open a separate Emacs window each time you use Mozex. You can use the emacsclient program to use an Emacs that is already running. (XEmacs users can do something similar using gnuserv/gnuclient, but I haven't worked out the setup details for that). There may be a simpler way to do this, but here's what I've been using:

Enjoy.


Note for Firefox 1.x users: Apparently the Mozex package hasn't been updated for newer versions of Firefox - it works fine, but you can't get to the settings page. There is probably a better workaround for this, but here is the hack that I am using.

Edit the prefs.js file (do not have firefox running while you make the changes):

~/.mozilla/firefox/xu2fextp.default/prefs.js

Add the following lines:

user_pref("mozex.command.aim", "");
user_pref("mozex.command.download", "");
user_pref("mozex.command.ed2k", "");
user_pref("mozex.command.ftp", "");
user_pref("mozex.command.irc", "");
user_pref("mozex.command.mailer", "");
user_pref("mozex.command.news", "");
user_pref("mozex.command.source", "");
user_pref("mozex.command.telnet", "");
user_pref("mozex.command.textarea", "/usr/local/bin/emacsclient.sh %t");
user_pref("mozex.general.tmpdir", "~/.mozilla-extras/mozex");
user_pref("mozex.intercept.ftp", false);
user_pref("mozex.intercept.irc", false);
user_pref("mozex.intercept.mailto", false);
user_pref("mozex.intercept.news", false);
user_pref("mozex.intercept.telnet", false);
user_pref("mozex.universal.command", "");
user_pref("mozex.universal.schemes", "");

Autoscroll

An unrelated note (I'm not sure where else to document this): if you use the Autoscroll feature, Firefox automatically pastes whatever is in the clipboard into the address bar every time you release the middle mouse button. This is like super annoying, and hopefully will be changed in a future Firefox release. To fix this, go to about:config, change the value of middlemouse.contentLoadURL to false, and your life will be much happier.