[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 revision
Previous revision
Next revisionBoth sides next revision
slackbook:emacs [2012/09/16 16:33 (UTC)] – [Getting Help] 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 154: Line 154:
 <key>C-h</key> **t** is especially useful if you want or need practice using **//Emacs//**. <key>C-h</key> **t** is especially useful if you want or need practice using **//Emacs//**.
 ===== Calling Functions ===== ===== Calling Functions =====
-===== Emacs Cheat Sheet ===== 
  
 +As noted earlier, **//Emacs//** exports a
 +large number of functions to for interactive use.  Some of
 +these, like those opening and saving files, are mapped to keys.
 +Others (like the ones for moving to the beginning and end of
 +lines) are not.  To call them, you have to invoke them.  Say we
 +want to call the function //"end-of-line"// We would do
 +this:
  
  
-While [[slackbook:vi|vi]] (with its clones) is without a doubt the most ubiquitous editor on Unix-like systems, emacs(1) comes 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.)+**M-x** end-of-line <key>Enter</key>
  
-Also unlike vi, which is an (excellent) editor and nothing more, emacs is a program with near endless capabilities. emacs 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 own. This means that the user can extend emacs, and in fact write completely new programs "in emacs". 
  
-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 functionalityMany of these are related to text editingwhich is after all emacs' basic task, but it doesn't stop thereThere are for example several spreadsheet programs for emacsthere are databases, gamesmail and news clients (the top one being Gnus)etc.+And the cursor would move to the end of the line, as the function name 
 +suggests. 
 +===== Emacs Cheat Sheet ===== 
 + 
 +While Emacs can be simple to useits scope can easily be 
 +overwhelming Below are some useful Emacs commands.  Some 
 +aspects have been simplifiedmost notably regarding text 
 +selection.  These concepts, and more, are described the 
 +**//Emacs//** manualand various on-line 
 +tutorials.  Decent summaries can also be gleaned from web 
 +searches.
  
-There are two main versions of emacs: GNU Emacs (which is the version that comes with Slackware) and XEmacs. The latter is not a version for Emacs running under X. In fact, both emacs and XEmacs run on the console as well as under X. XEmacs was once started as a project to tidy up the emacs code. Currently, both versions are being actively developed, and there is in fact much interaction between the two development teams. For the present chapter, it is immaterial whether you use emacs or XEmacs, the differences between them are not relevant to the normal user. 
  
 +**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)|
 +|<key>C-p</key> |Move the cursor one line up (previous)|
 +|<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 operation. This 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 mode, delete the selected region, and store the result into the kill ring|
 +|M-<key>w</key> |While in selection mode, store 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 action. Unlike most other editors, this 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 items, or <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 Emacs, prompting 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 ()