Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Epsilon Programmers Editor

Posted by Jim Morris on Sat Sep 30 17:20:15 -0700 2006

I use Lugarus excellent Epsilon Editor for most of my programming editing needs, on Win32 and Linux.

(An exception is for Java programming where I use Eclipse).

I have spent some time writing extensions to Epsilon to handle Ruby and Rails programming, inspired mostly by Textmate on Mac/OSX, and Eclipse for Java. I tried using the Eclipse for Ruby, but I was very disappointed, also the developers have made some design decisions I can't live with (like no auto indent after opening braces etc).

I have tried Komodo Pro as described here.

OK the Epsilon editor is not free, it costs about $250 ($99 for an upgrade) which includes all platforms, and the license lets you use it on your Laptop and Desktop, in fact you can use any version of Epsilon on up to four computers you own. The result is a professional, solid, stable Editor, that is what you get when you pay for something. (This editor has been around at least 20 years, which is when I started using it on DOS!). In addition to running as an X Windows program and a console program on windows and Linux it also runs on Mac OS X, FreeBSD, OS/2 and DOS.

The Editor is an Emacs clone out of the box, it also has CUA and Brief emulations (well key bindings). The best feature IMHO is the fact you get most of the source code for the editor which is written in its own c-like language called eel. This makes it much easier to write extensions and customizations for the editor if you are familiar with C. (I never could wrap my brain around Lisp which is why I don't use GNU Emacs). It also runs in console mode as well as windows mode, which is useful if you have to login via ssh etc to edit files.

Seeing how every programmer has their own ideas of what an editor should do and its look and feel, easy customization is crucial.

The extensions I have written for Epsilon are all freely available, as are extensions written by other users. (Various language modes, template extensions, SCM extensions etc).

In the past I wrote a java help extension that tried to do context sensitive help, this worked OK but not as well as Eclipse.

Recently I wrote a bunch of extensions for Ruby and Rails, thanks to the ruby mode extension written by Timothy Byrd (available on Lugaru's download page) I was able to get syntax highlighting and formatting already done. I added some simple help extensions, a snippet facility (ala Textmate), and some convenience actions for Rails development. I also extended Timothy's ruby mode extension with something that completes the #{} when # is typed in a string. (I first saw this in Textmate and hated it, but it grew on me, until I had to have it on Linux). I have avoided the temptation to also do the automatic closing of { ( " etc that you find in Textmate because I still hate those, but they are easy to do using the same technique I used for #{}.

I've also added the ability to run the current buffer through the ruby interpreter and show the results in a pop up window, also to run a specific unit test if the file is a Ruby test case.

The key strokes any command uses is easily modified, as well as the colors used for syntax highlighting.

The version of ruby_mode.e on Lugarus site does not currently have the latest changes I have made, so it can be downloaded from the link below...

The other extensions can also be downloaded from my site...

These can be installed by copying them to your ~/.epsilon folder, and adding a load line to your einit.ecm file, see the comments in the source file. The snippets should be un-tarred into the ~/.epsilon folder. The README explains how to load them.

eg add this to your einit.ecm file:

(load-eel-from-path "ruby_mode.e" 2)
(load-eel-from-path "rubyhelp.e" 2)
(load-eel-from-path "snippets.e" 2)
(load-eel-from-path "rename_in_place.e" 2)

Also here are the color codes I use for ruby_mode, these are designed by Timothy: (Change the window-black to whatever color set you are using)

&window-black color class for ruby-brace: [0x725CEB on 0x0]
&window-black color class for ruby-class: [0xD9D240 on 0x0]
&window-black color class for ruby-comment: [0xC0C0C0 on 0x0]
&window-black color class for ruby-global: [0xFFB737 on 0x0]
&window-black color class for ruby-keyword: [0xFF8000 on 0x0]
&window-black color class for ruby-number: [0xFF9090 on 0x0]
&window-black color class for ruby-punctuation: yellow on black
&window-black color class for ruby-regexp: [0x007FFF on 0x0]
&window-black color class for ruby-shell-cmd: [0x8FFF2F on 0x0]
&window-black color class for ruby-shell-subst: [0x8FFF8F on 0x0]
&window-black color class for ruby-str-subst: [0xFFC0C8 on 0x0]
&window-black color class for ruby-string: cyan on black
&window-black color class for ruby-perl-var: red on black

Although you can browse for files that epsilon has currently open and switch between these buffers, the method is fairly crude by todays standards of tabbed windows etc, so I wrote a little graphical helper called project_browser.rb that uses the fox window toolkit. It just shows a tree of the directory it was given on the command line, and if you click on any of the files they open in the epsilon window. This is a lot like the project browser windows you find in Textmate, Eclipse and others. You need to install fox version 1.4 and the fox14 gem too to use this. It also allows you to exclude files and directories from display in the tree, by putting a YAML file called .proj_exclude.yaml in the project directory, I'll document this further if there is any interest in it (Leave a comment if you are interested). It allows multiple project directories to be open and shows them in tabs at the top. I'm also working on integrating subversion into it. It could also be adapted to work with virtually any editor that allows files to be sent to the editor by a separate process.

project browser

Posted in Linux,Rails,Ruby  |  Tags ide,ruby,rails,epsilon,editor  |  1 comments

Comments

  1. Hans W said on Wed Jan 19 05:21:53 -0800 2011
    Hmm, your project_browser.rb seems interseting, I have been thinking lately about doing such a creature myself - now I don't have to. Thanks!

(leave email »)