slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
EMACS PowerPoint Presentation
Download Presentation
EMACS

Loading in 2 Seconds...

play fullscreen
1 / 18

EMACS - PowerPoint PPT Presentation


  • 396 Views
  • Uploaded on

To quote the Emacs Manual: Emacs is the extensible, customizable, self-documenting real-time display editor.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'EMACS' - Gabriel


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
emacs

To quote the Emacs Manual:

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

Emacs is an editor for plain-text, programming or markup languages, and anything else that someone has created a module for. Emacs also has tools for compiling, running and testing programs.

EMACS
emacs commands

* All of the basic editing commands (and there are lots of them) are available no matter what you're trying to do (there are no command “modes” like in vi to worry about)

* All the tools Emacs provides for opening, saving, searching, and processing text (and more) are available to you no matter what you're in the middle of doing.

Emacs Commands
extensibility

If Emacs doesn't work the way you'd like, you can use the Emacs Lisp (Elisp) language to customize Emacs, automate common tasks, or add new features. Elisp is very easy to get started with and yet remarkably powerful: you can use it to alter and extend almost any feature of Emacs.

As an example, there are addons to emacs which allow you to read news, mail, and RSS feeds, manage your files, or even play Tetris! (good old M-x tetris)

Extensibility
movement commands

C – means to press the C key and a key

M – means to press the Meta key and a key

If your terminal does not support a meta key, you can press ESC, release ESC, and then press the key to enter the meta command.

C-f Forward one character C-b Back one character

C-n Next line C-p Previous line

C-a Beginning of line C-e End of line

M-f Forward one word M-b Back one word

M-a Previous sentence M-e Next sentence

M-v Previous screen C-v Next screen

M-< Beginning of buffer M-> End of buffer

Getting fancy:

C-u 3 C-p Back 3 lines

C-u 10 C-f Forward 10 characters

M-1 M-0 C-f Forward 10 characters

C-u C-n Forward 4 lines

C-u C-u C-n Forward 16 lines

C-u C-u C-u C-n Forward 64 lines

M-g g Jump to specified line

Movement Commands
more advanced movement

C-s Incremental search forward

C-r Incremental search backward

Emacs remembers something called the mark, which is a previous cursor position. You can set mark to indicate a particular place in your buffer so you can return to it easily. C-x C-x at a later time will return point to mark. Actually, that command also moves mark to where point formerly was; therefore, a second C-x C-x returns point to its original position.

C-SPC Set mark to the current location

C-x C-x Swap point and mark

Emacs tries to be helpful: many commands that have the potential to take you long distances set mark so that a simple C-x C-x takes you back to where you were. Emacs makes it difficult to lose your place in a buffer: even if you take a detour, you don't need to scroll around to get back to where you were.

Emacs saves many previous values of the mark for you. You can cycle through the mark ring, which contains the last 16 marks you've set in the current buffer:

C-u C-SPC Cycle through mark ring

More advanced movement
menu bar

Emacs features a menu bar at the top of the screen which allows easy access to command commands.

On a graphical display, you can use your mouse to click on these toolbars as normal for GUI apps.

On a terminal display, you can press F10 to move to the first bar, and then navigate via arrow keys. Return selects, ESC cancels navigation.

Right arrows on the menu means that the item leads to another menu, ... on the menu means that the item will execute a command which will require input from the bottom of the window.

Menu Bar
slide8
C-l Clears the screen and redraws it, centering on the cursor.

C-v scroll forward (pagedown also works)

M-v scroll backwards (pageup works)

Scrolling
windows not the os

Emacs has support for displaying multiple viewing windows at the same time.

C-x 2 Split the current window into 2, one above the other

C-x 3 Split the current window into 2, one next to the other

C-x o Switch focus to another window

C-x 0 delete the currently selected window

C-x 1 make the currently selected window the only window (delete / close others)

C-x ^ makes the current window taller

C-x } makes the current window wider

Windows! (Not the OS)
killing cutting text

C-k kills the portion of the current line after point (or deletes the newline following point if point is at the end of line). The prefix argument for C-k can be used to kill multiple lines:

C-k Kill line

C-u 10 C-k Kill 10 lines

The following commands operate on the region, and are the closest analogs to "cut" and "copy" in Emacs:

C-w Kill region ("cut")

M-w Save region to kill ring without deleting ("copy")

These commands are also handy:

M-d Kill next word

M-k Kill to end of sentence

All of the above commands kill the text being deleted, which means that Emacs removes the text and squirrels it away for later retrieval ("yanking"). Most commands which delete significant amounts of text kill it rather than simply removing it, so that you can use those commands either to "delete" text or to "cut" it for later use.

Killing / Cutting Text
yanking pasting text

After a piece of text has been killed, it goes to a place called the kill ring which is analogous to the "clipboard": you can yank an item to restore it from the kill ring with C-y. Unlike the clipboard, however, the kill ring is capable of holding many different items. If the item you want to yank is not placed when you type C-y, type M-y (repeatedly, if necessary) to cycle through previously killed items.

C-y Yanks last killed text

M-y Replace yanked text with previously killed text

Recall that most commands which delete a large amount of text in fact kill it (i.e. place it in the kill ring) so you can restore it later. Emacs makes it very difficult to lose a lot of text permanently: in editors with only a single clipboard, one can easily accidentally delete a large chunk of text or clobber the contents of the clipboard (by cutting two items in succession). But in Emacs, in either of those cases, the lost text can easily be retrieved from the kill ring.

Yanking / Pasting Text
slide12

Aka, Uh-oh, where did my thesis go?

Many editors feature an Undo function, but commonly if you perform an “Undo”, then change some text, you are unable to “Redo”. Emacs however stores all actions, enabling you to do some things, undo them, do some other things, and then at any point undo over and over back to any of the previous states.

If this sounds complicated, just remember that "undo" is always capable of getting you back to any previous state your buffer was in (unless Emacs has run out of memory to store the undo history). The principle here is that Emacs makes it very difficult to accidentally lose your work.

Undo is available via three different keys:

C-/ Undo

C-_ Undo

C-x u Undo

So if you need to get back to a previous buffer state, simply move the cursor (so as to break any existing sequence of undos), and press C-/ until you find what you want.

Undo!
search replace

M-% Query replace

The query replace command prompts you for a search string and a replacement. Then, for each match in the buffer, you can choose whether or not to replace the search string. Here are some of the options available at each prompt:

* Type y to replace the current match.

* Type n to skip to the next match without replacing.

* Type q to exit without doing any more replacements.

* Type . to replace this match, then exit.

* Type ! to replace all remaining matches with no more questions.

Also, in addition to the search methods listed earlier, there exists:

C-M-s Regular expression incremental search

Search & Replace
forgetting commands

If you don't remember what a particular key or command does, you can read a description of it by using one of the following commands:

C-h k Shows documentation for the command associated with any particular key.

C-h f Shows documentation for any particular command, by name (i.e. what you would type after M-x).

C-h a Allows a search for a feature you do not know exactly how to perform.

For example, C-h k C-s and C-h f isearch-forward RET both display a page describing incremental search.

Forgetting Commands
tools

M-x shell

Starts a shell in the buffer named *shell*, switching to it if it already exists. Use C-u M-x shell to use a buffer with a different name.

M-x compile

Invokes make (with targets and options of your choice) and displays output in a new buffer. Emacs identifies error lines containing filenames and line numbers, and you can click on them to jump directly to the corresponding buffer and line.

M-x grep

Invokes grep and prints results in a new buffer. Like M-x compile, when you click on a match Emacs opens the correct file and takes you to the matching line.

M-x man

Displays man pages.

M-x shell-command or M-!

Executes a command and displays the output in a new buffer.

Tools
modules

You can switch modes in an existing buffer by using M-x and the name of the mode:

M-x java-mode Mode for editing Java files

M-x python-mode Mode for editing Python files

M-x text-mode Mode for editing text files

M-x fundamental-mode Mode with no specializations at all

M-x highlight-changes Mode which colors text added most recently

Emacs is very good at determining the right mode to use when you open a file so often these commands are unnecessary.

These are examples of the commands provided by language major modes:

Language Some special commands available

Lisp Manipulate s-exps in various ways; execute expressions

Python Indent, unindent blocks; run code in Python shell

HTML Insert and close tags; preview in browser

In almost all cases, major modes for unsupported formats are available as extension packages. You can find many of them on EmacsWiki.

Modules
ports

There are many different builds of Emacs available freely online. The source code is also available online.

Emacs is built on many Linux distros, Windows, DOS, OSX, and others.

Emacs exists in terminal, Xwindow, and other GUI flavors.

Ports