Chapter Summary


You can precede many of the commands in the following tables with a numeric argument to make the command repeat the number of times specified by the argument. Precede a numeric argument with CONTROL-U to keep emacs from entering the argument as text.

Table 7-23 lists commands that move the cursor.

Table 7-23. Moving the cursor

Command

Result

CONTROL-F

Forward by characters

CONTROL-B

Backward by characters

META-f

Forward by words

META-b

Backward by words

META-e

To end of sentence

META-a

To beginning of sentence

META-}

To end of paragraph

META-{

To beginning of paragraph

META->

Forward to end of buffer

META-<

Backward to beginning of buffer

CONTROL-ESCAPE

To end of line

CONTROL-A

To beginning of line

CONTROL-N

Forward (down) one line

CONTROL-P

Backward (up) one line

CONTROL-V

Scroll forward (down) one window

META-v

Scroll backward (up) one window

CONTROL-L

Clear and repaint screen, and scroll current line to center of window

META-r

To beginning of middle line

CONTROL-U num META-r

To beginning of line number num (0 = top, = bottom)


Table 7-24 lists commands that kill and delete text.

Table 7-24. Killing and deleting text

Command

Result

CONTROL-DELETE

Deletes character under cursor

DELETE

Deletes character to left of cursor

META-d

Kills forward to end of current word

META-DELETE

Kills backward to beginning of previous word

META-k

Kills forward to end of sentence

CONTROL-X DELETE

Kills backward to beginning of sentence

CONTROL-K

Kills forward to, but not including, line-ending LINEFEED; if there is no text between the cursor and the LINEFEED, kills the LINEFEED

CONTROL-U 1 CONTROL-K

Kills from cursor forward to and including LINEFEED

CONTROL-U 0 CONTROL-K

Kills from cursor backward to beginning of line

META-z char

Kills forward to, but not including, next occurrence of char

META-w

Copies Region to Kill Ring (does not delete Region from buffer)

CONTROL-W

Kills Region (deletes Region from buffer)

CONTROL-Y

Yanks most recently killed text into current buffer at Point; sets Mark at beginning of this text, with Point and cursor at the end

META-y

Erases just-yanked text, rotates Kill Ring, and yanks next item (only after CONTROL-Y or META-y)


Table 7-25 lists commands that search for strings and regular expressions.

Table 7-25. Search commands

Command

Result

CONTROL-S

Prompts incrementally for a string and searches forward

CONTROL-S RETURN

Prompts for a complete string and searches forward

CONTROL-R

Prompts incrementally for a string and searches backward

CONTROL-R RETURN

Prompts for a complete string and searches backward

META-CONTROL-S

Prompts incrementally for a regular expression and searches forward

META-CONTROL-S RETURN

Prompts for a complete regular expression and searches forward

META-x isearch-backward-regexp

Prompts incrementally for a regular expression and searches forward

META-x isearch-backward-regexp RETURN

Prompts for a complete regular expression and searches backward


Table 7-26 lists commands that provide online help.

Table 7-26. Online help

Command

Result

CONTROL-H a

Prompts for string and displays a list of commands whose names contain string

CONTROL-H b

Displays a (long) table of all key bindings now in effect

CONTROL-H c key-sequence

Displays the name of the command bound to key-sequence

CONTROL-H k key-sequence

Displays the name of and documentation for the command bound to key-sequence

CONTROL-H f

Prompts for the name of a Lisp function and displays the documentation for that function

CONTROL-H i (lowercase "i")

Displays the top menu of info (page 30)

CONTROL-H l (lowercase "l")

Displays the last 100 characters typed

CONTROL-H m

Displays the documentation and special key bindings for the current Major mode

CONTROL-H n

Displays the emacs news file

CONTROL-H t

Starts an emacs tutorial session

CONTROL-H v

Prompts for a Lisp variable name and displays the documentation for that variable

CONTROL-H w

Prompts for a command name and displays the key sequence, if any, bound to that command


Table 7-27 lists commands that work with a Region.

Table 7-27. Working with a Region

Command

Result

META-W

Copies Region nondestructively to the Kill Ring

CONTROL-W

Kills (deletes) Region

META-x print-region

Copies Region to the print spooler

META-x append-to-buffer

Prompts for buffer name and appends Region to that buffer

META-x append-to-file

Prompts for filename and appends Region to that file

CONTROL-X CONTROL-U

Converts Region to uppercase

CONTROL-X CONTROL-L

Converts Region to lowercase


Table 7-28 lists commands that work with lines.

Table 7-28. Working with lines

Command

Result

META-x occur

Prompts for a regular expression and lists each line containing a match for the expression in a buffer named *Occur*

META-x delete-matching-lines

Prompts for a regular expression and deletes lines from Point forward that have a match for the regular expression

META-x delete-non-matching-lines

Prompts for a regular expression and deletes lines from Point forward that do not have a match for the regular expression


Table 7-29 lists commands that replace strings and regular expressions unconditionally and interactively.

Table 7-29. Commands that replace text

Command

Result

META-x replace-string

Prompts for two strings and replaces each instance of the first string with the second string from Mark forward; sets Mark at the start of the command

META-% or META-x query-replace

As above but queries for each replacement (see Table 7-30 for a list of responses)

META-x replace-regexp

Prompts for a regular expression and a string, and replaces each match for the regular expression with the string; sets Mark at the start of the command

META-x query-replace-regexp

As above but queries for each replacement (see Table 7-30 for a list of responses)


Table 7-30 lists responses to replacement queries.

Table 7-30. Responses to replacement queries

Command

Result

RETURN

Quits searching (does not make or query for any more replacements)

SPACE

Makes this replacement and continues querying

DELETE

Does not make this replacement and continues querying

, (comma)

Makes this replacement, displays the result, and asks for another command

. (period)

Makes this replacement and does not make or query for any more replacements

! (exclamation point)

Replaces this and all remaining instances without querying


Table 7-31 lists commands that work with windows.

Table 7-31. Working with windows

Command

Result

CONTROL-X b

Prompts for and displays a different buffer in current window

CONTROL-X 2

Splits current window vertically into two

CONTROL-X 3

Splits current window horizontally into two

CONTROL-X 0 (lowercase "o")

Selects other window

META-CONTROL-V

Scrolls other window

CONTROL-X 4b

Prompts for buffer name and selects it in other window

CONTROL-X 4f

Prompts for filename and selects it in other window

CONTROL-X 0 (zero)

Deletes current window

CONTROL-X 1 (one)

Deletes all windows except current window

META-x shrink-window

Makes current window one line shorter

CONTROL-X ^

Makes current window one line taller

CONTROL-X }

Makes current window one character wider

CONTROL-X {

Makes current window one character narrower


Table 7-32 lists commands that work with files.

Table 7-32. Working with files

Command

Result

CONTROL-X CONTROL-F

Prompts for a filename and reads its contents into a new buffer; assigns the file's simple filename as the buffer name.

CONTROL-X CONTROL-V

Prompts for a filename and reads its contents into the current buffer (overwriting the contents of the current buffer).

CONTROL-X 4 CONTROL-F

Prompts for a filename and reads its contents into a new buffer; assigns the file's simple filename as the buffer name. Creates a new window for the new buffer and selects that window. This command splits the screen in half if you begin with only one window.

CONTROL-X CONTROL-S

Saves the current buffer to the original file.

CONTROL-X S

Prompts for whether to save each modified buffer (y/n).

META-x set-visited-file-name

Prompts for a filename and sets the current buffer's "original" name to that filename.

CONTROL-X CONTROL-W

Prompts for a filename, sets the current buffer's "original" name to that filename, and saves the current buffer in that file.

META-~ (tilde)

Clears modified flag from the current buffer. Use with caution.


Table 7-33 lists commands that work with buffers.

Table 7-33. Working with buffers

Command

Result

CONTROL-X CONTROL-S

Saves current buffer in its associated file.

CONTROL-X CONTROL-F

Prompts for filename and visits (opens) that file.

CONTROL-X b

Prompts for buffer name and selects it. If that buffer does not exist, creates it.

CONTROL-X 4b

Prompts for buffer name and displays that buffer in another window. The existing window is not disturbed, although the new window may overlap it.

CONTROL-X CONTROL-B

Creates a buffer named *Buffer List* and displays it in another window. The existing window is not disturbed, although the new window may overlap it. The new buffer is not selected. In the *Buffer List* buffer, each buffer's data is displayed with its name, size, mode(s), and original filename.

META-x rename-buffer

Prompts for a new buffer name and assigns this new name to the current buffer.

CONTROL-X CONTROL-Q

Toggles the current buffer's readonly status and the associated %% Mode Line indicator.

META-x append-to-buffer

Prompts for buffer name and appends Region to the end of that buffer.

META-x prepend-to-buffer

Prompts for buffer name and prepends Region to beginning of that buffer.

META-x copy-to-buffer

Prompts for buffer name, deletes contents of that buffer, and copies the Region to that buffer.

META-x insert-buffer

Prompts for buffer name and inserts entire contents of that buffer in current buffer at Point.

CONTROL-X k

Prompts for buffer name and deletes that buffer.

META-x kill-some-buffers

Goes through the entire buffer list and offers the chance to delete each buffer.


Table 7-34 lists commands that run shell commands in the foreground. These commands may not work with all shells.

Table 7-34. Foreground shell commands

Command

Result

META-! (exclamation point)

Prompts for shell command, executes it, and displays the output

CONTROL-U META-! (exclamation point)

Prompts for shell command, executes it, and inserts the output at Point

META-| (vertical bar)

Prompts for shell command, supplies Region as input to that command, and displays output of command

CONTROL-U META-| (vertical bar)

Prompts for shell command, supplies Region as input to that command, deletes old Region, and inserts output of command in place of Region


Table 7-35 lists commands that run shell commands in the background.

Table 7-35. Background shell commands

Command

Result

META-x compile

Prompts for shell command and then runs that command in the background, with output going to the buffer named *compilation*

META-x kill-compilation

Kills background process


Table 7-36 lists commands that convert text from uppercase to lowercase and vice versa.

Table 7-36. Case conversion commands

Command

Result

META-l (lowercase "l")

Converts word to right of Point to lowercase

META-u

Converts word to right of Point to uppercase

META-c

Converts word to right of Point to initial caps

CONTROL-X CONTROL-L

Converts Region to lowercase

CONTROL-X CONTROL-U

Converts Region to uppercase


Table 7-37 lists commands that work in C mode.

Table 7-37. C mode commands

Command

Result

CONTROL-META-f

Moves forward over expression

CONTROL-META-b

Moves backward over expression

CONTROL-META-k

Moves forward over expression and kills it

CONTROL-META-@

Sets Mark at the position CONTROL-META-f would move to, without changing Point

CONTROL-META-a

Moves to beginning of the most recent function definition

CONTROL-META-e

Moves to the end of the next function definition

CONTROL-META-h

Moves Point to beginning and Mark to end of current (or next, if between) function definition


Type META-x shell to create a buffer named *shell* and start a subshell. Table 7-38 lists commands that work on this buffer.

Table 7-38. Shell mode commands

Command

Result

RETURN

Sends current line to the shell

CONTROL-C CONTROL-D

Sends CONTROL-D to shell or its subshell

CONTROL-C CONTROL-C

Sends CONTROL-C to shell or its subshell

CONTROL-C CONTROL-\

Sends quit signal to shell or its subshell

CONTROL-C CONTROL-U

Kills text on the current line not yet completed

CONTROL-C CONTROL-R

Scrolls back to beginning of last shell output, putting first line of output at the top of the window

CONTROL-C CONTROL-O (uppercase "O")

Deletes last batch of shell output





A Practical Guide to UNIX[r] for Mac OS[r] X Users
A Practical Guide to UNIX for Mac OS X Users
ISBN: 0131863339
EAN: 2147483647
Year: 2005
Pages: 234

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net