spk121 / zile

A build of Zile that uses Guile
52 stars 7 forks source link

Any document? #3

Open NalaGinrut opened 5 years ago

NalaGinrut commented 5 years ago

I can build and run guile-on-zile successfully. I think the extension script should be loaded from $HOME/.zile-on-guile, however, it seems useless after I add some code into this file.

I want to write a small editor with highlighted syntax, how should I do that? Any tutorial or document would be better. Thanks!

NalaGinrut commented 5 years ago

I fixed .zile-on-guile issue by copying zile.scm to site dir. It seems that zile-on-guile doesn't do it for me.

guygastineau commented 4 years ago

Hi @NalaGinrut it doesn't look like there will be any tutorials on how to write syntax highlighting extensions any time soon.

I am just finding this project today, but I have been wanting to get started doing something similar to this project for some time now. Finding some work that builds already means less boiler plate :smile:

I see you say

zile-on-guile doesn't do it for me This seems like a very lightweight project right now. The author's own README suggests we shouldn't expect it to be maintained, so the fact that it still builds is pretty cool.

If you like Guile and wish Emacs used Scheme instead of Elisp, then this is a neat opportunity for us to try building up a text editor mostly from scratch. If that sounds like too much hassle, then I understand. In all likelihood I will have to abandon any effort I try putting into this when I start a new job next month. If you think are still interested in what is happening in this project, then please stick around :smile: Maybe we can make our own dreams come true!

amirouche commented 4 years ago

There is minimal editor at https://github.com/a-guile-mind/azul.scm.

I am also interested in this adventure. Please, let me know.

guygastineau commented 4 years ago

@amirouche cool.

I will check out your project!

spk121 commented 4 years ago

Yeah, I do love the idea of making a console text editor is scheme. I actually wrote a fair number of the parts. I wrote guile-ncurses for TUI, guile-aspell for spell check, and I then wrote half of a text editor in an abandoned project called Gano that is still on sourceforge.net, and I did to a fair bit of the unicode upgrade to core Guile itself back in the 2.0 days.

But as much as I love the idea, I'll probably never finish it.

Anyway, for this project, which uses the GNU Zile codebase and attaches Guile to the backend, syntax colorization isn't well supported by the Zile codebase, so this project isn't a good starting point. You'd want a front end with more features.

I actually wrote a Gtk/Cairo-based console widget in C that had a Guile API that did colors, bold and blink. It got incorporated in to an interactive fiction project called Project Burro, but, it isn't a standalone project.

Unless you love poking around with low level things like I do, a better starting point would be to use Gtk's GtkTextBuffer and GtkTextView widgets. To get to that from Guile, we have a project called guile-gi that generates Gtk3 bindings.

guygastineau commented 4 years ago

Thanks for chiming in :smile: I'll take a look at the resources and directions you mentioned.

Also, would that guile-gi tool be capable of generating wlroots binding for Guile from the xml specifications?


In the absense of a full XMonad port to wayland I really have an itch to build WM's in Scheme :smiling_imp:

NalaGinrut commented 4 years ago

@spk121 I expect a lightweight ncurses editor based on Guile, just like nano. Is it in your plan? ;-)

spk121 commented 4 years ago

@guygastineau Off topic, but, guile-gi can only autogenerate guile bindings for libraries that provide typelib files, which usually means libraries in the GNOME ecosystem. Your best bet to autogenerate bindings based on plain C headers is to use NYACC.

@NalaGinrut Trying to write one 10 years ago is how I first started to learn Scheme, and how I ended up writing guile-ncurses and guile-aspell. You can still see the chaotic remains of my editor code at https://sourceforge.net/projects/gano/ but I don't think I'll be finishing it.

NalaGinrut commented 4 years ago

@spk121 Thanks for the reply! I downloaded it but it seems guile-ncurses, not the gano editor. Maybe I did it wrong?

spk121 commented 4 years ago

@NalaGinrut Yeah, you'd have to clone the repo at git clone https://git.code.sf.net/p/gano/gano gano-gano There was never a release of the editor code.

But it doesn't build or work. It is just a tangle of half-baked ideas.

NalaGinrut commented 4 years ago

@spk121 Thanks! Do you still think guile-on-zile is the way for no-X lightweight editor? Or maybe we don't have to waste much time on zile?

florhizome commented 2 years ago

Hello all! I've researching a scheme/guile editor to use a bit now, and i think I can confirm that there is definitely interest in an editor in guile. (or an emacs in guile) Heck; even for scheme there aren't much. The most fullfledged editor extensible in scheme that i found would probably edwin, a fork of emacs 18 that ships with MIT scheme and replaces elisp with that dialect (which implements at least r6rs) not sure if it's worth to try porting as a whole, but maybe interesting to get basic modules from. Don't know how much DrRacket can help. On the other side, guile's elisp branch seems to be near to have been ported to guile 3, so guile-on-emacs can still serve as an entry. As emacs and guile-emacs continue to exist, I think a small, terminal first editor, but extensible and with good guile/scheme programming support still makes sense. If/which elisp libraries and programs can be supported can still be discussed, but don't need to be the first priority. neovim etc imo show that there are many helpers out there that make extending such a project to whatever you need possible. as a sidenote: i found this library interesting http://www.nongnu.org/libruin/... maybe just because i recently discovered GNU hyperbolas efforts with UXP, the remainder of XUL. but i don't know enough about it to say much. the idea of working with a gui "meta-protocol" based on XML that's not specific to a toolkit seems appealing to me, to make flexible GUI backend implementation easily possible (maybe other OS; or visual environments like VR; games). Emacs has just now, in a several years-long effort gotten to pgtk, which is as GTK+ already outdated... as afurther sidenote, IF one wants to start with a gui implementation, one could also look into EFL.

well, i think i will try to gather all info i've found into a markdown page and post it at https://man.sr.ht/~whereiseveryone/guixrus ,as i'm familiar with that community

spk121 commented 2 years ago

I've been down this road a couple of times. I mentioned the gano project, that I quit. I once wrote ed in Guile. And then this zile port, which I bashed out quickly and was really easy because upstream was already using a lisp. I just replaced that lisp with Guile. Then there was another Gtk editor widget I used in a game once, someplace.

Your easiest road forward would be to either get a text editing widget (Gtk, Qt) and do a thin wrapper around it, or to take an existing extensible editor and swap out the interpreter (guile-emacs, rxi/lite, and many more).

You'll need to decide if the top level language is Guile, or if you are using Guile as an extension language. If top level is Guile, your toolkit options are SDL or Gtk (via g-golf or guile-gi). If you're doing character based, guile-ncurses works, but, the way curses works is very old-school and odd. Julian did some cool things with libruin, but, I don't think it is the way to go, IMHO.

Another existing work is emacsy, which is worth checking out.

I think libfive has an editor widget as well, though I've never used it.

I wish you luck. It is not hard, but, it is probably harder that you imagine it to be. Honestly, maybe the best thing to do is to create the community of interest first and let the effort flow from there. Because (as the meme says) the real text-editor-written-in-Guile is the friends we make along the way.

xparq commented 1 year ago

(Agreeing with the last comment about community accretion, here's my foot in the door, so that GitHub can maintain this connection for me, even if I forget... :)

Enjoying the nice, insightful discussion, thanks!)