From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Jose E. Marchesi" Newsgroups: gmane.emacs.devel Subject: [RFC] poke.el - Emacs interface for GNU poke Date: Wed, 30 Mar 2022 19:06:01 +0200 Message-ID: <871qyjbcau.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4518"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 30 19:07:37 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZbnF-00012I-Eh for ged-emacs-devel@m.gmane-mx.org; Wed, 30 Mar 2022 19:07:37 +0200 Original-Received: from localhost ([::1]:34486 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZbnE-0000Na-D7 for ged-emacs-devel@m.gmane-mx.org; Wed, 30 Mar 2022 13:07:36 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57514) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZbln-00070W-7D for emacs-devel@gnu.org; Wed, 30 Mar 2022 13:06:07 -0400 Original-Received: from [2001:470:142:3::e] (port=39554 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZblm-0003LY-Ul for emacs-devel@gnu.org; Wed, 30 Mar 2022 13:06:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=VY+Y3q4sIoyNBtR8eRry91bKpRZPCqgLHNyyk5CjF5Q=; b=Y5eIMWqYAXWFll V9T63z7yD0t4GITI6qCzrQzFwbfaE8oY9OlB/NBZZdnLWsWuSFQWtNen+rGXPLTwusCFTEb0fgcdK uHYBgFOEnnRNnvco8GrxsWdjvExdI6RYwtFX5SK9WfxkFrWqF/+JhTMUKpYkyvN2Lvf7nonTDcXfP PHz7nDpu48ws207WObKSWQDe/gG3cOnKEQTQXMhjNQuLTGa2DyF76wIBLCevHm1t57OGJKwSuClrS ib7ETDILFb0KuQb3nMjSq1o40tL840e5D5gbOs+oqz6wbVjCjBVUXru75y1MOTdNRtnGdNPO54Uol KHSQDUiwOfWfvkpYr3lg==; Original-Received: from [141.143.193.69] (port=47646 helo=termi.gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZblm-000891-H0 for emacs-devel@gnu.org; Wed, 30 Mar 2022 13:06:06 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:287617 Archived-At: 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: https://framatube.org/w/eMXntiH1syB81a2Tk2zhJX 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: emacs/poke.el poke-el.texi - 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 libpoke.so. 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: https://www.youtube.com/watch?v=5FN5uhcoAgc - 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 buffer. + 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 protocols. 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!