[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC] poke.el - Emacs interface for GNU poke

From: Jose E. Marchesi
Subject: [RFC] poke.el - Emacs interface for GNU poke
Date: Wed, 30 Mar 2022 19:06:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi good Emacs peoples!

I recently started writing an Emacs interface for GNU poke
(https://jemarch.net/poke) which is an extensible and very powerful
binary editor with support for defining your structures and operate on
them using a DSL (the Poke language.)

poke has a CLI, which works well enough, but of course my personal World
Domination Plan (TM) includes building a nice integrated IDE based on
Emacs and make it the mother of all binary editors.  No more hexl-mode
for me ;)

The interface is still in an early stage of development, but already
works and is already useful enough that I am not using the CLI anymore
in my daily poking.

The WIP interface has a repl, byte viewer, structure editor, mappings
list/tree, settings buffer, code evaluation buffer, output buffer.

You can see the WIP interface in action in this video which is an
introductory poke talk performed at the recent Libreplanet:


I am reaching out here because my Emacs lisp sucks and I would greatly
appreciate if people would look at it and let me know if I am doing
something terribly wrong and whether I am on the right track
implementation/design wise.  I would hate trapping myself into a massive
dead-end if it could be avoided :)

The plan is to contribute poke.el to ELPA once something stable is
achieved (and poke 3.x released.)

The interface lives in the emacs/ directory of the master branch in the
poke git repo: git.sv.gnu.org:/srv/git/poke.git.  It requires master
poke (what will become poke 3.x in a few months) in order to run:
currently released poke 2.x versions won't work.

Some notes on the implementation:

- The implementation is in a single file poke.el.  There is an
  accompanying manual poke-el.texi, which is of course WIP as well:


- Not to be confused with poke-mode.el which is a major mode for editing
  Poke code (based on SMIE and also in need of much love :/).
  poke-mode.el lives in the etc/ directory in the poke source tree.

- GNU poke is incarnated in the form of:

  + A shared library libpoke.so which contains the Poke incremental
    compiler, support for IO spaces, etc etc.

  + A CLI program `poke' that links with libpoke.so.

  + A little program `poked' (the poke daemon) that links with
  poke.el communicates with poke running an instance of poked (not the
  CLI) and then maintaining several asynchronous network processes over
  an Unix domain socket.  You can find information on poked and how it
  works in this talk by Mohammad-Reza Nabipoor:

- The interface is comprised by a set of related components that can be
  used relatively independently of each other.  Together they conform
  the IDE:

  + poke-repl is a REPL based on comint-mode.  I'm using the usual
    dirty trick of having a fake process associated with the comint

  + poke-out is where the stuff written by Poke programs is displayed.
    It is narrowed to the latest emitted output.  You can widen the
    corresponding *poke-out* buffer at any time to look at the output of
    previous interactions.

  + poke-code is a buffer where you can write Poke code and evaluate it.

  + poke-vu is a pokelet that shows a byte dump of the current open IO
    space.  It provides something similar to what hexl does.  It only
    fetches the minimum amount of data to fill the currently shown
    window (i.e. not the full file being edited) and emulates scrolling.
    Needs a lot more work to allow in-place editing etc.

  + poke-maps is a list of mapped Poke values.  You can use it to
    navigate through hierarchical structures like arrays and structs.

  + poke-edit is an editor for Poke complex structures (arrays and
    structs).  It uses the widget library.  Needs much love yet.

  + poke-settings provides a widgets-based little buffer to configure
    the run-time settings of poke (like output numeration base, etc) in
    a friendly way.

  + poke-ios provides a menu with a list of the currently open IO spaces
    (these are the entities edited by poke, like files, memory buffers,
    process' memory, etc.)

  + poke-complete is a pokelet that handles auto-completion of Poke
    code at the poke-repl.  It currently uses `completion-in-region' but
    it doesn't work very well.

- Most of the communication is done by sending Poke code to be evaluated
  by poke (see the poke-elvel pokelet) which often results in poke
  sending elisp code back to Emacs to be evaluated.  This is exceedengly
  fun and also very powerful: way better than using limited fixed

Any feedback is so very welcome!  (patches work best).  Feel free to
send it to either poke-devel@gnu.org or in this thread (if it is not
deemed too off-topic for emacs-devel.)

TIA, much appreciated!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]