Why emacs?
Actually, why exactly Emacs? The reason is the first and most important - I like it, for the reasons that are less compelling, but more objective, welcome to cat.
While reading this article, users of other editors may want to exclaim that this is also possible in their editor. It’s true - and it’s wonderful, but it’s not important - in the end, each user will still choose his own editor to his liking.
What it is?
Aside from jokes, Emacs is a text editor. A text editor with tremendous opportunities for expansion. Many editors are extensible to one degree or another; in the case of Emacs, it is the extent of extensibility that matters. It is she who distinguishes him from many others.
Part of the editor is written in C - this part is responsible for basic interaction with the OS, drawing windows, input-output. Almost all of the code responsible for working with text is written in elisp, or is a wrapper for C-functions that can be called from the same elisp.
It is this approach that allows you to do anything from Emacs — an email client, a browser, a terminal, a client for wordpress, an interface for MySQL, and much, much more. Emacs, as a text editor, is also a powerful platform for building applications.
Another important difference from most extensible text editors is that you can change the behavior of Emacs on the go - you can rewrite the function of switching between tabs so that it does not display files with the extension .txt in the list of tabs without restarting the editor. You can copy the plug-in code that you found on the Internet, and which, as you think, you will need only once, in a temporary buffer (tab), execute it and thus get all the functionality in the editor. Or you can slightly modify the plug-in, execute it, and you will immediately have your own version, which you need.
Who doesn't need Emacs?
If you program in Java or C #, then most likely Emacs will not give you the same code features you are used to. If you are working on supporting a large project, where most of the work is refactoring, then Emacs will not help you too. If integration with JIRA, GitHub, or a fun debugger is more important to you, then again - you do not need Emacs.
At the same time, there is still a significant number of people who write code for these languages in Emacs.
If you have a constant desire to refactor on trifles, fighting for code perfection, for example, rename variables, change class hierarchy, method interfaces, etc. - you probably don't need Emacs either. But some serious refactoring support exists today if it’s for half a dozen languages, and if your language is not included in this number, then why not try Emacs?
There is an extensive category of people who work as programmers, but who are not interested in programming. They come to work, write code, learn new technologies as necessary, but programming for them is just a way to earn money, their interests and hobbies are different. Well, they don’t need it all. When they leave the office, they forget all work matters and live a normal human life. If you are one of those people, you just don't need Emacs.
And who needs it?
If you belong to one of the following categories of people, then Emacs should be worth a try (unless of course you are already a happy user of a similar editor):
- you write in languages whose support in leading IDEs is far from perfect
- you write in several languages, and you are tired of switching to the desired IDE each time
- You acknowledge that the ergonomics, speed, and responsiveness of most modern IDEs are poor.
- you are too lazy to reach for the mouse too often to perform any action
- you want to have a fully unified development environment at work and at home, or just on multiple computers at once
- you want a convenient environment for organizing notes and maintaining reference information that can be accessed without leaving the editor
- you are refactoring the case - i.e. you need not to make the code perfect, but to bring an absolutely unreadable code to a support state
- you often have to work with two or three files from which you interrupt pieces of specifications, or compare logs, or rewrite from language to language ... And you would like all this to fit on the screen.
- you need an environment that will run for weeks and will not consume a huge amount of memory, slow down, while keeping a hundred files and temporary buffers open
- you need to automate editing a large number of files
- you use a verbose language that encourages you to write a lot of helper code
- you are constantly missing something in standard solutions and you want to add the necessary little things for yourself with little blood
- you need advanced features for text processing - multi-line editing, editing rectangular areas, macros, transferring pieces of selected text for processing to external utilities, etc.
- You have had situations when, due to the amazing security policy, you spent hours editing something through ssh, not being able to use sshfs, since the same policy allows only one one-time connection (although to be honest - vim is available on such servers much more often)
- you prefer a universal way of working with everything - text, files, version control system, terminal, database
Emacs Myths
1. Emacs is deprecated
Emacs has the same capabilities as other text editors, and even surpasses many of them. Releases are released regularly, the number of extensions on the github and their forks only multiplies. The developer mailing lists regularly have discussions about cleaning outdated code that no one uses. The cleanings themselves are also carried out. Almost all the features that appear in popular IDEs or other editors are quickly implemented by the community and under Emacs.
Nevertheless, you may well be in a team where you will be despised for using a text editor instead of a serious (tm) IDE. But this is more of a collective problem, not Emacs.
2. Emacs is not suitable for development in modern conditions
Emacs has debugger integration for many languages. Code navigation is also present. This is enough to write applications of any complexity, while your productivity will not drop compared to working in the IDE, with the exception of Java and C #. These 2 languages are a unique example of when you are lost in conjecture - is an IDE created for a language or a language for an IDE?
It is true that Emacs “does not understand” that it has code, not text. Therefore, you won’t have type checking, or smart completion, too (well, that is, sometimes it will be for some languages). Forget about viewing the documentation directly in the IDE, although okay - for some languages there is such a feature. No smart refactoring. There will be no warnings and tips, except for those that the compiler or interpreter is capable of issuing.
However, this does not prevent you from writing good code. And write code quickly and efficiently. In general, in order for your productivity to grow significantly when using a full-fledged IDE instead of Emacs, your work should be very, very specific.
I conducted an experiment - I imported the current PHP project of 400,000 SLoC into PHPStorm and tried to work in it for several days. After that, I returned to Emacs and ... the only function that seemed to me useful, which was in the IDE, but was absent in Emacs, was added to it after several minutes of googling. This does not mean that PHPStrom has a bunch of things that Emacs doesn't have. Another question, and an important question, is whether these features are needed for productivity?
Everything described above is my subjective opinion, but, on the other hand, I could not find reliable studies of how the IDE improves productivity compared to a good text editor. Maybe you are more lucky.
3. Emacs is hard to learn
It is not complicated, but it has a huge number of different functions that have been added over more than two decades of its existence. Mastering the editor itself takes a week - during this time you will learn the basic editing techniques and get used to keyboard shortcuts. This will be enough to feel comfortable during work.
The second stage is the choice among the many functions exactly those that you need to work. It can stretch for months and even years. And most likely it will never end - for Emacs constantly there are new extensions that may be useful to you.
What to strive for
To feel the spirit of old-school omnipotence, I recommend the following videos for viewing:
- HTML work
- Edit multiple lines at once
- Access JS console in Chrome from Emacs
- Snippets
- More snippets
- Emacs and Python
However, this is all not important - you can only feel the full effectiveness of Emacs yourself, it can’t be transmitted through the video. As a training video for the night, as well as to consolidate the understanding of the essence of Emacs, you can watch a series of lectures from our compatriot:
Conclusion
I intentionally said nothing about other popular editors with a similar ideology - Vim, Sublime Text Editor, Notepad ++. Better to let users of these editors talk about their advantages. And today you can try to start mastering Emacs - at least in order to make sure that it does not suit you. Well, if you have already chosen a different editor, then even more so try it - you need to know the enemy by sight.