📜 ⬆️ ⬇️

Well tuned emacs

All you need to know in order to quickly and correctly configure Emacs.


Emacs [“Editor MACroS”, / ˈeditər ˈmakrōs / → / ˈemaks /, hereinafter referred to as “emax”] was created a long time ago at the MIT AI Lab artificial intelligence laboratory of the Massachusetts Institute of Technology. Emax is a text editor behavior and the possibilities of which change right while writing text in it in a programming language in which emax is written. Moreover, right at the time of writing in the emax of the text in the programming language in which the emax itself is written, the behavior and capabilities of the programming language in which the emax is written changes. All this makes emaks the most flexible and versatile text editor in comparison with any other.

Emax has been developing for several decades. Every year, hundreds of people add to it more and more new opportunities. Usually these are small fragments of separate functionality for the needs of a specific user. However, the total volume and breadth of these improvements over time turned a powerful text editor into a comprehensive cross-platform software environment in which you can do absolutely anything if it is at least a little related to working with text.
')
The versatility of Emax plays into your hands, if you understand how it works: you can do a thousand different things through a single interface in which everything consists of text in all its manifestations. It may look archaic from the point of view of the modern user interface, but it is not; if only because modern interfaces do not reveal the full power of simple text. To become a literate user of emaks, you have to understand his concept and internal structure, which means - to join the hacker culture of the 70s of the last century. Beginners are intimidated by this state of affairs, but everything is not so bad: emax is difficult only for complex tasks, but for simple tasks it is simple, everything depends on your needs. Getting started with him is better with a general review of the “ A Guided Tour of Emacs ” on the site of the free operating system GNU .

Richard Stallman describes the history of emax in the article “ My experience with lisp and the development of GNU Emacs ”; This story is closely related to the equally interesting story of the GNU project, from which you can learn that GNU Emacs was the first project in the GNU project. The essence of what emax is is described in detail in the document “ EMACS: The Extensible, Customizable Display Editor ” written in 1981 - and over the past years this essence has not changed at all.

The extensibility of emax is its blessing and curse. Of course, in the standard package, emax is good, but not as good as it could be. You are not limited to the decisions of developers, and if you need functionality in which there is no emax, you can add it yourself: simply open the emax and describe it in detail. In the end, all the text editing features of emax are just text describing what to do with the text, and you can change this text at any time just like any other, thereby changing the capabilities of the emax. Potentially, its possibilities are endless, but in order to take advantage of them, you will have to tackle customization, and this implies programming skills and close communication with the community.

Setting up an emax is a kind of arts and crafts; for each specific user, it consists in compiling a lisp program from fragments of a lisp code taken from a variety of disparate sources. There is no other way, in principle, so before diving into this topic you should get comfortable with programming in general and programming in Lisp in particular. Lisp is the oldest of the very high-level programming languages ​​used, as well as the simplest of the methods of organizing calculations known to mankind from symbols , data structures and functions (discovered by mathematicians in 1936).

The book " The Structure and Interpretation of Computer Programs " will help in the study of programming - this is an introductory course in computer science at MIT. In writing programs for Emax, the tutorial “ Introduction to Emacs Lisp Programming ”, the “ GNU Emacs Lisp Reference Manual ” handbook, and the “ Common Lisp Quick Reference ” brochure are useful.

Emax is definitely not the kind of program for the study of which is worth undertaking only in order to edit the text in it. It should be perceived rather as a living artifact and cultural monument of a more civilized era. Studying emax will be a waste of time if you do not program and do not want to have anything to do with this activity, but if this is not the case, you will not find anything better than emax.

Usually the creation of a convenient configuration and its subsequent refinement is stretched for a long time. You can make your life easier and install a framework in which all the basic settings are made in accordance with the framework’s author’s vision, and you don’t even have to edit the source code in order to simply use the emax for your pleasure. The most popular frameworks for today: Spacemacs , Emacs Prelude , Eschulte Literate Emacs Starter Kit , Overtone Emacs Live , Purcell emacs.d , Oh My Emacs .

Everything will be fine as long as you don’t want to build some kind of unbelievable functionality into the emax, and then you’ll have to manually integrate some code not only into the emax, but also into the framework, and you need to deal with its internal structure. that brings all its virtues to naught. The author of the Emacs Starter Kit (see Meet Emacs ) came to this conclusion when he closed his project after six years of development:
Older versions of the Emacs Starter Kit were a one-for-all code base replacing the contents of the ~ / .emacs.d directory. It was a very popular solution, but a large bundle of incoherent functionality led to the fact that the user simply got used to it without understanding anything. When some things broke or did not behave as you wanted, you had no idea where to fix them.

I realized that users are better suited for small packages that provide the desired functionality. Instead of dumping the code, the Emacs Starter Kit has become a small guide. As an Emacs user, you have to search for new fragments of emax-code, integrate them, configure, and even write your own. The Emacs Starter Kit will help you with tips on where to start and what exactly to look for, but building a suitable configuration is a personal matter for everyone.

The emax package system is a lisp program built into it [see source on github ; open the graphical interface of the package system in emax - Mx list-packages ] which automatically integrates other Lisp programs from the Internet into emax. The package system works independently of the operating system under which the editor is running, it itself tracks the dependencies between the Lisp programs and takes care of updating them. The development of this system started by Tom Tromey in 2007, in 2012 it was incorporated into Emacs 24.1; The peak of popularity of the Emacs Starter Kit fell on these years, that is, by and large, the community used it to develop a package system.

Whatever the case, the personal configuration of the emax was, by its nature, and will be just a big bunch of unrelated code, and the best way to handle this is to leave everything as it is; or turn this heap into a guide that will explain the reasons (first of all so as not to forget himself) for which this or that fragment is in this heap, and then make it so that the guide itself turns itself into a lisp program and performs an emax configuration at launch . It also rebuilt itself as it changed and downloaded new versions of itself from remote sources. Why not. This is also a guide for setting up mouse maxima in the best traditions of Stanford and MIT.

Continued .

It is impossible to publish the full version of the article here due to the fact that it uses internal links in a format that is not supported by habrabra.

The source code of the article: Gitlab , Github .

Source: https://habr.com/ru/post/274759/


All Articles