Scriptable text editor with Ruby?

but vi *must* run everywhere (According to POSIX). :slight_smile:

To the OP:

Both editors run everywhere and in my opinion, if you're not planning
on building a cross platform TextMate clone that is at least 95% as
good, you won't pry anyone from vim, emacs, *or* TextMate.

But if you're looking to try something different, or build the perfect
editor for you, have fun. I know I'd at least play around with yet
another Ruby enabled editor. (Though QT is yucky)

ยทยทยท

On 1/3/07, Dolazy <francis.rammeloo@gmail.com> wrote:

Michael P. Soulier schreef:

> Vim runs everywhere. Are you sure that this is necessary?
>
> Mike

Are you sure Vim was necessary? Emacs runs everywhere... :stuck_out_tongue:

I would suggest to have a look at jEdit: http://jedit.org

It's a very nice and open source editor, written in java and has
powerful support for macro's (amongst other nice features such as
plugins etc). By default macro's are written in BeanShell (one of the
scripting languages for the JVM), but if you install the
SuperScript-plugin and combine it with JRuby you can write macro's in Ruby.

You might also want to have a look at the Ruby plugin for jEdit:
http://rubyjedit.org/

greetz,
Jeroen

- --
<TeRanEX/>
--- e-mail: jeroen@lightyear.be - jid: teranex@jabber.org
--- blog: teranex weblog - cv: teranex weblog
--- projects: http://lightyear.be - pgp: 0x8B7B774A

ยทยทยท

On 2007-01-03 23:15, Thomas Mueller wrote:

You might want to have a look at Java 6. I have just installed that
yesterday and haven't played around with it at all yet, but from what
I read on the website it's integration with scripting languages might
make it relatively easy to include Ruby scripting in your text editor.

___________________________________
GetFirefox.com - rediscover the web

Vincent Fourmond wrote:

M. Edward (Ed) Borasky wrote:
  

Dolazy wrote:
    

Hi all!

Vim and emacs are text editor that can be scripted using internal
script languages. I'm thinking of writing a platform independent text
editor myself that uses the ruby language for executing scripts. The
host application would be written in C++ (+Qt) and it would somehow be
able to interact with ruby.
  

Well, given QtRuby, you probably don't really need C++ at all -- you
could do it all in Ruby.
    
  I can only agree to that. For what I experience, Qt4 1.4.7 is pretty
stable, much more than its predecessors. But I think you'll need a bit
of practice with the C++ classes before coding direcly with Qt/Ruby.

  Well, have fun !

  Vince

I jumped right into QtRuby (3, though, on Linux) using Caleb Tennis' book from Pragmatic. I can't begin to even *read* C++, much less write it! :slight_smile: If QT4/QT4-Ruby are "upward compatible", it shouldn't be too difficult. I just wish the bigger brothers of QTRuby, Korundum and Kommander, were available on Macs and Windows. It's *almost* worth putting up with "KDE bloat" for them. :slight_smile:

ยทยทยท

--
M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given rabbits fire.

This is pretty much how TextMate works.

Language grammars divide the document you are editing into "scopes," which might be something like "entity.name.type.class.ruby." Themes then color these elements for syntax highlighting.

But they are used in many other places by the editor. You can write commands that work only inside certain scopes, change editor behaviors when working with certain scopes, etc.

It's quite powerful.

James Edward Gray II

ยทยทยท

On Jan 3, 2007, at 10:30 PM, Tim X wrote:

What I think would be really good is semantic highlighting rather than syntax highlighting - this may sound crazy, but I find syntax problems to be the more trivial bugs to squash. Highlighting which gave more information on the "meaning" of what you are coding would probably provide more valuable information.

Thanks for your suggestions Edward, Vince (+others).

However, running a complete text editor application as a ruby script;
wouldn't that be slow?

The idea of having a C++ skeleton application with lot's of ruby
plugins seems more appealing to me. It would be faster and still
strongly customizable. However, if you think differently then please
share your insights on this..

I will grant admin if anyone feels like continuing aeditor.
Actually I did the same yesterday with http://ros.rubyforge.org/
after talk in the ros forum.

The reason I stopped working on these things was that
I got a job that took up all my available time.
Only profesional work, no focus on the social side.
So I quit that job and started my own company,
hoping to do it better. I have plenty of time now,
but its allocated for the company beast.

If someone payed food/rent then I would have
been happy working entirely on ruby projects.

The person(s) that has interest in the aeditor project,
is free to do whatever she likes. Change website,
license, code. Write a entirely new aeditor. Add code,
licenses, websites, etc. I don't mind as long as its
for a good purpose.

ยทยทยท

On 1/5/07, Trans <transfire@gmail.com> wrote:

Suraj Kurapati wrote:
> Dolazy wrote:
> > I'm thinking of writing a platform independent text
> > editor myself that uses the ruby language for executing scripts. The
> > host application would be written in C++ (+Qt) and it would somehow be
> > able to interact with ruby.
>
> Why start from scratch? Take over an existing, defunct open source
> project:
>
> http://aeditor.rubyforge.org/

+1

Simon?

--
Simon Strandgaard
http://opcoders.com/

Dolazy wrote:

Swig seems to assume that you want to take away the main() method and
treat the C++ code as a shared library. It's not really the same as
interprocess communication.

The embedding solution also provides one way interaction. The C++
program calls ruby, but not the other way around. There might be ways
around this, using callbacks or so. I'd like to learn more...

I suspect that IPC using XmlRpc is the most powerful solution (and easy
to implement).

There is an easier way than having ruby in a separate process and having
to do IPC via RPC. Simply run ruby within a pthread and give it a SWIG
interface to your C++ app.

== Option1

If you cannot allow the Ruby thread to asynchronously use your C++ app,
then you can set up a mutual exclusion scheme where either (1) the C++
app or (2) the Ruby thread is active at a time. You would then have to
provide a way to transfer/relay control between them.

In fact, this is how my Ruby-VPI project works. It embeds a Ruby
interpreter into a C program that runs within a Verilog.

  http://ruby-vpi.rubyforge.org

== Option2

If that's not the kind of interaction you want, then see:

  ruby embedded into c++

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.

Java is attractive for several reasons. A powerful gui, speed is very
good, and there's JRuby... But I want to explore new territory. That's
why I want to choose Qt, because it's something new for me. Also
because I am a C++ developer I want to improve my cv a bit :wink:

Francis

Thomas Mueller wrote:

ยทยทยท

Hi,

You might want to have a look at Java 6. I have just installed that
yesterday and haven't played around with it at all yet, but from what
I read on the website it's integration with scripting languages might
make it relatively easy to include Ruby scripting in your text editor.

I realise there would be quite a few disadvantages to this approach
(need the runtime, need a brand new runtime, cannot code it in
Ruby...) but it might be worth looking into this.

Thomas

Gregory Brown schreef:

ยทยทยท

On 1/3/07, Dolazy <francis.rammeloo@gmail.com> wrote:
>
> Michael P. Soulier schreef:
>
> > Vim runs everywhere. Are you sure that this is necessary?
> >
> > Mike
>
> Are you sure Vim was necessary? Emacs runs everywhere... :stuck_out_tongue:

but vi *must* run everywhere (According to POSIX). :slight_smile:

To the OP:

Both editors run everywhere and in my opinion, if you're not planning
on building a cross platform TextMate clone that is at least 95% as
good, you won't pry anyone from vim, emacs, *or* TextMate.

But if you're looking to try something different, or build the perfect
editor for you, have fun. I know I'd at least play around with yet
another Ruby enabled editor. (Though QT is yucky)

Thanks :slight_smile:

This is really a pet project and I develop it in the first place to
deal with some of my specific needs (gdb integration). And also because
I want to learn Qt.

Btw I use Vim as primary editor.

That's attractive of course. I will check out this editor thoroughly
and let you know something.

Dolazy wrote:

However, running a complete text editor application as a ruby script;
wouldn't that be slow?

The idea of having a C++ skeleton application with lot's of ruby
plugins seems more appealing to me. It would be faster

You cannot assume that things will be faster just because you use a
low-level language. If this were true, then all 3D games would be
written in straight machine code... forget about assembler!

Efficiency comes *primarily* from good choice of data structures and
algorithms which are best suited to tackle the problem at hand. Whether
or not the programming language being used is "close to the metal" is,
at best, of secondary importance.

and still strongly customizable.

Good, it seems you are implicitly seeking a higher level language so
that you can better manage complexity. (Google "No Silver Bullet" for
details.)

ยทยทยท

--
Posted via http://www.ruby-forum.com/\.

Dolazy schrieb:

Java is attractive for several reasons. A powerful gui, speed is very
good, and there's JRuby... But I want to explore new territory. That's
why I want to choose Qt, because it's something new for me. Also
because I am a C++ developer I want to improve my cv a bit :wink:

Francis

Be sure to look at http://software.jessies.org/Evergreen/ for some
insipiration. (Also remember, Java isn't evil anymore now!)

Paulus

* Gregory Brown, 01/03/2007 06:17 PM:

but vi *must* run everywhere (According to POSIX). :slight_smile:

line-mode ex is scriptable. The TUI that can be started using
':visual' (hence its commonly known name 'vi') isn't. ex's ancestor
ed is scriptable as well. I sometimes use the latter for shell script
controlled in-place editing of files to avoid unnecessary security
issues resulting from the creation and deletion of temporary files
(that is one of the largest source of harmful security holes known to
authors of shell scripts). It is a pity that many people only know
sed (wich is nothing but a stripped-down version of ed only being
capable to handle streams) because they are doomed to introduce such
problems.

Jupp

ยทยทยท

--
Happy 10. birthday, HAL.

sender: "Dolazy" date: "Thu, Jan 04, 2007 at 02:30:10AM +0900" <<<EOQ

[..]

This is really a pet project and I develop it in the first place to
deal with some of my specific needs (gdb integration). And also because
I want to learn Qt.

Btw I use Vim as primary editor.

For vim+gdb integration, you can check out:
http://clewn.sourceforge.net/

Cheers,
Alex

Qt provides lots of functionality for free that you had to implement in
your editor. I think I will continue on my own path.

I still think an application written entirely in ruby would be slow.
Eclipse is slower than Visual Studio, Azureus is slower than
ยตTorrent.. Higher level languages are slower, even if they use optimal
data structures. I know that this doesn't have to be this way
theoretically, and that higher-level languages allow more compiler
optimization and all. But still you see that programs written in C/C++
are almost always faster than those written in Java, or other
high-level languages (esp ruby!).

I'm in favor of higher level languages, but wanting to make my
application customizable using external scripts does not mean my
language is too low-level. It just means that I want to make my program
programmable.

When embedding, you can add an extention that implements a ruby API to
your editor and thus the communication will be both ways.

I don't know much about Eclipse and VS so I won't comment on those; however, uT and Azureus aren't both trying to be lightweight so, IMO, it is unfair to compare them like that.

Also, I think you have to remember that you are coding a text editor.

ยทยทยท

On any modern computer it honestly won't matter what language you do it in. dan Dolazy wrote:

I still think an application written entirely in ruby would be slow.
Eclipse is slower than Visual Studio, Azureus is slower than
ยตTorrent.. Higher level languages are slower, even if they use optimal
data structures. I know that this doesn't have to be this way
theoretically, and that higher-level languages allow more compiler
optimization and all. But still you see that programs written in C/C++
are almost always faster than those written in Java, or other
high-level languages (esp ruby!).

I'm in favor of higher level languages, but wanting to make my
application customizable using external scripts does not mean my
language is too low-level. It just means that I want to make my program
programmable.

Yeah, you could be right..

I didn't want to go off-topic, but I couldn't resist writing my
previous post. I hope I didn't open pandora's box now.

Francis