Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vkazanov/elfuse
FUSE filesystems in Emacs Lisp
https://github.com/vkazanov/elfuse
c elisp emacs fuse libfuse
Last synced: 11 days ago
JSON representation
FUSE filesystems in Emacs Lisp
- Host: GitHub
- URL: https://github.com/vkazanov/elfuse
- Owner: vkazanov
- License: gpl-3.0
- Created: 2016-11-30T09:29:53.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-14T08:35:24.000Z (over 7 years ago)
- Last Synced: 2024-10-11T14:38:12.017Z (27 days ago)
- Topics: c, elisp, emacs, fuse, libfuse
- Language: C
- Homepage:
- Size: 106 KB
- Stars: 64
- Watchers: 9
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
* Elfuse
Elfuse is a little experiment in implementing a dynamic Emacs module. The idea is to expose *some*
of the libfuse possibilities to Emacs Lisp code.In other words, it should now be possible to implement file systems in Emacs lisp!
* Compile
Because Elfuse is a dynamic module, Emacs compiled with dynamic module support is required.
Currently (Emacs 25.1) this requires supplying a special flag at configure time (=--with-modules=).Additionally, Elfuse was developed and tested on Linux only (Ubuntu 16.04) using libfuse 2.9.4, no
guaranties on other platforms or libfuse versions.Compilation should be trivial on Linux with a recent GCC:
#+BEGIN_SRC
> cd elfuse/directory/
> make
#+END_SRC* Running Examples
To run one of the Elfuse examples in the =examples= directory using a config-less separated Emacs
instance do something like the following:#+BEGIN_SRC
> cd elfuse/directory/
> mkdir mount
> make hello.el
> # an emacs window will open
> # do M-x elfuse-start "mount/" to mount an Elfuse instance to the mount/ path
> ls mount/ # a few fake files should appear here
> # do M-x elfuse-stop to unmount Elfuse
#+END_SRCThis will start Emacs with Elfuse loaded and load an example Elfuse project. In fact, this is *the*
recommended way to run Elfuse instances (i.e., =emacs -Q --load elfuse.el=).Notice that =elfuse-start= / =elfuse-stop= functions are main user-visible entry points.
Examples included:
- =hello.el= - a static list of files with dummy content
- =hello-2.el= - a dynamic list of files, i.e. it's possible to create a file in the mount path
- =list-buffers.el= - expose a list of emacs buffers as a list of files. Only buffers having names
compatible with POSIX portable filename definition will be listed. Buffer content will also be
mirrored. Is is possible to create an Emacs buffer using =touch=.- =write-buffer.el= - edit an emacs buffer (=*Elfuse buffer*=) from the terminal.
* Additional Notes
Elfuse currently doesn't have much documentation apart from the source code and =examples/*.el=. To
play with the library the user will have to consult the examples.Also, it is strictly *not* recommended to try to list the mounted Elfuse directory using the same
Emacs instance that runs Elfuse. This will definitely block Emacs.Elfuse runs a libfuse loop using a dedicated (Pthread) thread. When syscalls arrive the thread
signals (sends a SIGUSR1 signal) the main Emacs thread and blocks until the main thread finds time
to respond to the request.Elfuse currently does not support mounting multiple FUSE paths. Actually, it uses a single set of predefined
callback names (i.e. =elfuse--readir-op=).In case things go wrong =fusermount -u path/to/a/mount= should help.
In case things go HORRIBLY wrong =umount -f path/to/a/mount/= should do the trick.
* Background
Some time ago I wrote [[https://github.com/vkazanov/toy-orgfuse][quick Python script]] that allows to mount org-mode files as FUSE filesystems.
The obvious problem with the script was that it needed a custom Org-mode file parser, which would
always lag behind the mainstream Org-mode and would miss important features. I was wondering if
using the native parser was possible.As some point [[http://nullprogram.com/][Chris Wellons]] jumped in and mentioned that it might be possible to implement a
dynamic Emacs module doing just that: Emacs Lisp bindings to FUSE. Which I did! Later on Chris
came up with a [[http://nullprogram.com/blog/2017/02/14/][blog post]] about the way Elfuse works. Elfuse uses a few interesting tricks so if
you're interested in details - just follow the link.