I mentioned in the previous post that I stumbled into the world of Emacs almost accidentally. At the time, I didn’t have a clear understanding of just how productive Emacs could be until I decided to dive in and give it a try. Initially, working with Emacs felt a bit awkward, and there were moments when I was tempted to give up. However, I persisted, driven by a curiosity to explore its capabilities, and I was pleasantly surprised by how quickly I adapted to this powerful text editor.

As I delved deeper into Emacs, I found myself needing to customize its configuration to suit my preferences. I was familiar with Vim and its configuration file (.vimrc), so I set out to find the Emacs equivalent. To my surprise, Emacs configuration was quite different, and it introduced me to a world filled with parentheses – Lisp, specifically Elisp. This was my first taste of Lisp programming, and it happened in late 2021. To this day, I’m still amazed by the incredible versatility of Emacs.

Let’s delve into the important aspects of working with Emacs, focusing on how to get started:

Emacs Configuration is Lisp Code

Emacs configuration files are written in Emacs Lisp (Elisp). This means that your .emacs or init.el file is essentially a Lisp program. You can customize every aspect of Emacs by writing Elisp code in this file. For example, to change the font size in your configuration, you’d use Elisp like this:

(set-face-attribute 'default nil :height 120)

Using Elisp for Simple Scenarios

Emacs is extremely versatile, and Elisp allows you to create custom functionality. Here are some simple scenarios to get you started:

Remove Menu Bar: If you want to hide the menu bar in Emacs, you can add the following line to your configuration:

(menu-bar-mode -1)

Remove Scroll Bar: To get rid of the scroll bar, you can use this code:

(scroll-bar-mode -1)

Start in a Specific Buffer: If you always want to start in a particular buffer, you can set it as the default buffer in your configuration. For example, to start in the Org Agenda buffer:

(setq initial-buffer-choice 'org-agenda)

Manage Packages: Emacs has a package manager, and you can use Elisp to install and configure packages. For example, to install the popular use-package package, add this to your configuration:

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

Basic File Manipulation/Navigation: Emacs provides powerful keybindings for file manipulation and navigation. For instance, C-x C-f opens a file, C-x C-s saves a file, and C-x C-w saves a file with a different name. You can also use C-x C-b to list buffers and switch between them.

Programming: Emacs is a popular choice among programmers. You can use it for various programming languages with dedicated modes and extensions. For example, if you’re working with Python, you can enable Python mode with M-x python-mode. You can also install language-specific packages like elpy for Python development or company-mode for autocompletion.

Conclusion

In this journey of exploring Emacs and Elisp purely for the joy of learning, I can’t help but wonder why this powerful tool isn’t more widely recognized. As I continue this adventure, I’m eager to experiment with Emacs in the realm of web technologies, inspired by success stories like “Viaweb.” A pioneering web application that continues to inspire me to this day.

I’m keen to explore how Emacs can be a valuable tool in the ever-evolving world of web technologies. My next steps will likely look to play with Emacs integrations.

Furthermore, I aim to investigate the integration of web browsers into the Emacs workflow using tools like eww (the Emacs Web Wowser). In doing so, I hope to unravel the untapped potential of Emacs in the ever-evolving world of web technologies and share my discoveries with those who share a similar curiosity and enthusiasm.