/

A Short Guide to Using Emacs

A Short Guide to Using Emacs

Emacs is a highly versatile and powerful editor that has been the go-to choice for many UNIX users throughout history. The classic argument between vi and emacs enthusiasts has sparked countless debates and unproductive discussions among developers worldwide.

To get started with Emacs, simply open a new session by invoking the command emacs. If you’re using Linux, this shouldn’t be a problem. However, if you’re on macOS, you’ll need to take an extra step. macOS doesn’t ship applications using GPLv3, and the built-in UNIX commands that have been updated to GPLv3 have not been updated on macOS. To fix this, you can run brew install emacs and use the newer version of Emacs from Homebrew.

To edit an existing file using Emacs, call the command emacs <filename>. This will open the specified file in Emacs for editing. Once you’re done making changes to the file, you can save and exit by pressing ctrl-x followed by ctrl-w. Emacs will prompt you to confirm the folder and ask if you want to overwrite the file. Answer with y to confirm and get a success notification.

To exit Emacs entirely, press ctrl-x followed by ctrl-c. Alternatively, you can press ctrl-x followed by c while keeping the ctrl key pressed.

This brief introduction only scratches the surface of what Emacs can do. There is a vast amount of knowledge to explore and master in Emacs. To learn more, I encourage you to open Emacs and press ctrl-h r to access the built-in manual and ctrl-h t to open the official tutorial.

tags: [“text editor”, “emacs”, “UNIX”, “Linux”, “macOS”]