Emacs – 30 Days Challenge

This is my learning journey to learn emacs in the next 30 Days. I am going to share my learning on this blog page.
Below is the outline of the content I am planning to touch upon during my 30 Days challenge.
  • Day 1: Welcome to emacs
  • Day 2: Help in Emacs

“ Emacs is the extensible, customisable, self-documenting real-time display editor.”

– Emacs Manual

Emacs can control OS subprocesses, helps in indenting programs, perform functions on many files at once and act as a simple text editor.

Emacs can be easily altered to behave in a certain way as you want and is highly customizable. Advanced users of emacs can go beyond simple customization and can create entirely new commands. These new commands are simple programs written in LISP and are also known as macros.


Most of my writing I do mainly with a Mac Pro, so I downloaded the mac version of emacs, there are multiple emacs variants present, but I preferred vanilla emacsformacosx, which gives me enough room for customization as per my needs.

The commands and helps mentioned in my blogs will work on all the emacs variants regardless of your choice of OS.

I downloaded MAC OS X from http://emacsformacosx.com/.

In a lot of blogs and on #emacs IRC channel, people recommend using vanilla emacs while learning emacs. Customized variants of emacs come with pre-built commands which limits the learning curve.
It is much easier to download and install emacs on Mac OS X. Download the latest version of emacs. Double click on the installer and follow the instructions.

For Windows and Linux you can download GNU Emacs releases from a nearby GNU mirror; or if automatic redirection does not work see the list of GNU mirrors, or use the main GNU ftp server.

GNU Emacs development is hosted on savannah.gnu.org.

Working with emacs

  • Starting the editor: once installed start emacs from Launchpad -> emacs, clicking on which took me to the editor in its full glory, with a nice welcome message with a link to the manual and the beginner emacs tutorials to get a start working with emacs and to quickly get help in emacs “C-h (Hold down Ctrl and Press h)
emacs welcome screen
When starting the emacs editor for the first time, the emacs welcome screen

Few things to note and which are global to emacs.

We are following the standard emacs documentation while learning emacs to do our tasks, for the rest of the blog and my future emacs/non-emacs related posts, I am going to use Control Key as ‘C’. Alt or Esc Key as ‘M’ or referred in the document as meta key. Shift as ‘S’.

Control keys are the “CTRL” keys on your keyoboard, usually on the bottom-left and bottom-right(near the shift key) keys.

Meta Keys are “ALT” or “ESC” key on your keyboard.

Shift Keys are the “SHIFT” keys on the left(below caps lock key) and right (below enter key) on your keyboard.

Moving around

Arrow keys on the keyboard can help you navigate around emacs text, it works similar to other text editors. Still, it is important that you learn the CTRL and Meta(ALT/ESC) key bindings to navigate around your document/code-block.
Examples of some common key-bindings which you will be using almost daily while working within emacs.
Keys Movement
C-v View next screen also as Page Up.
M-v Move Backward one screen or Page Down.
C-l redisplay the text with the cursor at the center of the screen.
C-p Previous line or up arrow key.
C-b back one character or left arrow key.
C-f forward one character or right arrow key.
C-n Next line or down arrow key.
M-f Move one forward one word.
M-b Move back one word.
C-a Move to the beginning of the line.
C-e Move to the end of the line.
M-a Move to the beginning of the sentence.
M-e Move to the end of the sentence.
C-u to specify a repeat count. C-v and M-v are exceptions as they won’t move pages but instead will scroll to that many lines forward/backward
C-g Kill the running command in minibuffer, or in case emacs stop responding.
C-d Delete the next character after the cursor.
DEL delete the character just before the cursor.
Insert text insertion is as simple as typing it. you can use the C-u to insert text as well. for eg. C-u 10 – will insert 10 hyphens “-———”.
M-</td> Kill the word before the cursor.
M-d Kill the word after the cursor
C-k Kill from the cursor position to the end of the line.
M-k Kill to the end of the current sentence.
C-</td> Set the mark, move around with the above keys to highlight the text.
C-y Yank the file back.
C-x C-f Find the file, can be used for creating a file or opening an existing file.
C-x C-s Save the file, when you made some changes to the file and want to write the same to disk or save it.
C-x s Save some buffers.
C-x C-b List all the opened Buffers.
C-x b Switch buffer around.
C-x C-c Quit Emacs.
These are some of the common keys for moving around while in emacs.
In the beginning, it seems hard to remember these key bindings for moving around within emacs. As we go along and with practice, these key sequences will become part of daily use.
As a beginner, the above chart looks intimidating, and using arrow keys is easier to move around, but we should practice adopting and try use Ctrl and Meta sequences wherever possible and become more proficient using them, in the long run, you will observe it is much easier to work with key sequences.
%d bloggers like this: