On Sun, 04 Sep 2016 19:38 +0200, Thorsten Jolitz wrote:
> Hi List,

Hi Thorsten!

> recently I found out about Femto, a minimal Emacs implementation in less
> than 2k lines of C (including ncurses, though):
> ,----
> | git clone https://github.com/hughbarney/femto.git
> `----
> [...]
> There is already a project underway using FemTo-Lisp as extension
> language
> ,----
> | git clone https://github.com/FemtoEmacs/Femto-Emacs.git
> `----

Ah, yes.  Very nice!  I downloaded this myself and tested it.  I can run
the flisp code and write my own extensions!  (There is a lisp function
called `keyboard`[1] that dispatches keychords to lisp

[1] This function is in `init.lsp` which should be copied from the
distro directory into one's home directory.  BTW, once I copied it into
my home directory, the next time I loaded a C or lisp file into the
editor, it was syntax-highlighted.  The highlighting has been added via
extension language (flisp) code.  Nice.

> but I thought this would be a perfect use case for an 'AW-style' FFI
> library making use of 'native'. Then, PicoLisp could have its own
> (Window/Buffer)-Editor, not just the LineEditor, with all the core
> Editor-Functions just wrappers around Femto's C-functions.
> But lacking C skills have me stuck in the very beginning: how to turn
> this C application into a shared library for 'native', does it even
> make sense?
> I guess I should:
>  1. create a shared library for all .c files in the repo except main.c
>  2. create the application (main.o) linking the shared library? 
> But then, the shared library by itself does not make much sense, it
> would need the running C Application to do some useful work (?) 

Don't see *exactly* what your driving at, but the part you write here,
just below, is more clear to me.

> So the queston seems rather how to embed PicoLisp in this C Application,
> and make Femto extensible in PicoLisp (like Emacs is extensible in Emacs
> Lisp) by having FFI wrappers for all core editor functions?

Yes, this is more clear to me since that is what Femto-Emacs's author
did.  Specifically, he yanked out the standard flisp REPL and wired in
his own C functions to talk to flisp (i.e. run flisp's eval, capture the
result returned and handle the "print" accordingly).  flisp itself is
compiled and rolled into static libraries and then statically (of
course) linked into the Femto-Emacs binary (`femto`).

> The 
> ,----
> | /home/tj/gitclone/Femto-Emacs/femtolisp
> `----
> subdirectory makes the general "Lisp integration task" look rather
> complicated, but maybe there is (like so often) a really simple solution
> with PicoLisp?

Not exactly sure, but I believe that your idea is a doable thing, i.e.
that picolisp can just replace femtolisp in the same situation described

> cheers,
> Thorsten

Best, --Rick (rick42)
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to