[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
slackbook:emacs [2012/09/16 16:35 (UTC)] – [Calling Functions] Added original content and formatting mfillpotslackbook:emacs [2012/09/16 16:50 (UTC)] – [Emacs Cheat Sheet] **Emacs Cheat Sheet** ^Command^Result| |<key>C-f</key>|Move the cursor one character to the right (forward)| |<key>C-b</key>|Move the cursor one character to the left (backward)| |<key>C-n</key>|Move the cursor one line down (next)| |< mfillpot
Line 171: Line 171:
 ===== Emacs Cheat Sheet ===== ===== Emacs Cheat Sheet =====
  
 +While Emacs can be simple to use, its scope can easily be
 +overwhelming.  Below are some useful Emacs commands.  Some
 +aspects have been simplified, most notably regarding text
 +selection.  These concepts, and more, are described the
 +**//Emacs//** manual, and various on-line
 +tutorials.  Decent summaries can also be gleaned from web
 +searches.
  
  
-While [[slackbook:vi|vi]] (with its clonesis without a doubt the most ubiquitous editor on Unix-like systems, emacs(1comes in a good second. Instead of using different "modes", like vi does, it uses <key>Ctrl</key> and <key>Alt</key> key combinations to enter commands, in much the same way that you can use <key>Ctrl</key> and <key>Alt</key> key combinations in a word processor and indeed in many other applications to execute certain functions. (Though it should be noted that the commands rarely correspond; so while many modern applications use <key>Ctrl+C/X/V</key> for copying, cutting and pasting, emacs uses different keys and actually a somewhat different mechanism for this.) +**Emacs Cheat Sheet** 
- +^Command^Result| 
-Also unlike vi, which is an (excellent) editor and nothing more, emacs is a program with near endless capabilitiesemacs is (for the most part) written in Lisp, which is a very powerful programming language that has the peculiar property that every program written in it is automatically a Lisp compiler of its ownThis means that the user can extend emacs, and in fact write completely new programs "in emacs". +|<key>C-f</key> |Move the cursor one character to the right (forward)
- +|<key>C-b</key> |Move the cursor one character to the left (backward)| 
-As a result, emacs is not just an editor anymore. There are many add-on packages for emacs available (many come with the program's source) that provide all sorts of functionality. Many of these are related to text editing, which is after all emacsbasic task, but it doesn't stop thereThere are for example several spreadsheet programs for emacsthere are databasesgames, mail and news clients (the top one being Gnus)etc+|<key>C-n</key> |Move the cursor one line down (next)
- +|<key>C-p</key> |Move the cursor one line up (previous)| 
-There are two main versions of emacs: GNU Emacs (which is the version that comes with Slackware) and XEmacsThe latter is not a version for Emacs running under X. In factboth emacs and XEmacs run on the console as well as under XXEmacs was once started as a project to tidy up the emacs codeCurrently, both versions are being actively developed, and there is in fact much interaction between the two development teamsFor the present chapterit is immaterial whether you use emacs or XEmacs, the differences between them are not relevant to the normal user. +|<key>C-h</key> <key>'f'</key> FUNCTION-NAME <key>Enter</key> |Show documentation for function FUNCTION-NAME| 
 +|<key>C-h</key> <key>'k'</key> <key>C-x</key> <key>C-c</key> |Show documentation for the function bound to the keys <key>C-x</key> <key>C-c</key>| 
 +|<key>C-h</key> <key>t</key> |Show the Emacs tutorial| 
 +|<key>C-h</key> <key>?</key> |Show all help-related functions| 
 +|M-<key>'`'</key> |Access the Menu Bar| 
 +|<key>C-g</key> |Cancel the current operationThis is most useful when in the minibuffer.
 +|M-<key>x</key> FUNCTION-NAME <key>Enter</key> |Call the interactive function FUNCTION-NAME| 
 +|M-<key>1</key> M-<key>0</key> <key>C-n</key> |Move the cursor ten lines down| 
 +|<key>C-u</key> <key>1</key><key>0</key> <key>C-n</key> |Move the cursor ten lines down (same as above)| 
 +|M-<key>'x'</key> beginning-of-line |Move the cursor to the beginning of the current line| 
 +|M-<key>'x'</key> end-of-line |Move the cursor to the end of the current line| 
 +|M-<key>'>'</key> |Move the cursor to the end of the buffer| 
 +|M-<key>'<'</key> |Move the cursor to the beginning of the buffer| 
 +|<key>C-k</key> |Remove text from the cursor to the end of the line and place it into the kill ring| 
 +|<key>C-space</key> |Enter selection mode (use normal motion keys to move around)Press C-space again to leave it.| 
 +|<key>C-w</key> |While in selection modedelete the selected region, and store the result into the kill ring| 
 +|M-<key>w</key> |While in selection modestore the selected region into the kill ring.| 
 +|C-<key>y</key> |"Yanks" the contents of the kill ring and places them at the cursor's location| 
 +|<key>C-/</key> |Undo the previous actionUnlike most other editorsthis includes previous undo actions.| 
 +|<key>insert</key> |Enable or disable overwriting characters| 
 +|<key>C-s</key> asdf <key>Enter</key> |Forward incremental search for the string "asdf"Repeat <key>C-s</key> as needed to search for future items, or <key>C-r</key> (below) to search backwards.| 
 +|<key>C-r</key> asdf <key>Enter</key> |Backward incremental search for the string "asdf"Repeat <key>C-r</key> as needed to search for future itemsor <key>C-s</key> (above) to search forwards.| 
 +|M-<key>'%'</key> old <key>Enter</key> new <key>Enter</key> |Search for each instance of "old" and prompt you to replace it with "new"You can force replacement of all items by typing <key>'!'</key> at the replacement prompt.| 
 +|<key>C-x</key> <key>C-c</key> |Exit Emacsprompting you to save each unsaved buffer before doing so| 
 +|<key>C-x</key> <key>C-s</key> |Save the currrent buffer to its file| 
 +|<key>C-x</key> <key>C-w</key> new-file.txt <key>Enter</key> |Save the current buffer to a file //"new-file.txt"//|
 ===== Starting Emacs ===== ===== Starting Emacs =====
  
 slackbook:emacs ()