User Tools

Site Tools


networkops:gnu_emacs

GNU EMACS

Introduction

GNU Emacs is another text editor available on Unix. One advantage of GNU Emacs is that it’s an insertion mode editor. This means each character that is inserted into the file will be automatically saved, unless it includes a command prefix. Another advantage is that you can edit several files at once. There are many more functions on GNU Emacs, and the possibilities are endless.


Basic functions

To open GNU Emacs simply type:

 emacs 

You will be greeted with this window:

On the bottom of the screen you will see the words “Beginning of buffer.” Here you will enter commands. Try these key combinations. C-x and M-x. To do C-x. press Ctrl+x and M-x press Alt+x:

*This is a demonstration of how to invoke GNU Emacs executable extended commands*

You can navigate GNU Emacs using the arrow keys. Now navigate to “Emacs Tutorial” and press “enter.”:

The first few paragraphs goes in depth of what I explained in this tutorial:

-End of Tutorial-


Editing a file

To navigate you can use the arrows on your keyboard. Move the cursor to the Blue colored link on “Visit New File” and then press enter:

Depending on what directory you are on it will show your path on the bottom of the screen. Press enter again to be taken to the directory:

When you are here you will see a cursor. Highlight the file you want to edit, then press enter:

* Please note that even though the text is green meaning it is executable, It’ll not show up green on GNU Emacs *

Type in anything in here just like any other text editor:

To save press these keys in sequence Ctl-x Ctl-s:

*Please note that when you enter command prefixes It will display below*

If done correctly on the bottom of your screen it should display this message:

Now you will see this when you list files on the directory: * Please note now you have an extra file named “hello.py~” The tilde file means it's a backup of your original file* You can learn more about this here at GNU backup files

Press C-z to close GNU Emacs:

Type:

cat hello.py

and

 cat hello.py~ 

It should display the same thing:

-End of Tutorial-


Games

In GNU Emacs there are several built in games that you can play in command line. I’ll show you Tetris, 5×5, Pong, Snake, and Dunnet. Some of the games don’t work on command line, but the ones I mentioned will work:

Here is the path where all the GNU Emacs Games are listed:

 /usr/share/emacs/25.2/lisp/play

25.2 is the Version. This will vary

List of all the games on GNU Emacs:

Enter “Emacs” and type “M-x Tetris” then press enter:

You are now playing Tetris on command line:

“M-x 5×5”:

“M-x pong”:

“M-x snake”:

“M-x dunnet”:

Dunnet is a Fun text adventure game with many different ways to beat the game. If your not careful, you will die or use key items that you need to complete the game. Have a good time playing and good luck!!!

networkops/gnu_emacs.txt · Last modified: 2020/03/09 22:45 by rainesc