• Stars
    star
    293
  • Rank 141,748 (Top 3 %)
  • Language
    C
  • License
    The Unlicense
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Micro (GNU) Emacs-like text editor ❤️ public-domain

Micro (GNU) Emacs

License Badge GitHub Status Coverity Status

Contents

Introduction

Mg is a Micro Emacs clone created in 1987, based on the original MicroEMACS v30 released by Dave Conroy in 1985. The name, "Micro GNU Emacs", was disputed early on by the FSF, so today it simply goes by mg. This software is fully free and in the public domain.

The intention is to be a small, fast, and portable Emacs-like editor for users who cannot, or do not want to, run the real Emacs for one reason or another. Compatibility with GNU Emacs is key for Mg, separating it from other ErsatzEmacs clones, because there should never be any reason to learn more than one Emacs flavor.

Try the latest release, use the tarball with a version in the name, avoid GitHub generated links! Releases come with a configure script, so you don't need autotools. Only a C compiler, make and you're set to go.

Usage

When Emacs was born keyboards had a Meta key. Accessing functions with Meta combinations today is usually the same as holding down the Alt key, or tapping Esc once.

Other editors use short forms like Ctrl-V or ^V, in Emacs this is written C-v. Some usage examples:

Key Short Example Description
Meta M- M-x Hold down Alt and tap x
Ctrl C- C-g Hold down Ctrl and tap g
Ctrl C- C-x C-c Hold down Ctrl then tap x and c

To access the built-in Quick Help, press C-h q, meaning: hold down Ctrl and tap h, then release Ctrl and tap q. The - has a meaning, as you can see.

Building

This project is completely self hosting. However, by default you need a termcap library, like Ncurses, to provide APIs like: setupterm(), tgoto(), and tputs().

See below for how to build without Ncurses.

With termcap/terminfo/curses

On recent Debian/Ubuntu based systems libtinfo-dev can be used, on older ones the include file term.h is missing, so libncurses-dev must be used instead:

sudo apt install libtinfo-dev

or

sudo apt install libncurses-dev

On other systems you have to install the full Ncurses library instead, on RHEL, CentOS, and Fedora:

sudo yum install ncurses-devel

or

sudo dnf install ncurses-devel

On macOS you need the Xcode command line tools and headers:

xcode-select --install

Then build Mg from the unpacked release tarball:

./configure
make
sudo make install

Without curses, completely stand-alone

make clean
./configure --without-curses
make
sudo make install

Building from GIT

Users who checked out the source from GitHub must run ./autogen.sh first to create the configure script. This requires GNU autotools to be installed on the build system.

There are several options to the configure script to disable features, e.g., to reduce the size, or remove features if you want to be on par with the official Mg. By default, all below features are enabled:

./configure --help
[..]
--disable-autoexec   Disable auto-execute support
--disable-cmode      Disable C-mode support
--disable-compile    Disable C compile & grep mode, used by C-mode
--disable-cscope     Disable Cscope support
--disable-ctags      Disable ctags(1) support, required by Cscope
--disable-dired      Disable directory editor
--disable-notab      Disable notab mode support (not in OpenBSD)
--disable-regexp     Disable full regexp search
--disable-togglenl   Disable toggle-newline-prompt extension (not in OpenBSD)
--disable-all        Disable all optional features
[..]
--with-startup=FILE  Init file to run at startup if ~/.mg is missing
--with-mglog         Enable debugging to log file, default: ./log/*.log
--without-curses     Build without curses/termcap, default: auto

To build the smallest possible mg, with many features removed:

./configure --disable-all --enable-size-optimizations
make
sudo make install-strip

To build a completely static mg with all features:

./configure LDFLAGS="-static"
make
sudo make install-strip

Docker

Alpine Linux based Docker container images are available from GitHub:

docker pull ghcr.io/troglobit/mg:latest

To edit files from your host's $HOME, map it to the container's /root and run:

docker run -ti -v $HOME:/root ghcr.io/troglobit/mg:latest

This supports reading your ~/.mg and it even takes arguments on the command line. Both quick help and the tutorial are bundled.

History

The history is long and intertwined with other MicroEMACS spin-offs but goes something like this:

  • Nov 15, 1985: MicroEMACS v30 released to mod.sources by Dave G. Conroy
  • Mar 3, 1987: First Release (mg1a) via comp.sources.unix
  • May 26, 1988: Second release: (mg2a) via comp.sources.misc
  • Jan 26, 1992: Linux port released by Charles Hedrick. This version later makes its way onto tsx-11, Infomagic, and various other Linux repositories.
  • Feb 25, 2000: First import into the OpenBSD tree, where it is currently maintained with contributions from many others.
  • May 8, 2016: Import from OpenBSD 5.9 to GitHub
  • May 15, 2016: Mg v3.0, first port back to Linux, by Joachim Wiberg
  • Jul 22, 2018: Mg v3.1, removed libite dependency, by Joachim Wiberg
  • Aug 26, 2018: Mg v3.2, now fully portable1, by Joachim Wiberg
  • Dec 11, 2019: Mg v3.3, misc fixes and new features from OpenBSD
  • Aug 23, 2020: Mg v3.4, new modeline, quick-help, support for gzipped files, and building without termcap/Ncurses, by Joachim Wiberg
  • Oct 17, 2021: Mg v3.5, support for Solaris/Illumos based UNIX systems tested on OmniOS and OpenIndiana, sync with Mg from OpenBSD 7.0
  • Apr 10, 2023: Mg v3.6, sync with OpenBSD, improved ctags support

See the source distribution for the list of AUTHORS.

Origin & References

This project is derived from OpenBSD Mg, which is the best (maintained) source of the original Micro Emacs based on mg2a. The intention of this project is to develop new usability features, track as many other Mg clones as possible, and, unlike the upstream OpenBSD version, enable hidden features using a standard GNU configure script, while remaining friendly to porting to resource constrained systems. New features:

  • Emacs-like modeline with (row,col) and new display-time-mode
  • Support for building without curses, using termios + escape seq.
  • Support for exhuberant/universal ctags tags file format
  • Built-in *quick* help using C-h q
  • Tutorial accessible using C-h t
  • Support for Ctrl-cursor + Ctrl-PgUp/PgDn like Emacs
  • Support for M-x no-tab-mode and M-x version
  • Support for opening gzipped text files in read-only mode

Merged, and continously tracked, clones:

Note: the official portable Mg project, used by Debian and other GNU/Linux distributions, is maintained by Han Boetes. Unlike this project, which is stand-alone, Boetes relies on libbsd to maintain portability.

Please report any bugs and problems with the packaging and porting to the GitHub issue tracker https://github.com/troglobit/mg/issues

Footnotes

  1. This project has been extensively tested on Debian GNU/Linux, Ubuntu, CentOS, Fedora, Alpine Linux, Solaris/Illumos based systems like OmniOS, FreeBSD, NetBSD, OpenBSD, DragonFly BSD, Apple macOS >= 10.10, Cygwin, MSYS2, as well as a few embedded Linux systems using musl libc and uClibc-ng.

More Repositories

1

inadyn

In-a-Dyn is a dynamic DNS client with multiple SSL/TLS library support
C
782
star
2

finit

Fast init for Linux. Cookies included
C
576
star
3

redir

A TCP port redirector for UNIX
C
349
star
4

editline

A small replacement for GNU readline() for UNIX
C
254
star
5

libuev

Lightweight event loop library for Linux epoll() family APIs
C
218
star
6

smcroute

Static multicast routing for UNIX
C
216
star
7

pimd

PIM-SM/SSM multicast routing for UNIX and Linux
C
194
star
8

watchdogd

Advanced system monitor & process supervisor for Linux
C
193
star
9

uftpd

FTP/TFTP server for Linux that just works™
C
162
star
10

mcjoin

Simple multicast testing application
C
130
star
11

merecat

Small and made-easy HTTP/HTTPS server based on Jef Poskanzer's thttpd
C
129
star
12

tetris

Micro Tetris™, based on the 1989 IOCCC Obfuscated Tetris by John Tromp
C
107
star
13

uredir

A UDP port redirector for UNIX
C
87
star
14

myLinux

myLinux is an embedded operating system based on Buildroot and Finit
Shell
73
star
15

sysklogd

BSD syslog daemon with syslog()/syslogp() API replacement for Linux, RFC3164 + RFC5424
C
71
star
16

mtools

Tools for multicast testing (msend and mreceive). I do however recommend you try out mcjoin(!) or mping instead.
C
69
star
17

mrouted

The original DVMRP (dynamic multicast routing) implementation for UNIX
C
65
star
18

mini-snmpd

A minimal SNMP agent implementation
C
63
star
19

netcalc

Simplified clone of sipcalc with ipcalc looks
C
60
star
20

xplugd

Monitor, keyboard, and mouse plug/unplug helper for X
C
59
star
21

libite

That missing frog DNA you've been looking for
C
58
star
22

ssdp-responder

SSDP responder for UNIX systems that gives you an InternetGatewayDevice icon in Windows :)
C
53
star
23

mdnsd

Jeremie Miller's original mdnsd
C
49
star
24

sntpd

sntpd is a fork of Larry Doolittle's ntpclient with added daemon, syslog, and IPv6 support
C
42
star
25

adventure

Classic Colossal Cave Adventure
C
42
star
26

omping

Open Multicast Ping (omping) is a tool for testing IPv4/IPv6 multicast connectivity on a LAN.
C
33
star
27

snake

Micro Snake, based on Simon Huggins snake game.
C
30
star
28

pok3r-layouts

Vortex POK3R keyboard layouts for Linux, Windows and OS X/macOS. Based on:
28
star
29

rfctl

Linux driver and control tool for 433 MHz communication on Raspberry Pi
C
25
star
30

sun

Simple library and application that shows sunset and sunrise based on your latitude,longitude
C
23
star
31

jush

just give me a unix shell
C
22
star
32

lipify

C API for http://ipify.org
C
19
star
33

pim6sd

PIM for IPv6 sparse mode daemon
C
19
star
34

tinyroot

Small busybox based embedded Linux root file system
Makefile
17
star
35

mping

A simple multicast ping program
C
17
star
36

pimd-dense

Continuation of the original pimd-dense from 1998-1999, gaps filled with frog DNA from pimd
C
14
star
37

pev

Portable Event Library
C
14
star
38

libicmp

Very simple library for sending and receiving ICMP datagrams.
C
13
star
39

backlight

Very simple program to control the backlight brightness of a laptop
C
13
star
40

getty

Minix getty
C
10
star
41

pacman

UNIX pacman game by Dave Nixon, AGS Computers Inc. (1981) with curses support by Mark Horton (1982)
C
10
star
42

uget

Really stupid get-file-over-http program/function
Shell
10
star
43

toolbox

Misc. home brewed code, free to use under GPL/MIT/ISC, see each snippet for license.
C
9
star
44

mrdisc

Stand alone UNIX implementation of RFC4286 Multicast Router Discovery Protocol
C
9
star
45

uemacs

MicroEMACS by Dave Conroy
C
8
star
46

aliens

UNIX aliens game by Jude Miller, Cambridge (1979) with curses support by Mark Horton (1981)
C
7
star
47

nlmon

Simple example of how to use libnl and libev to monitor kernel netlink events
C
7
star
48

quagga

Westermo Quagga. See security/0.99.17 branch for ported CVE fixes and westermo/0.99.17 for patches on top of that. For more information, see the Wiki.
C
7
star
49

keepalived

Health-checking for LVS and high availability
C
6
star
50

ttinfo

Display information about a process, group or tty
C
6
star
51

awesome-config

My awesome window manager configuration
Lua
5
star
52

finit-plugins

Plugin Repository for Finit
C
5
star
53

zoo

public domain zoo archive tool
C
5
star
54

logit

tiny log helper
C
5
star
55

MicroEMACS

MicroEMACS v3.6 by Dave Conroy and Daniel Lawrence from 1986. Free in the public domain.
C
5
star
56

cx

Small wrapper for basic lxc tasks
Shell
5
star
57

awesome-redshift

Ryan Young's small, simple lua library for interfacing the Awesome window manager with redshift
Lua
5
star
58

crobots

CROBOTS is a programming game, for (aspiring) programmers
C
5
star
59

gul

The one true GUL editor!
C
5
star
60

awesome-plain

Plain barebones AwesomeWM setup
Lua
4
star
61

usbctl

A user space tool to operate on USB devices.
C
4
star
62

mctools

Collection of (old) multicast tools
C
4
star
63

deb

Signing key(s) for .deb repository
3
star
64

booz

Zoo Extractor/Lister by Rahul Dhesi
C
3
star
65

sniffer

sniff packets from interface store in db for analysis
C
3
star
66

zroute

Very simple command line client for managing Zebra static routes from the command line. Useful if Zebra is your route manager and you want your DHCP client, or PPPoE client, to set default gateway dynamically via Zebra instead of as kernel routes.
C
3
star
67

libc-chaos

Emit random errors when calling libc functions to emulate an unstable underlying system
C
3
star
68

misc

Misc. helpers, in the public domain
Makefile
2
star
69

alpine-qemu-image

Create bootable Qemu images fro Alpine Linux ISO
Shell
2
star
70

ns

Example of how to use getaddrinfo()
C
2
star
71

awesome-light

Lua library for controlling screen and keyboard brightness from Awesome WM
Lua
2
star
72

plotty

Library for text terminal plotter
C
2
star
73

klish-plugin-sysrepo

Mirror of Serj Kalichev's klish plugins for sysrepo
C
2
star
74

faux

Mirror of Serj Kalichev's auxillary functions library
C
2
star
75

troglobit.github.io

Personal website and blog
CSS
2
star
76

demo

Collection of ASCII art demos
C
1
star
77

ubot

very small and stupid irc bot
C
1
star
78

awesome

My awesome-copycats adaptions
Lua
1
star
79

logrun

An event-based, regexp-triggered, job runner ...
Perl
1
star
80

klish

Mirror of Serj Kalichev's klish
C
1
star
81

br2-finit-demo

Demo of Finit (FastInit) in Buildroot
Makefile
1
star
82

zephyr-uart-test

Playground for the Zephyr UART
C
1
star
83

busybox-builder

busybox defconfig++ binaries
Shell
1
star
84

bridged

Linux bridge helper daemon
C
1
star
85

weatherd

Hackish weather data logger for my homemade Raspberry Pi based weather station
C
1
star