How To Install elpa-fsm on Ubuntu 18.04

In this tutorial we learn how to install elpa-fsm on Ubuntu 18.04. elpa-fsm is state machine library

Introduction

In this tutorial we learn how to install elpa-fsm on Ubuntu 18.04.

What is elpa-fsm

elpa-fsm is:

fsm.el is an exercise in metaprogramming inspired by gen_fsm of Erlang/OTP. It aims to make asynchronous programming in Emacs Lisp easy and fun. By “asynchronous” I mean that long-lasting tasks don’t interfer with normal editing.

Some people say that it would be nice if Emacs Lisp had threads and/or continuations. They are probably right, but there are few things that can’t be made to run in the background using facilities already available: timers, filters and sentinels. As the code can become a bit messy when using such means, with callbacks everywhere and such things, it can be useful to structure the program as a state machine.

In this model, a state machine passes between different “states”, which are actually only different event handler functions. The state machine receives “events” (from timers, filters, user requests, etc) and reacts to them, possibly entering another state, possibly returning a value.

The essential macros/functions are: ;; define-state-machine - create start-FOO function define-state - event handler for each state (required) define-enter-state - called when entering a state (optional) define-fsm - encapsulates the above three (more sugar!) fsm-send - send an event to a state machine fsm-call - send an event and wait for reply

fsm.el is similar to but different from Distel: URL:http://fresh.homeunix.net/~luke/distel/ Emacs’ tq library is a similar idea.

There are three methods to install elpa-fsm on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install elpa-fsm Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install elpa-fsm using apt-get by running the following command:

sudo apt-get -y install elpa-fsm

Install elpa-fsm Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install elpa-fsm using apt by running the following command:

sudo apt -y install elpa-fsm

Install elpa-fsm Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install elpa-fsm using aptitude by running the following command:

sudo aptitude -y install elpa-fsm

How To Uninstall elpa-fsm on Ubuntu 18.04

To uninstall only the elpa-fsm package we can use the following command:

sudo apt-get remove elpa-fsm

Uninstall elpa-fsm And Its Dependencies

To uninstall elpa-fsm and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove elpa-fsm

Remove elpa-fsm Configurations and Data

To remove elpa-fsm configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge elpa-fsm

Remove elpa-fsm configuration, data, and all of its dependencies

We can use the following command to remove elpa-fsm configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge elpa-fsm

References

Summary

In this tutorial we learn how to install elpa-fsm package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.