📜 ⬆️ ⬇️

Emacs for beginners: introduction

Ist das Emacs? Sehr gut!



I'll start with a little story. About 15 years ago I went to work as a system administrator for a programmer in the glorious city of Mannheim, West Germany. When I arrived at work and deployed my working environment, most of the Deutsche didn’t understand much what I was working at, but the office director immediately told me: “Ist das Emacs? Sehr gut! ”, Adding that no one of the current programmers could master it. But honestly, I'm not so special - I was just lucky: a kind person gave me a ready-made config and helped me deal with the editor in the first steps. I, in turn, want to share my experience with the rest, and decided to make a series of articles for beginners and not so much, with consideration of various useful features of emacs.

In this article, I also want to shake the prevailing myth - that Emacs is a difficult editor / tutor. I believe that starting correctly, the learning process will not be difficult, and I hope it will give you a lot of pleasure from using a convenient, powerful and fast tool both in work and in life.
')
The first is the weakness of emacs in its strength. The ease of learning has suffered from the simplicity of reconfiguring - everyone rebuilds the radar for themselves, and often so drastically that another user of the same editor might not recognize it.

My .emacs config has been updated with new features for the last 15 years, and this is one of the problems with Emacs: it’s easy to give a ready-made config to the beginner’s hands, but will it be useful? I’ll share it now on the Web (as it’s actually done a long time ago) like hundreds of other enthusiasts. But, for a beginner, this is not enough, it’s likely that he will be able to do only two things (of which he probably will not do any, due to the initial laziness): (1) or take the config entirely with all the custom bells and whistles, or (2) try to cross the “bulldog with the rhinoceros” and pull back the recipes from several configs of different vendors - and this is a long, dreary.

Emacs developers are trying to lower the entry barrier for newbies trying to produce something similar to common standards (CUA mode: Ctrl + C, Ctrl + V, write * scratch *, and rn), but this is clearly not enough for an editor with 20 years of history - a barrier to mastering keeps on high, cutting off beginners.

I decided to go the other way and make it easier to understand how much they need this or that feature by making a demonstration of each. Instead of just laying out your config (like “who needs to figure it out”), I will try to sort it out in pieces, explaining each individual module and setting.

After all, there is no perfect config "for everyone", and what is good for me can be inconvenient for the same web designer.

Therefore, this article will not describe any particular feature - I will go over everything convenient from my point of view. It will be [not] a big tutorial that will allow you to choose what you need for each individual.

Introduction



The emacs introduction shows the editor itself, keystrokes for initial learning, and explanations of the basic concept of editing along the way.

Studying emacs is something akin to learning a foreign language: there is a lot of material, you need to learn keyboard shortcuts (not necessarily, but it is necessary, if you want practical use), some new concepts need to be understood.

Basic keys


Buffers (buffer - open file)


Window


Video:


After watching this video, I also recommend going through the English tutorial on emacs, which is available in the editor itself: Ch t.

IDO-mode



Convenient mode for quick access to files, open files, and other lists inside the editor. In conjunction with the activated uniquify mode, it allows * very * to quickly find what you need. Features: on the C + <space> key, the input of a new substring begins. On the Cf key, there is a fallback (return) to normal (non-IDO) input.

Video:


Setup:
(require 'uniquify) (require 'ido) (ido-mode t) 


Working with files remotely via SSH, FTP, Samba, and so on



Perhaps this is not the most sophisticated feature of emacs, that’s many will say that it’s much easier
log in to the remote server with the console and edit everything there. But, unfortunately, the console is not as convenient as a GUI application, and often the file is more conveniently and quickly edited locally, and the result is recorded rather than the slow keystrokes in the case of the console. Having opened several files remotely, you can easily transfer pieces of text of any length and content, avoiding the use of a mouse buffer.

Video:


Setup:
 (require 'tramp) 


Finally


Emacs is a really not very complicated editor. But this is exactly the example when mastering the minimum, this is not the case, for the power of emacs is in the available libraries and additional functions. The only way to achieve maximum results is to learn the key combinations, the names of the functions and the concepts and functionality themselves.

In the next articles on this topic I will describe working with Dired (file manager), working with version control systems using SVN and Mercurial as an example, searching for text (rgrep), text bookmarks, interactive error display, Python development environment and much more. . Please comment on exactly what additional features are interesting.

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


All Articles