Back to the plugins in Emacs
Introduction
This is a series of articles about Emacs that I want to do at least one a week
(we'll see that I'm less constant than a feather) in which I intend, on the one
hand, to partly translate into Spanish articles that I find very interesting and
at the same time time to summarize them a little and give my opinion, all
together in my own personal jumble. Regarding partially translating, it is
because although I know that it is better to write in English since this way you
have a more international impact and that on the other hand all browsers already
have an integrated translator, but still continuing to make articles in Spanish
I think is good for the Hispanic Emacs community since for some people the fact
that almost everything in Emacs is in English is an added problem for its
adoption.
I can already tell you that many articles will be from Irreal, which is a blog
about Emacs that I love.
The Emacs plugin system
Human beings by nature tend to always look for references in order to know what
we do not know. It is a virtue and a defect that we have to know the world
around us to put things that we think are similar in mental boxes in order to
know those things. It is a virtue in the subject that allows us to quickly
define the world around us and it is bad because it also makes us end up in
prejudices or sometimes excessive simplifications.
In the world of computing, those of us who do not use the most used or known
tools experience it daily. This is how people put Linux, Windows or Apple in the
same bag, when one is a kernel, the other an operating system and the last a
computer with its integrated operating system. People call GIMP, the Linux
Photoshop, when it is not exclusive to Linux and in many ways it is worse than
Photoshop and in others much better since they are software that, although they
do something similar, are very different in their development. And so on with
more things that surely come to mind as examples.
Well, it turns out that on Reddit they have already asked themselves a few times
if the Emacs plugin system is as good as the VS Code plugin system that they
usually comment is great, even though in most cases they have not seen something
else, but that's another topic.
The quick answer is that the Emacs plugin system is better than that of VS Code,
but the reality and going deeper is that Emacs does not have any plugin system,
it has a package manager and in the world of Emacs we talk about packages and
not of plugins because it has nothing to do with it. So I'm going to try to
explain it a little.
The Emacs plugin system
Plugins in VS Code and other IDEs To begin, we are going to quickly explain
the VS Code plugin system and other IDEs. Programs like the ones mentioned are
written in a specific language, for example C++, and enable an API so that other
developers can add new features. This API is a system where, knowing it and
following its rules, you can modify the things that that API allows you and in
the terms that that API says. It is as if I bought a car where I can modify it
but only following some rules, of design, functionality and adding only certain
components to that car but within the parameters defined by the
manufacturer. Furthermore, in most cases the programming language of the plugins
differs from the language with which the IDE was created and that is not
important but it has its implications.
Non-plugins in Emacs
In Emacs we don't talk about plugins but about packages. Generalizing many of us
have several types of packages that include:
+ Themes
+ Major modes
+ Minor modes
+ Others
Emacs is a Lisp machine, which means that it is an interpreter of Lisp, in this
case Elisp, which is the dialect of Lisp that we use in Emacs. The issue is that
not only do the packages use the same language in which Emacs is mostly
programmed, but the functions created as packages have the same rights as the
functions that come with the program, in Emacs jargon they say that they are all
citizens first class, that is, they are all at the same level of privileges and
functionality. Furthermore, I am going to define what the modes are.
Mods are functions that are created and packaged to be easily installable in
Emacs that completely modify Emacs. Minor modes add small changes or new
features. We could say that the themes are minor modes since they aesthetically
modify Emacs with different colors and aesthetic modifications.
The major modes are very similar but their greater complexity and size gives the
possibility of completely changing the functionality of Emacs, and thus we can
transform Emacs into an email manager, a multimedia player, a news reader, a map
manager, a terminal unix created from scratch in Elisp, a database manager, etc,
etc, etc...... and of course, creating the best and most flexible editor that
has been made so far. In fact, if someone were willing, they could create a
Word-type word processor using only Emacs with Elisp or a statistical program
with real-time graph generation.
And finally, the fact that any function created in Elisp is fully functional in
Emacs makes it a delight to develop for Emacs.
Let me explain, Elisp is an interpreted language that can also be
compiled. Thus, one can begin to program, for example, a series of functions
that we want to add to Emacs, which can even be written in a special buffer that
Emacs has called scratch, which is for that, as its name indicates, once that
function has been written. function, you can run that function and if everything
is fine, you now have that feature added to your Emacs. If there are already
many functions and you want them to be added automatically every time you start
Emacs, you can write a file with the .el extension and tell Emacs to run it at
startup and you will have all those new features in your Emacs quickly and very
interactively . And finally, if you are already happy with your functions and
for whatever reason there are many, you can compile that file and transform it
into an .elc and it will load much faster and you will probably have a minor way
that you can consider sharing it with the entire Emacs community .
On the other hand, to make a plugin for VS code to start you must have NPM and
Yeoman installed, one to download libraries and another to create a structure or
scaffold for the plugin. Ok, we could do the structure by hand, but the fact
that it is better to do it with a program like Yeoman indicates that this
structure is complex. Then, the structure will be created and the necessary
libraries will be downloaded, so you must have internet, in Emacs, everything
you need is already in Emacs and internet is not required once installed to make
our packages.
Well, as I said in Emacs we simply execute the code and in real time we see the
effects of that code in our favorite editor. On the other hand, in VS Code, we
create the code, and we have to execute it, then another VS Code window will
open with what we have written about the plugin and if it gives an error it does
not open and well, as I say the process is much more cumbersome, while in Emacs
it is more organic.
In Emacs, anyone without being a programmer can naturally add small
modifications to improve their experience with Emacs in a very simple and
progressive way and little by little they will realize that they know how to
program, since they will start with small functions, major modifications , minor
modes and finally major modes.
Links
https://www.reddit.com/r/emacs/comments/1gx6m8v/vs_code_extension_system_vs_emacs/
VS Code extension system vs Emacs
https://code.visualstudio.com/api/get-started/your-first-extension
https://code.visualstudio.com/api/get-started/your-first-extension
-------------------------------------------------- ----------------------
If you are viewing this article from a web browser through the flounder proxy, I
advise you to access the gemini address using a browser that supports this
protocol.
Gemini is a minimalist protocol that minimizes the use of client and server
resources, reducing carbon emissions and also does not allow the use of programs
that access your personal information, so your privacy is assured.
Use Gemini, save the planet, save your data. For a better future.
-------------------------------------------------- ----------------------
/informatica/emacs/articulos/english/