Re: PicoLisp as Femto extension language

2016-09-05 Thread Thorsten Jolitz
Thorsten Jolitz 
writes:

Hi List, 

[funny enough, in GNUS Ricks posts to this thread don't show up for me,
while I can see them in the www.mail-archive.com, so I follow up to my
own post instead of his.]

My original idea was to compile Femto as shared library, create FFI
wrapper libraries for PicoLisp, and have buffers instead of only a
single line to edit and evaluate PicoLisp code. A bit naive probably.

Replacing Femto-lisp with PicoLisp as extension language seems to be the
way to go, but is over my head I'm afraid. I thought, with the core
editor functions already defined in C (using the gap buffer concept), it
would be just about wrapping these basic functions (and data structures)
in PicoLisp and one could start to write cool interactive editor
features based on this Core libraries, just like in Emacs (Lisp).

But solving the fundamental communication problem between the two
systems is something else ...

Thanks for the anwsers, Rick.


> Hi List,
> 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
> `
>
> ,
> | Femto is an extended version of Atto Emacs.
> | 
> | In Defining Atto as the lowest functional Emacs I have had to
> | consider the essential feature set that makes Emacs, 'Emacs'. [...]
> `
>
> ,
> |  Goals of Femto Emacs
> | 
> |   * To extend Atto Emacs with filename completion, dired, buffer
> | menu and the ability to run a shell command.
> |   * Provide a rich level of functionality in the smallest amount of
> | code
> |   * Femto Emacs will eventually have it own lisp extension
> | languauge.
> |   * Be easy to understand without extensive study (to encourage
> | further experimentation).
> `
>
> There is already a project underway using FemTo-Lisp as extension
> language
>
> ,
> | git clone https://github.com/FemtoEmacs/Femto-Emacs.git
> `
>
> 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 (?) 
>
> 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?
>
> 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?

-- 
cheers,
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: PicoLisp as Femto extension language

2016-09-04 Thread rick
On Sun, 04 Sep 2016 19:38 +0200, Thorsten Jolitz wrote:
> The 
> 
> ,
> | /home/tj/gitclone/Femto-Emacs/femtolisp
> `
> 
> subdirectory makes the general "Lisp integration task" look rather
> complicated, [...]

BTW, this subdirectory `femtolisp` just contains a copy of the original
femtolisp repo:

  https://github.com/JeffBezanson/femtolisp

with some of the Femto-Emacs author's tweaks (not much[1]) for embedding
femtolisp into Femto-Emacs.

___
[1] The addition of just these files AFAICT: flcall.c and
interface2editor.c (which are 770 total LOC), and "ripping out" the REPL
in femtolisp, which amounted to deleting 9 lines in `system.lsp` (giving
`femtosystem.lsp` and thus `femto.boot`).
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: PicoLisp as Femto extension language

2016-09-04 Thread rick
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
functions/functionality.)

[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
above.

> cheers,
> Thorsten

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


Re: PicoLisp as Femto extension language

2016-09-04 Thread Jakob Eriksson
These questions go a bit over my head, but Femto with Pico has a nice ring to 
it. :-)

> 4 sep. 2016 kl. 19:38 skrev Thorsten Jolitz :
> 
> 
> Hi List,
> 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
> `
> 
> ,
> | Femto is an extended version of Atto Emacs.
> | 
> | In Defining Atto as the lowest functional Emacs I have had to
> | consider the essential feature set that makes Emacs, 'Emacs'. [...]
> `
> 
> ,
> |  Goals of Femto Emacs
> | 
> |   * To extend Atto Emacs with filename completion, dired, buffer
> | menu and the ability to run a shell command.
> |   * Provide a rich level of functionality in the smallest amount of
> | code
> |   * Femto Emacs will eventually have it own lisp extension
> | languauge.
> |   * Be easy to understand without extensive study (to encourage
> | further experimentation).
> `
> 
> There is already a project underway using FemTo-Lisp as extension
> language
> 
> ,
> | git clone https://github.com/FemtoEmacs/Femto-Emacs.git
> `
> 
> 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 (?) 
> 
> 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?
> 
> 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?
> 
> -- 
> cheers,
> Thorsten
> 
> -- 
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe