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.
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?
Update: 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
:
#!/bin/sh 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!
February 24, 2007 at 12:45 am
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!
February 24, 2007 at 2:19 am
Sure you know about the mozex plugin?
http://mozex.mozdev.org/
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.
Saludos.
February 24, 2007 at 4:29 am
Thanks!
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!
February 24, 2007 at 4:33 am
[…] 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. […]
February 24, 2007 at 2:59 pm
[…] Link Original: Emacs-friendly Firefox « minor emacs wizardry […]
February 24, 2007 at 4:36 pm
http://conkeror.mozdev.org/ — may be interesting for Emacs-Wizards as well.
February 24, 2007 at 6:26 pm
Add in another cheer for Conkeror; it’s hands-down my favourite extension, and fun to hack to boot!
February 24, 2007 at 9:19 pm
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.
February 24, 2007 at 11:23 pm
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.
February 24, 2007 at 11:43 pm
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
February 25, 2007 at 9:49 am
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.
February 25, 2007 at 11:50 am
[…] 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. […]
February 25, 2007 at 6:44 pm
I posted my mozex, shell script and emacs configuration for handling the mailto links at http://journal.wjsullivan.net/185095.html . Might be useful.
March 7, 2007 at 9:49 pm
ISO-8859-1 for those of us writing strange languages with wierd letters.
This plugin made my year!
August 8, 2007 at 9:11 pm
[…] to the anonymous coward that recently posted here (and also to minor Emacs wizardry) for spreading the good […]
March 22, 2008 at 7:37 pm
You should really take a look at the XULRunner App Conkeror… This is the future of webbrowers for us emacsers!
April 12, 2008 at 9:35 am
editing testing by emacs with it’s all text!
March 21, 2009 at 3:29 am
That is really cool and smart! Thanks for the tip! (I edited this response with my emacs).
I use GNU emacs 23.0.91.1 on my Windows XP box. The emacsclient seems not working for me. I use gnuclient.exe instead.
In .emacs, put:
(require ‘gnuserv)
(gnuserv-start)
(setq gnuserv-frame (selected-frame))
Also put
gnuclient.exe
gnuclientw.exe
gnudoit.exe
gnuserv.exe
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.