Skip to content
 
 

Latest commit

 

History

868 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Femto

Femto is an extended version of Atto Emacs with a tiny Lisp extension language.

Femto screenshot

Femto screenshot

A designer knows he has achieved perfection not when there is nothing left to add, but when there is nothing left to take away. -- Antoine de Saint-Exupery

Documentation

Femto comes with Markdown and HTML documentation. To rebuild the documentation Pandoc is required. Rebuild both documentation formats from their respective source files by running:

make doc

The documentation is prebuilt in this repository and can be found in

femto.md (HTML)

See the roadmap for future directions.

Goals of Femto Emacs

  • To be an extendable version of the Atto Emacs editor using a Tiny Lisp extension language
  • Provide a number of useful extension packages written in fLisp (these include an interface to git (similar to GNU Emacs Magit), a small version of dired, a buffer management menu (buffer menu), defmacro allows for a macro to be recorded and invoked using c-x e, and an interface to grep.
  • Be easy to understand without extensive study (to encourage further experimentation).

What does Femto bring to the party of Text Editors

As far as I know Femto is the only Emacs style editor to provide a macro recorder that generates usable Lisp code that can then be used to build a larger, more complex utility. Whilst GNU Emacs has a macro recorder facility it only allows you to dump out the keystrokes used during macro recording. Femto does this by writing the lisp code to a text buffer called macro. Though I have tried dozens of text editors over the years (mostly on PCs, but a few on mini and mainframe computers) I am not aware of any other editor that works this way. This feature was born out of the principle of keeping a small editor code written in C and where possible using Lisp to implement new features. The standard Emacs macro keystrokes [C-x (, C-c ), C-x e] are all written in Lisp in the file examples/defmacro.lsp. This meant that no special C code was needed in Femto to know when it was in macro mode or not.

Why the name Femto?

The small Emacs naming scheme appears to use sub-unit prefixes in decending order with each further reduction of functionality. The Nano and Pico Emacs editors have been around for a while.

  • Nano means 10 to the power of minus 9
  • Pico means 10 to the power of minus 12
  • Femto means 10 to power of minus 15
  • Atto means 10 to power of minus 18
  • Zepto means 10 to the power of minus 21
  • Zep is smaller version of Zepto Emacs

In Defining Atto as the lowest functional Emacs I have had to consider the essential feature set that makes Emacs, 'Emacs'. I have defined this point as a basic Emacs command set and key bindings; the ability to edit multiple files (buffers), and switch between them; edit the buffers in multiple windows, cut, copy and paste; forward and reverse searching, a replace function and basic syntax hilighting. The proviso being that all this will fit in less than 2000 lines of C.

Femto is an extended version of Atto Emacs with its own extension language fLisp and less then 12.000 lines of C and Lisp.

History

  • In late 2015 Hugh Barney wrote the Atto editor 'A minimum functioning Emacs in less than 2000 lines of C'. Atto was based on Anthony Howe's editor (commonly known as Anthony's Editor or AE, [2]).
  • Femto is based on the Atto codebase [0]
  • Femto was originally an intermediate project to form a codebase for the FemtoEmacs Editor [8], [9] which was a collaboration between Hugh Barney, Ed Costa and Lucas Guerra. FemtoEmacs uses Jeff Bezanson's Femtolisp LISP [10] implementation as the basis for its extension language. However the Femtolisp codebase is in excess of 12K line of code and fairly difficult to understand how to use it inside an embedded application.
  • In late 2016 Hugh Barney decided to look for a smaller lisp implementation for Femto and settled on Tiny-Lisp[7] by Mattias Pirstitz.
  • Zepl was an initial project that established the suitability of Tiny-Lisp for use within an Emacs type editor. The results surpassed expectations.
  • In late 2017 Hugh Barney decided to return to the Femto editor and extend it using Tiny-Lisp.
  • In 2023-2026 Georg Lehner refactored the Lisp infrastructure and started to fix and add additional Emacs functionality.

For a full version history please refer to the file CHANGE.LOG.md for past and future plans see the Femto

Comparisons with Other Emacs Implementations

Femto has almost the same level of editor functionality as MicroEmacs 3.10 plus a fully featured Lisp extension language for a codebase less then half of the size.

Editor         Binary   BinSize     KLOC  Files

atto           atto       33002     1.9k      10
pEmacs         pe         59465     5.7K      16
Esatz-Emacs    ee         59050     5.7K      14
femto          femto     166472     7.4k/2.4k 36/10 **
GNOME          GNOME      55922     9.8k      13
Zile           zile      257360    11.7k      48
Mg             mg        585313    16.5K      50
uEmacs/Pk      em        147546    17.5K      34
Pico           pico      438534    24.0k      29
Nano           nano      192008    24.8K      17
jove           jove      248824    34.7k      94
Qemacs         qe        379968    36.9k      59
ue3.10         uemacs    171664    52.4K      16 ++
GNUEmacs       emacs   14632920   358.0k     186

** KLOC: C / Lisp lines
   Files: total files / fLisp only files.

Since Femto 2.12 C code is being moved out to Lisp, since Femto 2.25 fLisp has been moved out of the Femto source tree.

Building

Note: this is the README for the unofficial Femto 2.25.* releases. All relevant links point to the Github account jorge-leon, all credits go the original author hughbarney.

Build Dependencies

ncurses and pkgconf

Debian and Ubuntu:

Before ncurses 6 and as of Femto 1.2 you will need to install the libcurses dev package.

$ sudo apt-get install libncurses5-dev libncursesw5-dev pgkconf

Since ncurses 6:

$ sudo apt-get install ncurses-dev pkgconf

Alpine Linux:

$ sudo apk add ncurses-dev pkgconf

NetBSD:

$ doas pgkin install ncurses pkgconf

FreeBSD:

$ doas pkg install devel/ncurses pkgconf

fLisp

Since Femto 2.25 fLisp is split out into its own source tree so it has to be installed separately.

From source:

git clone https://github.com/jorge-leon/flisp
cd flisp
make
sudo make install-dev install-lib

Or download suitable flisp-dev and flisp-common Debian Packages from https://github.com/jorge-leon/flisp/releases and install them with

sudo dpkg -i flisp-dev_*version*_*arch*.deb flisp-common_*version*_*arch*.deb

Build, Test and Installation

$ git clone https://github.com/jorge-leon/femto.git
$ cd femto
$ git switch femto-fixes
$ make femto
$ make test
$ sudo make install

Packages

Prebuilt packages for Debian and Alpine Linux are available.

Alpine Linux provides femto in the "testing" repository. Versions lag some months behind releases.

Development

See the coding style guide.

Pandoc and tidy is required for doc generation.

  • Debian/Ubuntu: sudo apt-get install pandoc tidy
  • Alpine: sudo apk add pandoc-cli tidyhtml
  • NetBSD: doas pkgin install pandoc-cli tidy
  • FreeBSD: doas pkg install hs-pandoc tidy-html5

There is a Doxyfile to create full cross references and call graphs.

Usefull build targets:

  • femto: build femto binary
  • doc: build some markdown files from Poshdoc and some html files from markdown
  • doxygen: build the Doxygen source code documentation
  • measure: count # of files and code lines
  • test: run unit tests in summary mode
  • check: run unit tests and return success if none fails
  • ftest: call femto several times with different commandline parameters.
  • val: run femto with valgrind. Logs are found in val.log
  • clean: clean up build artifacts
  • deb: build Debian package
  • install/uninstall: install/uninstall locally

Make sure to run:

make clean test
make clean ftest
make clean doc

before commiting code to Github.

Note: build on NetBSD and FreeBSD is currently not working.

Copying

Femto code is released to the public domain. hughbarney@gmail.com November 2017, jorge@magma-soft.at 2023

References

About

Femto, an extended version of Atto Emacs with a Tiny Lisp extension language

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages