all repos — mg.git @ master

Fork of troglobit's fork of mg text editor

ae007e2e
newline by default

Signed-off-by: David Goudou <david.goudou@gmail.com>
David Goudou david.goudou@gmail.com
Wed, 07 Aug 2024 17:19:15 +0100
ab58fcd6
disable backups

Signed-off-by: David Goudou <david.goudou@gmail.com>
David Goudou david.goudou@gmail.com
Wed, 07 Aug 2024 17:18:39 +0100
fbc84fc7
Let C-u M-! and C-u M-| insert the result in current buffer

This change adds support for using the universal argument (C-u) with
shell-command (M-!) and shell-command-on-region (M-|) to insert the
result in the current buffer instead of opening a separate buffer for
the result.

Signed-off-by: Omar Polo <op@openbsd.org>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Omar Polo op@openbsd.org
Tue, 09 Jul 2024 14:46:17 +0000

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:

See the source distribution for the list of AUTHORS.

[^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.

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:

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

clone
git clone https://git.justdavid.org/mg.git