DEV Community

Cover image for Understanding Emacs
Eghelonohor Akpotaire Humphrey
Eghelonohor Akpotaire Humphrey

Posted on

Understanding Emacs

What is Emacs?

Emacs is an acronym meaning Editor Macros(EMACS).

Emacs is an extensible, customizable, self-documenting, real-time display editor.

The original EMACS was written in 1976 by David A. Moon and Guy L. Steele Jr. as a set of Editor MACroS for the TECO editor.

Who is Richard Stallman?

Richard Stallman created the most popular, and most ported, version of Emacs called GNU Emacs, which was created for the GNU Project.

How to open and save files

To Open a file within emacs type.

Ctrl-x Ctrl-f [file]
Enter fullscreen mode Exit fullscreen mode

To Save a file within emacs type.

Ctrl-x Ctrl-s
Enter fullscreen mode Exit fullscreen mode

What is a Buffer and how to switch from one to the other?

Buffers in Emacs editing are objects that have distinct names and hold text that can be edited.

Buffers are used to hold the contents of files that are being visited; there may also be buffers that are not visiting files. Although several buffers normally exist, only one buffer is designated the current buffer at any time. Most editing commands act on the contents of the current buffer. Each buffer, including the current buffer, may or may not be displayed in any windows.

How to switch to between Buffers
- when the buffers names are not known

Ctrl-x b
Enter fullscreen mode Exit fullscreen mode

- to list all the buffers

ctrl-x B
Enter fullscreen mode Exit fullscreen mode

How to use the mark and the point to set the region?

You set the mark at one end of a text, and move point to the other end. The text between point and the mark is called the region.

To set mark on a text type

Ctrl-SPC(Set-mark-command)
Enter fullscreen mode Exit fullscreen mode

How to cut and paste lines and regions.

  • To cut the text, type
Ctrl-w
Enter fullscreen mode Exit fullscreen mode
  • To copy the text, type
Alt-w
Enter fullscreen mode Exit fullscreen mode
  • To paste the text, type
Ctrl-y
Enter fullscreen mode Exit fullscreen mode

How to search forward and backward.

Search Forward

Ctrl-s
Enter fullscreen mode Exit fullscreen mode

Search Backward

Ctrl-r
Enter fullscreen mode Exit fullscreen mode

How to invoke commands by name.

To invoke a command by its full name, type

M-x(Alt-x)
Enter fullscreen mode Exit fullscreen mode

, then the name of the command, and finally hit RETURN.

How to undo.

To undo type any of the three below

Ctrl-x u
# OR
Ctrl-/
# OR
Ctrl-_
Enter fullscreen mode Exit fullscreen mode

How to cancel half-entered commands

To get rid of a partially typed command

Ctrl-g
Enter fullscreen mode Exit fullscreen mode

How to quit Emacs

When you want to leave Emacs for a short time, type

 Ctrl-z 
Enter fullscreen mode Exit fullscreen mode

and Emacs will be suspended.

To get back into Emacs, type

%emacs
Enter fullscreen mode Exit fullscreen mode

at the shell prompt.

To quit Emacs permanently, type

Ctrl-x Ctrl-c.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)