EMACS Flashcards

To gain more knowledge in Emacs as an editor

1
Q

What do you understand by Emacs

A

Emacs is a powerful and customizable text editor that has been around since the 1970s. Emacs is widely used by programmers, writers, and other users who need to edit plain text files efficiently.

Emacs is often described as a “self-documenting” editor because it includes a built-in help system that allows users to quickly learn its many features and commands. It also supports a wide range of programming languages and file formats, making it a popular choice among developers and system administrators.

One of the defining features of Emacs is its extensibility. It includes a powerful scripting language called Emacs Lisp that allows users to write their own custom functions and macros, making it possible to automate repetitive tasks and tailor the editor to their specific needs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Who is Richard Stallman

A

The person that developed Emacs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to open or create an emacs file

A

C-x C-f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to save an emacs file

A

C-x C-s

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a buffer and how to switch from one to the other

A

In Emacs, a buffer is a temporary workspace in memory that contains a text document, file, or other form of data that can be edited. Buffers can be thought of as virtual windows into the contents of files or data that are open in Emacs.
Switching between buffers is a fundamental operation in Emacs. Here are a few ways to switch between buffers:

Step 1: Use the keyboard shortcut C-x b (which means “Control-x b”) to open the switch-to-buffer command. This will allow you to type in the name of the buffer you want to switch to. If you press Tab after typing a few characters, Emacs will show you a list of matching buffer names that you can choose from.

Step 2: Use the keyboard shortcut C-x C-b to open the buffer list. This will display a list of all open buffers in the current Emacs session. You can navigate through the list using the arrow keys and press Enter to switch to the selected buffer.

Step 3: Use the keyboard shortcut C-x right arrow and C-x left arrow to switch between the previous and next buffer in the buffer history.

Step 4: Use the command ibuffer to open the buffer list in a more powerful and customizable way. This command allows you to filter and sort the list of open buffers based on various criteria such as buffer name, major mode, or file location. You can also mark multiple buffers for further operations such as closing or saving.

Note: These are just a few examples of the many ways to switch between buffers in Emacs. Emacs provides a vast array of commands and customization options for working with buffers, making it a powerful and flexible tool for editing text and data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

In Emacs, the mark and the point are used to set the region, which is a highlighted portion of text that can be operated on as a unit (e.g. cut, copy, or replace). The mark and the point can be set using keyboard commands, and they work together to define the beginning and end of the region.

Here’s how to use the mark and the point to set the region:

Move the point to the beginning of the region by pressing C-SPC (Control-space) or C-@ (Control-shift-2). This sets the mark to the current position of the point, which is initially located at the beginning of the region.

Move the point to the end of the region by using any of the standard movement commands (e.g. C-f to move forward by one character, C-n to move down one line, etc.). As you move the point, the region will be highlighted.

Once the point is at the end of the region, you can perform operations on the region using Emacs commands. For example, you can cut the region by pressing C-w (Control-w), or copy the region by pressing M-w (Meta-w). To replace the region with new text, simply type the replacement text and it will overwrite the highlighted region.

To clear the region and remove the highlighting, you can press C-g (Control-g) to cancel the operation, or press C-SPC or C-@ again to move the mark to a different position and clear the highlighting.

These are just a few examples of how to use the mark and the point to set the region in Emacs. The mark and the point are powerful tools that allow you to work with text in a precise and flexible way, and there are many other commands and customization options available for working with them in Emacs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to cut and paste lines and regions

A

To Cut = C-w
To Paste = C-y

Note that C stands for Control

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to search forward and backward

A

Forward search, C-s
Backward search, C-r

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to invoke commands by name

A

In Emacs, you can invoke commands by name using the M-x (Meta-x) command. This command allows you to type the name of a command and execute it directly, without using a keyboard shortcut or menu.

Here’s how to invoke commands by name:

Press M-x (Meta-x) to open the execute-extended-command prompt. This will display a message at the bottom of the Emacs window asking you to type a command name.

Type the name of the command you want to execute. As you type, Emacs will display a list of matching commands that you can choose from. You can use the arrow keys to navigate through the list and press Enter to select the command you want.

Once you have selected a command, Emacs will execute it and display any relevant prompts or messages. For example, if you execute the find-file command, Emacs will prompt you to enter a file name or path to open.

You can also use M-x to execute commands with arguments or options. After you type the name of the command, you can enter any necessary arguments or options in the same way you would when invoking the command with a keyboard shortcut or menu.

For example, to execute the replace-string command and replace all occurrences of “foo” with “bar”, you can type M-x replace-string, enter “foo” when prompted for the string to replace, enter “bar” when prompted for the replacement string, and then press Enter to execute the command.

Using M-x to invoke commands by name can be a powerful and convenient way to access Emacs functionality, especially for commands that don’t have a dedicated keyboard shortcut or menu item.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to undo

A

Undo, C-x u

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to cancel half-entered commands

A

If lost or made a mistake, C-g

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to quit Emacs

A

To exit/quit, C-x C-c

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In Emacs’ documentation, what does M in a shortcut command stand for?

A

Alt
Meta

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

You can only have one buffer open in Emacs at a time. (True/False)

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In Emacs’ documentation, what does C in a shortcut command stand for?

A

Ctrl

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In Emacs, a buffer is an object that a file’s text is held in.(True/False)

A

True