DAY 1 – Welcome to Emacs

Thank you for the encouragement!!

I am planning to put my learning emacs into a series of a blog which can help new users to get emacs acquainted quickly.

The series post is part of my “LEARN EMACS IN 30 DAYS CHALLENGE.”

Below are the topics, I am planning to cover upon during my 30 Days challenge. The checklist is not in any particular order, but just to remind me of the topics which I need to cover.

  • Welcome to emacs. – You are here.
  • what are modes in emacs?
  • What is IDO Mode and its benefits?
  • org-mode your personal notepad and organizer.
  • Manage your todo with org-mode
  • tramp: doing remote work with tramp.
  • Running command by its name
  • help commands for fixing typos.
  • commands for moving around in the file.
  • how to mark and the region, cut, copy and pasting text
  • understanding emacs registers or the clipboard.
  • Managing your emacs window.
  • using multiple buffers in one window and using multiple windows
  • creating multi frames and using the graphical display.
  • How to search for text and replace it.
  • File handling with emacs.
  • using emacs as your terminal and run commands.
  • using your emacs as an IDE. Editing, compiling, testing, and maintaining programs.
  • As an alternate MTA to outlook/Gmail. Sending mail, reading mail with rmail.
  • Emacs as a file manager. Dired mode.
  • Making emacs as an online diary. calendar and the diary.
  • connecting to IRC.
  • My python IDE.
  • Beautifying emacs with colorful themes.
  • Mold emacs as you like it.
  • extending your emacs.
  • version control with emacs.
  • when you are bored and just want to chill.
  • Programming in emacs.
  • Emacs as a Perl IDE
  • Emacs as an HTML IDE
  • Writing beautiful ruby codes in emacs.

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

– Emacs Manual

In simple words, emacs is an editor, like vi or nano. You may not be familiar with these editors as they are mainly found on the Unix/Unix-like systems.

Emacs is an advanced editor because of its ability to perform complex operations related to OS, by controlling subprocesses, indenting programs automatically, showing multiple files at once and of course, it can be used as a text editor as well :).

It is also a self-documenting means any time special command for help can be used for finding out what the particular command does. Emacs can be easily altered to behave in a certain preference and is highly customizable.

Emacs can go beyond simple customization and can create entirely new commands. These new commands are simple to program and can be written in LISP.

Downloading

I downloaded for MAC OS X as I am using Mac from http://emacsformacosx.com/. I had been suggested by many sites and also from the people on IRC #emacs channel, while you are learning to use emacs, do not start with a customized emacs. I believe it could be mainly because a lot of customizations are already done for you, hence limiting your learning curve. Well, downloading and installing with OS X is pretty simple and straight, I got “Emacs Version 24.3 Universal Binary Released 2013-03-11”. Double click on the installer and voila the installation is completed on the fly.

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 downloaded and installed. From the 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)

Few things to note and which are global to emacs.
  • Control Key in emacs is denoted as ‘C’.
  • Alt or Esc Key in emacs is denoted as’ or referred in the document as meta key.
  • The shift key will be denoted as ‘S’.

The first command to know is how to exit from emacs to normal prompt.
Use C-x C-c to quit emacs,
If you have written something in the editor use C-x C-s(save file) C-x C-c(Quit Emacs).

You can also use the X(cross icon on the right-hand side) in the window manager to just come out of emacs.

Moving around

Most movements in emacs can be controlled using the arrow keys but there are still debates and emacsgurus do not advise to use arrows keys still say it is not advisable and the use of key sequences controlled by Ctrl and Meta keys are advisable. below table helps in understanding the movements with these keys.</tr> </tr> </tbody> </table> These are some of the common keys for moving around while in emacs. It seems its really hard for getting used to it, but as I am working with emacs for some time, I started to feel it is most obvious to be like that. I think most of the time as a beginner we could get along with using the arrow keys and we should highly discourage it and use the emacs specific keybindings to move around within emacs. Apart from bringing the emacs on and starting it up, the very important thing we should remember is how to close it. During my initial days as emacs user, I was not aware of quitting emacs, and have of the time ended in killing emacs from the process tree, now I feel so stupid. C-g and C-x C-c are the commands, which can help you all the time, while we are learning. I have heard more advanced user of emacs seldom close their emacs sessions and I may try to forget using C-x C-C again. It may take some time till I get there and stop closing my emacs and I am sure it would be more than 30 days.

KeysMovement
C-vView next screen also as Page Up.
M-vMove Backward one screen or Page Down.
C-lredisplay the text with cursor at the center of the screen.
C-pPrevious line or up arrow key.
C-bback one character or left arrow key.
C-fforward one character or right arrow key.
C-nNext line or down arrow key.
M-fMove one forward one word.
M-bMove back one word.
C-aMove to the beginning of the line.
C-eMove to the end of the line.
M-aMove to the beginning of the sentence.
M-eMove to the end of the sentence.
C-uto 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-gKill the running command in minibffer, or in case emacs
 stop responding.
C-dDelete the next character after the cursor cursor.
DELdelete the character just before the cursor.
Inserttext insertion is as simple as typing it.
textyou can use the C-u to insert text as well. for eg.
 C-u 10 – will insert hyphens. (-———).
M-</td>Kill the word before the cursor.
M-dKill the word after the cursor
C-kKill from the cursor position to end of line.
M-kKill to the end of current sentence.
C-</td>Set the mark, move aroung with the above keys to highlight
 the text.
C-yYank the file back.
C-x C-fFind file, can be used for creating a file or opening an
 exitisitng file.
C-x C-sSave the file, when you made some changes to the file and
 want to write the same to disk or save it.
C-x sSave some buffers.
C-x C-bList all the opened Buffers.
C-x bSwitch buffer around.
C-x C-cQuit Emacs.