Welcome to the Awseome world of Emacs.
I am planning to put my emacs learnings into a series of a blog which can help new users to get acquainted with emacs quickly and shorten their learning curve.
This series post is part of my “LEARN EMACS IN 30 DAYS CHALLENGE.”
I have prepared a list of some of the topics that I am planning to blog during my 30 Days challenge. The below list is not in any particular order, 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 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.
I have downloaded emacs for MAC OS X from http://emacsformacosx.com/. It is recommended to use the base raw version of emacs while learning emacs, Though customized version can be very helpful and provide ease of use. They do come with a lot of customizations which therefore, limits the learning curve.
Downloading and installing on OS X is pretty simple and straight,
I downloaded “Emacs Version 25.2.1 Universal Binary”. Double click on the installer and voila the installation is completed on the fly.
aoplus:wp-docker omps$ emacs --version GNU Emacs 25.2.1 Copyright (C) 2017 Free Software Foundation, Inc. GNU Emacs comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of GNU Emacs under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING.
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). In addition, we can also use the X(cross icon on the right-hand side) in the window manager to just come out of emacs,
Almost all the movements in emacs editor can be controlled using the arrow keys though, the recommended practice is to use the Ctrl and Meta Keys, they can be difficult in the beginneing However, moving around using the keys are the correct way to work around in emacs. In the beginning, it will seem its failry hard for getting used to it however, as we work along with emacs, this starts to feel most obvious.
I think most of the time as a beginner we could get along with using the arrow keys and I highly discourage it and use the emacs specific keybindings to move around within emacs.
Above all, while we know starting up emacs, the very next important thing is to learn to close emacs.. During my initial days as emacs user, I did not know how to quit emacs, and most of the time ended in killing emacs from the process tree.
C-g and C-x C-c are some of the commands, which are handy all the time while we are learning. Advanced users of emacs seldom close their emacs sessions.
|C-v||View next screen also as Page Up.|
|M-v||Move Backward one screen or Page Down.|
|C-l||redisplay the text with 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 instead will scroll to that many lines forward/backward|
|C-g||Kill the running command in minibffer, 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 hyphens. (-———).
|M-||Kill the word before the cursor.|
|M-d||Kill the word after the cursor|
|C-k||Kill from the cursor position to end of line.|
|M-k||Kill to the end of current sentence.|
|C-</td>||Set the mark, move aroung with the above keys to highlight the text.|
|C-y||Yank the line back, basically pating.|
|C-x C-f||Find file, can be used for creating a file or opening an exitisitng 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, this will save the text to a file you are working on|
|C-x C-b||List all the opened Buffers.|
|C-x b||Switch buffer around.|
|C-x C-c||Quit Emacs.|
While this is just the beginning of the emacs tour I started, watch our this space to learn some cool, new tips and tricks with emacs.