Skip to content

A brief guide for getting into and through the world of Emacs

License

Notifications You must be signed in to change notification settings

myTerminal/world-of-emacs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 

Repository files navigation

World of Emacs

Emacs is not just a text editor, instead, it is a multi-tool that can be used for (almost) anything and everything one uses a computer for. It even goes to the point that it is often discussed how it violates the UNIX philosophy, which in simple terms says that a piece of software needs to do one thing and do it well.

Emacs has its own ecosystem that includes its plugins (we call them packages), both inbuilt and ones we install, the people behind those plugins, and Emacs celebrities that spread the love of Emacs and help new people join our World of Emacs. This tool started as an odd/dated/powerless replacement to my then-favorite programming tool which was Visual Studio and slowly has been replacing many other tools in my toolset one at a time. Sometimes this happens via an external plugin that some fine human has contributed to the ecosystem for the rest of the fellow users, and otherwise, it happens to be built right into Emacs.

I believe I’m a fan of tools, so I’ve had several memorable and eye-opening experiences with a variety of software, but those that I had with Emacs have been just beyond comparison to any other. What may appear odd and obscure at the start might become an integral part of your computing workflow. If it goes even remotely the same for you as it did for me, you’ll find yourself searching for ways to perform various tasks from within Emacs even for those that you’ve been doing for a long time when you weren’t an Emacs user. Not to mention the case when there isn’t a way, which is when you can fabricate your way of doing this in Emacs, either in the form of a small script or otherwise in the form of a fully-fledged package that can be used by not only by yourself but also by other Emacs-ers.

Entry

One’s journey to the World of Emacs starts with hearing about the tool, soon followed by an eye-opening experience and then a complete change in workflow for text editing and even general computing. One would soon find it hard to not mention to other people on how they perform a particular task from within Emacs, sometimes to get weird reactions and otherwise alienate the “non-believers” and force them to leave the conversation altogether.

Question: Why use Emacs?

After a file browser, a text editor is the most used software on a computer and as a software developer, I consider myself eligible to state that developers spend most of their time on a computer within a text editor, except for the time we spend with command-line terminals. There is a massive variety of text editors for one to use and many people do not care much for which one they actually end up using so far as it helps them get the job done. Most such text editors simply provide one with enough features to get their job done without having to spend time learning how to operate that piece of software.

Emacs on the other hand is far more than just a text editor. Some also call it an operating system, and it can be said that it wouldn’t be an overstatement. Some people do not leave the Emacs window for hours, while for some, it is the only window they need. This is even true for a computer with a text-based interface and no graphical windowing system, as Emacs can be used to open multiple “windows” for different tasks and toss them in and out of the screen as needed.

So the answer to the question of why one should use Emacs, there are way too many reasons to list down. I have made attempts at a few presentations at work, and you can find the most recent one here on GitHub.

Or, you can also listen to what the experts say:

  1. Why Emacs? - Bozhidar
  2. Why Learn Emacs - Howard Abrams
  3. Why Use Emacs - emacs.sexy
  4. Who cares about Emacs? - Seth Kenlon (an independent multimedia artist, free culture advocate, and UNIX geek)
  5. How Emacs changed my life - Yukihiro “Matz” Matsumoto (The creator of Ruby)

Question: How to get Emacs?

Emacs comes in different forms. Which one you need depends on (or dictates your) workflow. You need to find one for yourself and no matter which flavor you use, it is always free (freedom and price).

Emacs is available on all major operating systems: Windows, Linux, and other UNIX-like operating systems like macOS.

Here is my attempt to list down all possible ways to obtain Emacs, at least the ones that I have tried myself.

Windows

On Windows, you can simply download their Emacs binary from http://ftp.gnu.org/gnu/emacs/windows and place it in a directory on your disk.

To run Emacs, you can execute the binary bin\runemacs.exe. You can create a shortcut to this file and place it on your Desktop if you like and that goes with your preference.

Optionally, you can add this location to your environment variable PATH, so that you will be able to start it from a Command Prompt window.

macOS

There are multiple ways to install Emacs on a Macintosh computer. Some editions of macOS already come installed with a distribution of Emacs. There’s only one problem with it though: it only runs within a terminal window.

Homebrew/Cask

The simplest one is to do it using homebrew.

brew install emacs

This ‘flavor’ of Emacs runs within a Terminal window and will not offer any graphical features.

You can, however, make it look graphical by installing it as

brew install emacs --with-cocoa

Note that this will still conflict with the version of Emacs already installed on your system. To be able to launch the newly installed Emacs from Launchpad or Spotlight, you need to execute the following:

brew linkapps emacs

Or you can do it with cask, which is the recommended way to install Emacs according to brew.

brew install --cask emacs

This installs the same Emacs as the one available on https://emacsformacosx.com. I used to prefer this flavor as it behaved almost the same as the one I currently use on my Linux systems and the Windows machines at work.

spacemacs

Spacemacs is a polished community-driven Emacs distribution that combines the features of Emacs and Vim.

The setup involves downloading Emacs and applying the spacemacs configs over it to provide a more polished experience.

Aquamacs

Aquamacs is another Emacs distribution with some extra features.

You can download it from the website.

Linux

The method of installation of Emacs on Linux depends upon the distribution you use. Generally, installing Emacs on Linux is easier than the other platforms we talked about earlier.

Debian

sudo apt install emacs

Fedora

sudo dnf install emacs

Arch

sudo pacman -S emacs

Void

sudo xbps-install -S emacs-gtk3

Other

To learn about other ways of obtaining Emacs, refer to the official website.

Getting Started with Emacs

Learning Emacs can be overwhelming, more so at the start. After all, it is not just a text editor to edit files, so that means that you have to learn how to perform much more than just that.

There are a lot of selfless people waiting to gtext basedet you in and there is an enormous collection of tutorials available for you to go through. Emacs has one in itself as well. You may type C-h t to start the text-based tutorial which is more than enough to get acquainted with the basic operation of Emacs.

Now for a tool like Emacs, learning it isn’t easy and it needs some patience and dedication at the start. When things start to sink in, the initial time spent starts to appear to be a smart investment. You just need to be patient and you’ll be flying before you know.

Below are a set of steps that I recommend going through to get started in a systematic manner:

The inbuilt Emacs Tutorial

Go through the entire Emacs tutorial that is part of Emacs itself. To start the tutorial, you may either select the option that says “Emacs Tutorial” from the welcome screen, or press C-h t from anywhere within Emacs.

You will be presented with a long-running screen full of text with “learn-as-you-do” instructions to help you get acquainted with the basic key bindings to get through your initial days within Emacs. Proceed through the tutorial slowly, do not rush. You may want to do it more than once to make sure you are comfortable.

Emacs Guided Tour

You can view the Emacs Guided Tour from the same screen where you started the previous tutorial.

The guided tour opens up a web page in your web browser. You can also visit it here: https://www.gnu.org/software/emacs/tour.

You’ll be happy to see some colorful pictures after going through screens full of plain text.

Alternate ‘Practical’ Tutorial

ergoemacs.org may not be the prettiest website you must have visited, but it sure has a lot of useful information on Emacs.

You can also visit http://ergoemacs.org/emacs/emacs.html for a “practical” tutorial.

Yet Another Emacs Tutorial

David Rothlisberger has created a great website as a detailed tutorial for Emacs where he talks about everything from installation to using it. Besides, the website is neater than what we just talked about.

A Reference card

Refer to this reference card along the way. Do not worry about learning every single shortcut right away, but just keep the reference card handy. I like to print it and pin it on my office desk.

Also, consider using this cheat sheet. It’s a good one with minimal basics.

http://emacs.sexy/img/How-to-Learn-Emacs-v2-Large.png

Daily Life

At this point, one’s already aware of the basics of Emacs, and probably also has started using Emacs in their daily workflow. The learning never ends, and Emacs continues to grow on you as you now learn about more things you can do or even more about the things you already do.

More than just basics

The key bindings that once used to keep you away from using Emacs have now become second nature. If you’d like to go beyond the basics (which you definitely should), there are cheat sheets and detailed references that you can keep coming back to every day.

A few Emacs references

Due to the vast collection of possibilities and features within Emacs, learning everything is close to impossible. My way of learning new things is that I start with only as much as I absolutely need and then keep learning more as I go. Fortunately, there’s plenty of reference material that one can use to learn one thing at a time.

The ergoemacs website

The ergoemacs website, although it looks dated (as mentioned earlier), can form a good reference material to learn Emacs.

There they also have training material for Emacs Lisp, which is a dialect of the beautiful language of Lisp. Knowing at least a bit of Emacs Lisp (or Elisp) helps customize Emacs better. Who knows, you would end up creating your own Emacs extensions with Elisp!

The Emacs mini manual and more by tuhdo

This website has a lot of information about Emacs starting from the ‘Why’ and ‘How’ that we covered earlier to advanced topics like setting it up for use with specific programming languages and much more.

The GNU Emacs Manual

If you like reading detailed, lengthy manuals, you can also go through the GNU Emacs Manual provided by GNU itself.

Mastering Emacs - Mickey Peterson

Mastering Emacs is a website with numerous articles on how-tos, tips & tricks about Emacs. The author also has a book that you can buy as a PDF or ePUB, also named Mastering Emacs. The book follows a systematic approach of introducing Emacs to beginners, starting from the bare basics, installation, and then covering advanced topics in around 280 pages.

Emacs.sexy

This one is a noteworthy website that has quite a lot of references to places where you can find information about Emacs.

Emacs Packages

As GNU describes, Emacs is an extensible, self-documenting editor. There are thousands of packages that you can add to your configuration.

The core of Emacs is written in C++ and the runtime is based on Elisp. This makes it very easy to modify its behavior by writing a few lines of Elisp code. That is exactly what those packages out there are: pieces of well-written and nicely organized Elisp code that you can “install” into your Emacs.

Even when installing packages, Emacs offers a wide set of choices. You can either download a script file and load it manually into Emacs’s runtime or you can use one of the available package archives.

To start with, there are multiple package management systems and those systems have multiple package archives. The two most popular package management systems are ELPA and el-get. ELPA is the more common one among the two. **CAUTION: This section needs an update**.

The major package archives for ELPA are:

  1. gnu ELPA is the default package repository for Emacs. It comes configured with Emacs.
  2. melpa requires authors to write their own packages and submit them through a strict set of guidelines for quality control. I have only three packages on melpa currently, partly because I do not have the time to align them to MELPA guidelines.
  3. melpa-stable is a more stable version of melpa and supposedly hosts release versions of packages on melpa that are known to be stable. All packages on melpa-stable are on melpa and not at all the other way around.
  4. marmalade follows a relaxed approach of submitting packages to the registry where there is no review before a package is submitted. I make sure all my packages are submitted to marmalade. Currently, I have seventeen of them there. The absence of a review process still makes you solely responsible for the packages you publish and there’s a need to maintain some quality to anything we upload over there.

You can follow https://www.emacswiki.org/emacs/ELPA for instructions on installing packages to your Emacs.

As there are an almost infinite number of Emacs packages out there, some reside not only on the registries mentioned above, but a few are also hosted on individual GitHub repositories, and a few are distributed as “.el” files.

If you think you can take it, you may refer to this list of a few most popular packages for Emacs at your own discretion. Remember: You have been warned, you will lose days of your life browsing through these packages.

Let’s say you went through the entire list of packages, you need to realize that it was just one list out of the many that you may find in the future.

Emacs Starter Kits

If you think that finding and installing the right packages for yourself is too much work, there are plenty of starter kits available that you can use right away.

You can find a list here. As a self-promotion, let me also mention super-emacs, which is my own generic Emacs configuration that you can use with barely any more customization.

Share your Emacs

Once you realize that you have created an Emacs of your own, it’s now time to step up the game. Pretty much all that you did was to put together a configuration that works really well with your workflow, and that configuration makes “your” Emacs different than the stock Emacs and from what others use.

A very common trend is to create a project on GitHub and share your dotfiles (a collection of configuration files on your computer, not just Emacs configuration) with the rest of the world. This practice makes available so many dotfiles for us to look at and adopt small parts within our own dotfiles.

Apart from helping others, this can also help you share the same configuration across multiple computers running different operating systems. I have personally been using the same configuration across all of my computers running macOS, Linux, and Windows.

You can find a small list of a few noteworthy Emacs configurations https://github.com/emacs-tw/awesome-emacs#noteworthy-configurations.

Apart from Emacs, you can also find other dotfiles at https://github.com/webpro/awesome-dotfiles and https://dotfiles.github.io.

Lastly, you can also have a look at my dotfiles, which though it started as Emacs configuration, has turned into something else altogether. It also acts as a host for super-emacs, which replaced my personal config a while back.

Give Back

Once you are comfortable enough in the World of Emacs, you should consider giving back to the community that helped you get started back when you needed help. Think of it as a way of giving back to the community that helped you get better at what you do today.

Write your own extensions

Emacs has a package to do almost everything you would imagine (as possibly cannot imagine). If at all it happens to be the case that what you’re looking for isn’t there already, you can create a package yourself and share it with the Emacs community.

As I mentioned earlier, Emacs extensions are simply “.el” files containing scripts written in the beautiful language of Elisp. These contain mostly variables and functions, some of which are exposed so that they can be invoked from the outside in order to achieve a certain result. Most Emacs packages also provide a mode with a certain behavior that helps add features to an already featureful text editor.

Talking about Elisp, it is one of the many dialects that are a part of the family of functional programming languages called Lisp. Lisp was created by John McCarthy way back in 1958 and we still see incarnations of Lisp in the form of programming languages as modern as Clojure, which was created by Rich Hickey in 2007 and is a fan-favorite of many.

Learning Elisp

Learning basic Elisp should be simple. As usual, there are quite a lot of resources on the internet, some of which are:

  1. Practical Emacs Lisp - ergoemacs
  2. An Introduction to Programming in Emacs Lisp - gnu.org
  3. GNU Emacs Lisp Reference Manual

I always like to learn a few basics and start writing my own code to get glued to the language. This way I see the practicality and use of what I’m learning. After I get a little comfortable with the language and gain some confidence, only then do I progress to the relatively advanced topics.

Writing extensions

Though writing extensions is easy, one needs to follow a few conventions that the community has agreed upon before we publish our packages out there. This helps keep some order in the huge collection of useful tools so that we do not step over the toes of others. The conventions include design practices, coding style, and commenting formats including file headers and footers.

Read through the post Authoring Emacs Packages by Aaron Bieber to get an idea. Also, reading through the Coding Conventions described within the GNU Emacs Lisp Reference Manual will help you learn a few basic practices to keep in mind.

There’s also an Emacs Lisp coding checklist that you can refer to save you some rework later on.

Publishing Extensions

The steps you need to take in order to publish a package to a repository depend upon the repository itself. You would mostly be publishing your packages to the repositories that we discussed earlier.

The simplest one to go for is marmalade-repo as it doesn’t need a formal code-review. The next would be melpa, which if you’re publishing your package to, it will also enable you to publish them on melpa-stable. The most difficult one would be GNU ELPA. Generally speaking, the harder the publishing process is, the better the quality of the packages.

Specific steps for each of the repositories are linked below:

  1. marmalade-repo - How to upload packages
  2. Contributing to MELPA
  3. Contributing to MELPA stable
  4. Contributing to GNU ELPA

Help others learn

Once Emacs becomes a part of your daily workflow, you start to realize that you are getting more efficient in some of the daily tasks that you do on your computer. You feel like you’re learning something every day, growing yourself along with your ever-evolving Emacs configuration.

The next thing that you can do is to help others learn Emacs. There are various forms of training material available: posts and articles about tips and tricks and individual experiences with Emacs, GitHub projects containing documentation (like this one), websites specifically created to host content about Emacs, YouTube training videos, etc. Pick the format that works for you, and start sharing!

A short curated list of available video series is listed below:

  1. Emacs Introduction and Demonstration - Howard Abrams
  2. Learn Emacs in a Weekend! - Tom Walker
  3. Emacs Rocks!
  4. Role-playing with Emacs - a video series started by me about a decade back but is still incomplete
  5. How to Configure Emacs - another incomplete series by me about configuring Emacs
  6. Emacs Tutorials for Beginners - b yuksel

Feedback

I need your help in making this guide a more seamless experience for getting into the World of Emacs. Feel free to contribute in any way you feel like.

About

A brief guide for getting into and through the world of Emacs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages