GNU Emacs introduction

Table of Contents

1 Intro

Most people who have seen Emacs (and quickly ran away :) ), think it is that nightmrish text editor that is hard to close: Press Ctrl-x + Ctrl-s to save the file, followed by Ctrl-x + Ctrl-c to close the editor.

emacs, user.png

But seriously:

  • Ever wanted to combine hierarchical structure, spreadsheets, intra/inter-document hyperlinks and inline diagrams all within single document, while having possibility to version and merge concurrent edits in GIT as easilly as plaintext file ?

    Yes! Emacs org-mode does it!

  • How about being able to syntax highlight, compile/execute received program source code in almost any programming language right from the email client ?

    Of course there are ~15 ways to read email in emacs. (I haven't tried them all but I use GNUS, newsreader and email client in one package)

  • Want to write scientific, human readable document with all the visually beautiful mathematical formulas and dynamic 2D/3D data visualizations that are computed by algorithms (possibly implemented by combining multiple programming languages), all embedded within the same document and executed right from the editor ?

    No problem! Donald Knuth came up with idea of literate programming enabling anyone to write program as structured and expressive as one wishes. Emacs has org-mode plugin that has plugin called Babel that integrates with ~50 programming languages enabling this functionality.

  • … all this, while playing some music in the background.

At the core, Emacs is simply Elisp (special dialect of Lisp programming language) interpreter and every user keystroke / mouse click just triggers corresponding lisp function.

The awesome part is that system has been alive and in constant improvement for more than 30 years!

Emacs evolved into huge integrated software bundle with lots of plugins and essentially tries to do everything. Most of the time offering several competing solutions.

2 Sample screenshots

multiedit.resized.png

In above example, structured note file is opened in 3 places simultaneously. Notes have SQL snippets rendered using syntax highlighting. Note file is organized in hierarchical structure, some of the nodes are selectively expanded. There is also a little embedded table rendered in text mode (blue). Org mode tables behave much like traditional spreadsheets (can sort rows, rearrange columns, embed formulas, etc..)

integration.png

Emacs integrates nicely with LOT of software (compilers, language interpreters, mathematical/statistical software etc…) providing seamless interoperability. In the example above 2D matrix it fed into Gnuplot for visualization.

Tron.png

Emacs in Tron Legacy movie :)

3 Miscellaneous

4 Shortcomings

  • Emacs lags behind modern IDE's for object oriented language support. Emacs cannot replace Eclipse, IntelliJ, Visual Studio etc. when it comes to code refactoring and really smart auto completion support for Java, .NET, C++ etc.

    Emacs does code parsing using combination of regular expressions and lisp which impose significant performance limitations. Such parsing isn't nearly as complete as parsers built into compiler itself.

    Also it appears that Richard Stallman fears and restrictions of code to code transformations (because it will be complex to enforce GNU license on derived code) contributed to limited GCC compiler <-> Emacs interoperability. Here is very recent, heated email thread on the subject.

  • Emacs is not intuitive for beginners and it's quite complex too (I quess complexity is inevitable for powerful tools). Expect lot of googling and tutorials reading. Emacs is quite expensive thing (in terms of your time investment) to learn.

5 Finally

emacs, evil.jpeg

There is EVIL mode in Emacs, it stands for E xtensible VI L ayer for Emacs. Essentially full VI emulator embedded in Emacs, so that you no longer have to choose between the two :)

There is also Emacs distribution with EVIL built in.


I hope this very brief overview gave you idea of whether Emacs could be useful to you and few pointers for further exploration.

Happy hacking !

6 Further reading

Author: Svjatoslav Agejenko

Created: 2021-02-11 N 00:36

Validate