mozdev.org

electrix    

resources:
Status
  • Should work on Win32,Linux, and OS X.

Summary

Electrix is out of date. mozex has a large superset of the functionality electrix brings, and is much more sophisticated.

Electrix is a mozilla extension to for editing textares in external editors. For documentation, please see http://reddleman.org/site/projects/electrix/index.htm for now.

Prerequisites

You currently need either Win32, OS X, or Linux and Mozilla 1.3 to run Electrix. All other combinations are untested. Please test if you have the time and send reports back. These are highly welcome.

User Notes: [?]

If you do not get a response to a question posted in this forum, please try sending a message to the project's mailing list or to the project owner directly.

[1] Submitted by: kyber on Monday April 21st 2003

electrix was failing for me until I changed the /Win32.+/ test to /Win32/
navigator.platform = "Win32" on my system

Otherwise, electrix_fsep was getting set to /

[2] Submitted by: kyber on Monday April 21st 2003

Also, it might be nice to be able to invoke multiple external editors for separate text areas, and not have the external editor suspend Mozilla until it returns.
Not on a unix system, and unfamiliar with windows and Javascript, but offhand it doesn't seem like a safe method of getting a tempfile is being used.
Nonetheless, this is a convenient little extension.
Thanks!

[3] Submitted by: Ben Peter on Wednesday April 23rd 2003

Thanks for the hint, the Win32 test is in the new 0.3 release.

The tempfile method should be safe, if the XPCom LocalFile.createUnique() is safe, which I assume.

Not having the editor suspend mozilla is not easy - you would have to watch either the spawned process, but this would require the editor to signal back to moz when it's done, or the file, but for how long? Any suggestions welcome.

[4] Submitted by: Kyber on Friday April 25th 2003

Ah. Yep, you're using a nice safe temp file request method.
Been recommending this to various people. The S.O. uses it with WordPerfect on her Windows machine to allow her to easily spellcheck, and as a protection against form submissions gone wrong (the no delete option).
Co-workers are actually finding this a reason to use Mozilla at work.
Have another puzzler, though.
After installing on my machine, it seems to fire /usr/bin/gvim, create the tempfile, allow me to edit the tempfile, but the textarea never gets set to the contents of the file, nor does the file get removed (with removal enabled).

When I stepped through it in Venkman, though, it worked fine! Very strange. Again, not terribly familiar with Javascript or the mozilla methods you're invoking, but can't imagine what the difference would be. Some timing issue?

Will keep looking at it. Any ideas?

[5] Submitted by: Kyber on Friday April 25th 2003

Ah. Interesting.
With my setup it seems it is invoking the editor, but mozilla does not suspend. Either when debugging, or without.
Not a good sign I imagine.

[6] Submitted by: Kyber on Friday April 25th 2003

Ok, all makes sense - especially after considering what you pointed out about problems with not suspending. :)
For some reason, perhaps my version of Mozilla, it isn't suspending.
So when I don't breakpoint, it zips right through it.
When I breakpoint, I give myself time to edit.
A few experiments with editing, not editing, writing the file after it had gone through and such verified.

Alright, now to find out why:
Components.classes["@mozilla.org/process/util;1"]
- 180 .getService(Components.interfaces.nsIProcess);

This ain't doing what it does for you.

[7] Submitted by: Kyber on Friday April 25th 2003

Oh, ideas for multiple edits.
Watching spawned process.
Works for me. Simply have it loop around, checking on the process until it no longer exists. This operates on the assumption that the edit is finished when the process is. What's the problem there?

Watching the file.
Electrix could keep the file synched with the dialog box.
Either update the textarea from the file every half a second or so, or update the textarea from the file every time the file's modification timestamp changes. Heck, can that be made an event that signals Electrix?

Or, if possible, can Electrix spawn startEmacs() in a new thread? If so, that thread can wait until the process is complete before continuing without interrupting the rest of the program.

Ok, back to finding out why it isn't working for me.

[8] Submitted by: Jens on Tuesday April 29th 2003

Tested on Sparc Solaris, works. TUVM!

[9] Submitted by: Ben on Tuesday April 29th 2003

Kyber: gvim will not work, as it spaws a new process and immediately returns. Porque will think it has finished editing.

[10] Submitted by: Ben on Tuesday April 29th 2003

Jens, can you give me more details on the Solaris and Mozilla version? I'll include it on the site then.

Thanks,
Ben

[11] Submitted by: Jens on Tuesday April 29th 2003

I installed and tested it on some weeks old nightly build (early 1.4b cycle) with SciTE and Emacs, both worked like a charm. :-) Anything else to test?

RFE: Test if the editor set in the preferences exists, don't confront the user with a (JS?) crash dialogue but say what's up. On the machine I tested, emacsclient was somewhere else. Can you read the result of 'which emacsclient' or something like that?

RFE2: If there is a way to detect the very first use of electrix, you could give the user a note that Mozilla is suspended until the editor is being closed.

[12] Submitted by: Jens on Tuesday April 29th 2003

Now having tested on Windows 98. With the default paths (which contain slashes) I get two error dialogues: the editor could not be launched and the file could not be read back from editor - both even appear if a valid app. is specified but the temp dir path still contains slashes. If you knew a way to find out the Windows dir you could set app=%WINDIR%notepad.exe and temp=%WINDIR%temp as default for Windows.

Also note that you (or Mozilla?) seem to always separate lines with n which Notepad doesn't understand (it uses rn) so this should either be changed for Windows or you should add a note to the docs that Windows users should use an editor capable of handling LF-EOL files (personally, I use SciTE on Windows, Linux and Solaris).

[13] Submitted by: Elfez on Tuesday April 29th 2003

gvim: run it with the -f flag to not background it

[14] Submitted by: Elfez on Thursday May 1st 2003

Slight correction to my previous post: I ended up having to write a small wrapper script, like so:

#!/bin/sh

/usr/bin/gvim -f

and then point electrix to that

[15] Submitted by: Elfez on Thursday May 1st 2003

*sigh* gvim -f should of course be followed by $*

[16] Submitted by: David on Friday May 9th 2003

Works for me. Mozilla 1.4b on Red Hat 9.

There is one problem, though it's no fault of yours. When I exit my editor, Mozilla stubbornly refuses keyboard focus. I can click on textareas (and the location bar!) and see the text cursor blinking there, but nothing I type goes anywhere. Going away and coming back seems to fix the problem.

I've had Mozilla get in such an ugly state before ever trying electrix (especially alongside Chatzilla), so it's not your problem. It is annoying, but it certainly hasn't kept me from using electrix. (: It sure is handier being able to see everything I type in gedit, rather than five lines in the puny textarea mozdev leaves us. Thanks for the great extension!

[17] Submitted by: Kyber on Sunday May 11th 2003

Thanks Elfez. I must confess I completely forgot about Electrix, mostly because after a stressful few work weeks to get some last minute deadline code in, I simply didn't use Mozilla at home :)

Thanks! I completely forgot it did that. I wonder if it can be added to .vimrc as well.

[18] Submitted by: Claus on Monday July 28th 2003

Tried out Electrix for the first time today, using
Mozilla 1.5a. First of all, TNX 1E6 for this
tool! Works fine for me when using vim (under
Cygwin on my Windows box) - unfortunately, when
I use other editors, such as XEmacs, PFE or HTML-Kit,
the editors pop up, I can edit and save just fine,
but when I leave the editor, the editor process
doesn't die, and so Mozilla waits forever. When
I then kill the editor process using the task manager,
the edited text is actually read into the textarea
as expected. Any ideas what might be happening here?

[19] Submitted by: Kyber on Monday August 18th 2003

Little warning for the electrix users.
I am not certain if this is a windows only thing, but it appears that if you attempt to copy and paste from Mozilla into an editor, windows seems to try to contact the process the copy/paste buffer came from - not certain why.
At least this is what I assume is happening since the observed result is that no matter what it is, if I copy it in Mozilla, ctrl-e into gvim, then attempt to paste, gvim hangs and I have to kill the process.

Copying from anywhere else works fine.
Another reason it'd be nice if we could figure out a reliable and interactive way for electrix to work.
Don't think javascript can spawn a separate thread from the main mozilla one, can it?

[20] Submitted by: Steffan Kremer on Thursday August 28th 2003

Very interesting work, but i am not able to test it. but i will have a view to the source code.

Steffan
/index.php

[21] Submitted by: Alex on Sunday August 31st 2003

Nice project!

[22] Submitted by: Allan on Wednesday September 10th 2003

Nice project!

[23] Submitted by: Americanlifestyle on Tuesday September 23rd 2003

Good site

[24] Submitted by: jims on Tuesday September 23rd 2003

Your work is very interesting.

[25] Submitted by: Arne on Thursday September 25th 2003

great work

The electrix project can be contacted through the mailing list or the member list.
Copyright © 2000-2010. All rights reserved. Terms of Use & Privacy Policy.