Forum: Ruby Ruby based editor

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F4ae9e7822cb761275aff25a0341f443?d=identicon&s=25 Phil Jackson (Guest)
on 2006-05-03 18:56
(Received via mailing list)
Hi all,

I've started to write my own editor (in c) which shall be extendible by
via
Ruby. I have a question about the design, as this is a 'from scratch'
approach I'm taking do you think I should write the basics in C and then
wrap it up with ruby or should I impliment with reliance on the Ruby
types
from the start? For example, say I have a simple buffer object:

typedef struct _BUFFER {
    char *filename;
    char *name;
} Buffer;

Should I use Data_Wrap_Struct() to wrap this up or should I build a
class
from scratch in Ruby using Ruby types. Either way the editor remains
extendible in C and Ruby but once I go for the second option embedding
any
other enterpriter (Python, Perl...) goes out of the window.

Let me know your thoughts (which aren't allowed to include "do we really
need another editor" :)).

Cheers,
Phil
2c51fec8183a5d21c4e11b430beabb47?d=identicon&s=25 Patrick Hurley (Guest)
on 2006-05-03 18:56
(Received via mailing list)
On 4/30/06, Phil Jackson <phil@shellarchive.co.uk> wrote:
>     char *name;
> Cheers,
> Phil
>
>

My thoughts are implement the whole thing in Ruby and then only bother
to write the parts in C where there is a reason (performance) to do
so.

pth
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-05-03 18:56
(Received via mailing list)
On Sunday 30 April 2006 11:00 am, Phil Jackson wrote:
> Let me know your thoughts (which aren't allowed to include "do we really
> need another editor" :)).

Ok, I won't ask that in quite that way, but:

   * What is your goal for this editor--is it a learning project or
intended
to eventually be a "product" in some sense?

   * Is it to be as full-featured as Emacs or more like Notepad?

   * Have you estimated how much time it will take to accomplish what
you wish
to accomplish?  Is it a realistic estimate, and do you have that much
time?

If I was going to expend effort on an editor, I'd work on nedit.  It is
written in C, is very featureful and fast, etc.  It includes a
C-style/based
macro language, keystroke recording to start macros, syntax
highlighting,
autoindent, etc., etc., etc.

But, as I understand it, the code base is at least a little messy at
this
point in time.  A "faction" of developers is pushing to do something
along
the lines of a feature freeze while the codebase is reorganized.

(I am not a nedit developer, primarily an enthusiastic user.  I am
planning to
incorporate nedit in a project I'm working on, currently at a me-ware
stage.
(IIR/UC, Joel Spolsky (sp?) developed the me-ware term for a project
that is
only suitable for use by the original developer (due to lack of all
kinds of
things--features, safety, robustness, ... .))

Assuming a feature freeze happens, once the codebase is reorganized,
features
will again be added and this could include a Ruby based macro language.

One thing I don't like about Nedit is the look and feel of the
Motif/lesstif
based widgets.  I'm guessing (hoping?) that if the codebase were
rewritten in
an appropriate way, it would not be unreasonable to switch widget sets
or to
allow a user to choose one from a selection of suitable widget sets.

Depending on how much time and thought you've put into your plan to
create a
new editor, it may be worth your while to do some investigation of nedit
and
consider contributing your efforts there.

Here are some URLs and mailing lists:

   * http://www.nedit.org/
   * http://sourceforge.net/projects/nedit/
   * General NEdit discussion list <discuss@nedit.org>
   * NEdit development list <develop@nedit.org>

Randy Kramer
F4ae9e7822cb761275aff25a0341f443?d=identicon&s=25 Phil Jackson (Guest)
on 2006-05-03 18:56
(Received via mailing list)
On Mon, May 01, 2006 at 07:38:40AM +0900, Randy Kramer wrote:
> On Sunday 30 April 2006 11:00 am, Phil Jackson wrote:
> > Let me know your thoughts (which aren't allowed to include "do we really
> > need another editor" :)).
>
> Ok, I won't ask that in quite that way, but:

I think you may have mis-understood my question (or I didn't explain
properly), what I was asking was more a design question than a general
"I'm
building yet another editor what do you think" question. As you took the
time to write a response I'll answer you though (check bottom where I
re-phase my query):

>    * What is your goal for this editor--is it a learning project or intended
> to eventually be a "product" in some sense?

Both, I'm very interested in editors and find myself downloading new
ones as
they arrive and playing with them (though I'm an avid Vim user).

>    * Is it to be as full-featured as Emacs or more like Notepad?

Well, the idea is to write the base of the editor in C and have the API
almost completely available to Ruby. So, theoretically, it could be as
full-featured as Emacs or as simple as Notepad. ;)

> If I was going to expend effort on an editor, I'd work on nedit.  It is
> written in C, is very featureful and fast, etc.  It includes a C-style/based
> macro language, keystroke recording to start macros, syntax highlighting,
> autoindent, etc., etc., etc.

To be honest I'd like to start from scratch and see what I come up with,
secondly I _hate_ GUI based editors personally.

What I was actually trying to ask was:

The base will be written in C not in pure Ruby. I would like to know
whether
people think I would be better using C types at the core or Ruby types
implimented in C. So, I can, A),  write a basic editor in C and then
wrap it
up with Ruby using Data_Wrap_Struct() much like an extenstion would. Or
I
can, B), start from the beginning with rb_define_class() and friends
thus
relying on Ruby from the start. The advantages and dis-advantages that I
think may exsist:

a) advantages:
    * The core of the application would be instantly reconisable to a C
      hacker who has no Ruby experience.
    * If I decide it should be extendable by another language it would
be a
      simple job.
    * Better performance?

   disadvantages:
    * I would have to impliment and then map things like linked lists
      meaning wheel re-invention.
    * more work :)
    * Can't rely on libruby for memory handling.

So which one?

Phil
34f159f89cbd1d9beac0276f5a7af552?d=identicon&s=25 John Gabriele (Guest)
on 2006-05-03 18:57
(Received via mailing list)
On 4/30/06, Phil Jackson <phil@shellarchive.co.uk> wrote:
> time to write a response I'll answer you though (check bottom where I
> Well, the idea is to write the base of the editor in C and have the API
> almost completely available to Ruby. So, theoretically, it could be as
> full-featured as Emacs or as simple as Notepad. ;)
>
> > If I was going to expend effort on an editor, I'd work on nedit.  It is
> > written in C, is very featureful and fast, etc.  It includes a C-style/based
> > macro language, keystroke recording to start macros, syntax highlighting,
> > autoindent, etc., etc., etc.
>
> To be honest I'd like to start from scratch and see what I come up with,
> secondly I _hate_ GUI based editors personally.

(I don't have an answer to your original question, however...)

You may want to have a look at "ne" (the Nice Editor).
http://ne.dsi.unimi.it/

The code looks neat and well-documented, and the editor has very good
end-user docs as well. The original author is quite a nice fellow. I
believe he no longer has the time to maintain or add features to ne.
ne may be a source of inspiration for you (or even possibly serve as a
jumping-off point). It's written in C, and is GPL'd. I'd *love* to see
it get syntax highlighting and be scriptable with Ruby. Man that would
rock. :)

---John
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 unknown (Guest)
on 2006-05-03 18:57
(Received via mailing list)
On Mon, 1 May 2006, Phil Jackson wrote:

> a) advantages:
>    * Can't rely on libruby for memory handling.
>
> So which one?

well, if you choose A you'll be following in the footsteps of vim, which
is
already extensible in ruby.  why not start do B then to avoid breaking
programmer's rule #42 ?

-a
896cfc242a7762467c2a0b2af86598e5?d=identicon&s=25 Simon Strandgaard (Guest)
on 2006-05-03 18:57
(Received via mailing list)
On 5/1/06, John Gabriele <jmg3000@gmail.com> wrote:
[snip]
> You may want to have a look at "ne" (the Nice Editor).
> http://ne.dsi.unimi.it/
[snip]
> jumping-off point). It's written in C, and is GPL'd. I'd *love* to see
> it get syntax highlighting and be scriptable with Ruby. Man that would
> rock. :)

syntax coloring is not easy to add.


I did some editor work, but currently lacks time to complete it.
http://aeditor.rubyforge.org/
F5b3c1ebfb2e9fc5f67bb48b119f6054?d=identicon&s=25 Randy Kramer (Guest)
on 2006-05-03 18:57
(Received via mailing list)
On Sunday 30 April 2006 07:25 pm, Phil Jackson wrote:
> I think you may have mis-understood my question (or I didn't explain
> properly), what I was asking was more a design question than a general "I'm
> building yet another editor what do you think" question. As you took the
> time to write a response I'll answer you though (check bottom where I
> re-phase my query):

I think I understood your question ;-)

> To be honest I'd like to start from scratch and see what I come up with,
> secondly I _hate_ GUI based editors personally.

But seeing the above clarification, I understand where you want to go
(non-GUI) and that you want to start from scratch.

Nevertheless, I'm sure your revised questions (below) will be helpful to
others who respond.

Randy Kramer
34f159f89cbd1d9beac0276f5a7af552?d=identicon&s=25 John Gabriele (Guest)
on 2006-05-03 18:57
(Received via mailing list)
On 5/1/06, Simon Strandgaard <neoneye@gmail.com> wrote:
> On 5/1/06, John Gabriele <jmg3000@gmail.com> wrote:
> [snip]
> > You may want to have a look at "ne" (the Nice Editor).
> > http://ne.dsi.unimi.it/
> [snip]
> > jumping-off point). It's written in C, and is GPL'd. I'd *love* to see
> > it get syntax highlighting and be scriptable with Ruby. Man that would
> > rock. :)
>
> syntax coloring is not easy to add.

Understood. Also, I can guess that it might be easier or harder to add
depending on the design of the editor you're trying to add it to.

>
> I did some editor work, but currently lacks time to complete it.
> http://aeditor.rubyforge.org/

Neat.

Say, not to harp on FreeRIDE, but the project's sound very similar.
Just curious, why did you start your own editor project in Ruby
instead of working on FreeRIDE?

Also, I saw on your site that you switched to dvorak. I switched a
couple years ago and my hands are much happier. :)
896cfc242a7762467c2a0b2af86598e5?d=identicon&s=25 Simon Strandgaard (Guest)
on 2006-05-03 18:57
(Received via mailing list)
On 5/1/06, John Gabriele <jmg3000@gmail.com> wrote:
> > syntax coloring is not easy to add.
> Say, not to harp on FreeRIDE, but the project's sound very similar.
> Just curious, why did you start your own editor project in Ruby
> instead of working on FreeRIDE?

I cannot recall. Something about that I wanted a lightweight editor,
that would work both in console and gui mode, highly portable, using
unicode, and scriptable in our favorite language.

I am using TextMate, until again I find time/money to do editor.


> Also, I saw on your site that you switched to dvorak. I switched a
> couple years ago and my hands are much happier. :)

Having used dvorak for ~6 months I have switched back to qwerty,
because most keybindings favors qwerty :-(
Using vim in dvorak mode was interesting.
Bf6862e2a409078e13a3979c00bba1d6?d=identicon&s=25 Gregory Seidman (Guest)
on 2006-05-03 18:57
(Received via mailing list)
On Tue, May 02, 2006 at 02:16:06AM +0900, Simon Strandgaard wrote:
[...]
} I cannot recall. Something about that I wanted a lightweight editor,
} that would work both in console and gui mode, highly portable, using
} unicode, and scriptable in our favorite language.
}
} I am using TextMate, until again I find time/money to do editor.
}
} >Also, I saw on your site that you switched to dvorak. I switched a
} >couple years ago and my hands are much happier. :)
}
} Having used dvorak for ~6 months I have switched back to qwerty,
} because most keybindings favors qwerty :-(
} Using vim in dvorak mode was interesting.

So you clearly know about vim. And you presumably know that it can be
used
in both console and GUI modes. And that it is portable enough that it
runs
on Windows, MacOS X, and *nix (under several X11 toolkits, even). Do you
know that it is scriptable in Ruby? Was there something else you were
looking for?

} Simon Strandgaard
--Greg
896cfc242a7762467c2a0b2af86598e5?d=identicon&s=25 Simon Strandgaard (Guest)
on 2006-05-03 18:57
(Received via mailing list)
On 5/1/06, Gregory Seidman <gsslist+ruby@anthropohedron.net> wrote:
> On Tue, May 02, 2006 at 02:16:06AM +0900, Simon Strandgaard wrote:
> [...]
> } I cannot recall. Something about that I wanted a lightweight editor,
> } that would work both in console and gui mode, highly portable, using
> } unicode, and scriptable in our favorite language.
> }
> } I am using TextMate, until again I find time/money to do editor.
> }
[snip]
>
> So you clearly know about vim. And you presumably know that it can be used
> in both console and GUI modes. And that it is portable enough that it runs
> on Windows, MacOS X, and *nix (under several X11 toolkits, even). Do you
> know that it is scriptable in Ruby? Was there something else you were
> looking for?

I know. Nevermind.
171a9b5755cdb090e0c2b3c20a521fbc?d=identicon&s=25 Phil Hagelberg (Guest)
on 2006-05-03 18:57
(Received via mailing list)
"Simon Strandgaard" <neoneye@gmail.com> writes:

> I cannot recall. Something about that I wanted a lightweight editor,
> that would work both in console and gui mode, highly portable, using
> unicode, and scriptable in our favorite language.

A few things I've noticed:

http://raa.ruby-lang.org/project/diakonos/
http://www.lypanov.net/xml/development/ruvi.xml

You're not the first person to want these things, that's for sure.

>> Also, I saw on your site that you switched to dvorak. I switched a
>> couple years ago and my hands are much happier. :)
>
> Having used dvorak for ~6 months I have switched back to qwerty,
> because most keybindings favors qwerty :-(
> Using vim in dvorak mode was interesting.

Heh. Dvorak was the main reason I chose Emacs over Vim several years
ago. I'm happy with the way things turned out, even if I didn't have a
great reason to start out with.

-Phil Hagelberg
34f159f89cbd1d9beac0276f5a7af552?d=identicon&s=25 John Gabriele (Guest)
on 2006-05-03 18:58
(Received via mailing list)
On 5/1/06, Phil Hagelberg <phil@hagelb.org> wrote:
> ago. I'm happy with the way things turned out, even if I didn't have a
> great reason to start out with.

I use vim often these days, and have tried emacs for a time, but
didn't see any difference regarding one being harder than the other
wrt dvorak vs. qwerty. Regardless of keyboard layout, emacs keys
seemed a bit more consistent, but I ended up using vim instead for
other reasons.

Also, emacs always gave me that eerie feeling that it was thinking
about things behind my back. Like it was just allowing me to edit text
as one of it's low-priority background tasks (to humor me perhaps)
while silently carrying on with its own affairs. ;)
171a9b5755cdb090e0c2b3c20a521fbc?d=identicon&s=25 Phil Hagelberg (Guest)
on 2006-05-03 18:58
(Received via mailing list)
"John Gabriele" <jmg3000@gmail.com> writes:
> I use vim often these days, and have tried emacs for a time, but
> didn't see any difference regarding one being harder than the other
> wrt dvorak vs. qwerty. Regardless of keyboard layout, emacs keys
> seemed a bit more consistent, but I ended up using vim instead for
> other reasons.

IIRC the vi navigational keys are arranged such that they all fall on
the qwerty home row.

> Also, emacs always gave me that eerie feeling that it was thinking
> about things behind my back. Like it was just allowing me to edit text
> as one of it's low-priority background tasks (to humor me perhaps)
> while silently carrying on with its own affairs. ;)

Well, you can always (setq self-awareness nil) but where's the fun in
that? It's no coincidence... Lisp was originally used as an AI
language. =) You pretty much have to come to grips with the fact that
Emacs is smarter than you are... Once you do that everything falls
into place comfortably.

-Phil
Cd49db0b676767ea4358b1047c4cddd2?d=identicon&s=25 Robin Stocker (Guest)
on 2006-05-03 18:58
(Received via mailing list)
Phil Hagelberg wrote:
> IIRC the vi navigational keys are arranged such that they all fall on
> the qwerty home row.

I also use Dvorak and Vim, and the key bindings never bothered me. The j
and k are also side by side and the h and l keys I don't use that often
anyway. I use w (or e) and b instead, which are on the same row and
nearly side by side, so it's not a problem.

Cheers,
   Robin
A402df36168b81b31c17adcbb5ae8cf4?d=identicon&s=25 Pistos Christou (pistos)
on 2006-05-04 01:29
Simon Strandgaard wrote:
> I cannot recall. Something about that I wanted a lightweight editor,
> that would work both in console and gui mode, highly portable, using
> unicode, and scriptable in our favorite language.
>
> I am using TextMate, until again I find time/money to do editor.

I'm surprised a bit at your responses in this thread.  :)  I thought you
totally abandoned AEditor because you were so enamoured by TextMate.  :)

Pistos
896cfc242a7762467c2a0b2af86598e5?d=identicon&s=25 Simon Strandgaard (Guest)
on 2006-05-04 07:45
(Received via mailing list)
On 5/4/06, Pistos Christou <jesusrubsyou.5.pistos@geoshell.com> wrote:
> Simon Strandgaard wrote:
> > I cannot recall. Something about that I wanted a lightweight editor,
> > that would work both in console and gui mode, highly portable, using
> > unicode, and scriptable in our favorite language.
> >
> > I am using TextMate, until again I find time/money to do editor.
>
> I'm surprised a bit at your responses in this thread.  :)  I thought you
> totally abandoned AEditor because you were so enamoured by TextMate.  :)


Even though TextMate has many interesting things, it still feels like I
am
missing certain stuff. I have'nt yet started analyzing what that stuff
is.
Some pointers about TextMate (Sorry Allan):
- non-free.
- mac only.
- gui only.
- sideways scrolling could be better.
- no block caret ala Turbo Pascal.
- sometimes too intelligent.
- bad vertical scrolling for bottom/top parts of a file.
+ I want to advertise for its cmd+T that quick-opens files, its amazing.

I sometimes want a editor that can go fullscreen, where you cannot be
disturbed
by anything, so one can code.

These items is what I immediately can think of.
I am relatively satisfied with TM.
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-05-04 15:24
(Received via mailing list)
On May 4, 2006, at 12:41 AM, Simon Strandgaard wrote:

> - gui only.

I've always been impressed by how well it interacts with cli apps
though (via the mate command).

James Edward Gray II
01469f8ff087fc5eeb2f052e9118222b?d=identicon&s=25 Alex Polite (alex789)
on 2006-05-09 07:06
(Received via mailing list)
This doesn't answer the question. But I'd just like to point out that
Emacs is extendible with ruby thanks to el4r[1]. I've been playing
around with it to build a Emacs GTD app using ical as the backend.

alex

[1] http://www.rubyist.net/~rubikitch/computer/el4r/in...
This topic is locked and can not be replied to.