X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/21c983fc689f674c4d1b180e714e84c603877eab..a716bfbc113293a77b1787b52fc1a9bc6bc3cbe5:/man/basic.texi diff --git a/man/basic.texi b/man/basic.texi index db2b08513a..3ec6e47c5b 100644 --- a/man/basic.texi +++ b/man/basic.texi @@ -1,5 +1,5 @@ @c This is part of the Emacs manual. -@c Copyright (C) 1985, 86, 87, 93, 94, 95, 97, 2000 Free Software Foundation, Inc. +@c Copyright (C) 1985,86,87,93,94,95,97,2000,2001 Free Software Foundation, Inc. @c See file emacs.texi for copying conditions. @node Basic, Minibuffer, Exiting, Top @chapter Basic Editing Commands @@ -43,11 +43,31 @@ in the buffer is @samp{FOOBAR}, with the cursor before the @samp{B}, then if you type @kbd{XX}, you get @samp{FOOXXBAR}, with the cursor still before the @samp{B}. - To @dfn{delete} text you have just inserted, use @key{DEL}. @key{DEL} -deletes the character @emph{before} the cursor (not the one that the cursor -is on top of or under; that is the character @var{after} the cursor). The -cursor and all characters after it move backwards. Therefore, if you type -a printing character and then type @key{DEL}, they cancel out. + To @dfn{delete} text you have just inserted, use the large key +labeled @key{DEL}, @key{BACKSPACE} or @key{DELETE} which is a short +distance above the @key{RET} or @key{ENTER} key. This is the key you +normally use, outside Emacs, for erasing the last character that you +typed. Regardless of the label on that key, Emacs thinks of it as +@key{DEL}, and that's what we call it in this manual. + + The @key{DEL} key deletes the character @emph{before} the cursor. +As a consequence, the cursor and all the characters after it move +backwards. If you type a printing character and then type @key{DEL}, +they cancel out. + + On most computers, Emacs recognizes automatically which key ought to +be @key{DEL}, and sets it up that way. But in some cases, especially +with text-only terminals, you will need to tell Emacs which key to use +for that purpose. If the large key not far above the @key{RET} or +@key{ENTER} key doesn't delete backwards, you need to do this. +@xref{DEL Does Not Delete}, for an explanation of how. + + Most PC keyboards have both a @key{BACKSPACE} key a short ways above +@key{RET} or @key{ENTER}, and a @key{DELETE} key elsewhere. On these +keyboards, Emacs supports when possible the usual convention that the +@key{BACKSPACE} key deletes backwards (it is @key{DEL}), while the +@key{DELETE} key deletes ``forwards,'' deleting the character after +point, the one underneath the cursor, like @kbd{C-d} (see below). @kindex RET @cindex newline @@ -83,12 +103,14 @@ inserts that character. @item @kbd{C-q} followed by a sequence of octal digits inserts the character with the specified octal character code. You can use any number of -octal digits; any non-digit terminates the sequence. If the terminating -character is @key{RET}, it serves only to terminate the sequence; any -other non-digit is itself used as input after terminating the sequence. -(The use of octal sequences is disabled in ordinary non-binary Overwrite -mode, to give you a convenient way to insert a digit instead of -overwriting with it.) +octal digits; any non-digit terminates the sequence. If the +terminating character is @key{RET}, it serves only to terminate the +sequence. Any other non-digit terminates the sequence and then acts +as normal input---thus, @kbd{C-q 1 0 1 B} inserts @samp{AB}. + +The use of octal sequences is disabled in ordinary non-binary +Overwrite mode, to give you a convenient way to insert a digit instead +of overwriting with it. @end itemize @cindex 8-bit character codes @@ -122,10 +144,6 @@ rebind @key{DEL} to other commands. @section Changing the Location of Point @cindex arrow keys -@kindex LEFT -@kindex RIGHT -@kindex UP -@kindex DOWN @cindex moving point @cindex movement @cindex cursor motion @@ -148,6 +166,10 @@ them). Others do more sophisticated things. @kindex M-> @kindex M-< @kindex M-r +@kindex LEFT +@kindex RIGHT +@kindex UP +@kindex DOWN @findex beginning-of-line @findex end-of-line @findex forward-char @@ -165,11 +187,11 @@ Move to the beginning of the line (@code{beginning-of-line}). @item C-e Move to the end of the line (@code{end-of-line}). @item C-f -Move forward one character (@code{forward-char}). The @key{->} right -arrow key, if your keyboard has it, does the same. +Move forward one character (@code{forward-char}). The right-arrow key +does the same thing. @item C-b -Move backward one character (@code{backward-char}). The @key{<-} left -arrow key has the same effect. +Move backward one character (@code{backward-char}). The left-arrow +key has the same effect. @item M-f Move forward one word (@code{forward-word}). @item M-b @@ -177,10 +199,10 @@ Move backward one word (@code{backward-word}). @item C-n Move down one line, vertically (@code{next-line}). This command attempts to keep the horizontal position unchanged, so if you start in -the middle of one line, you end in the middle of the next. The down -arrow key, if your keyboard has it, does the same. +the middle of one line, you end in the middle of the next. The +down-arrow key does the same thing. @item C-p -Move up one line, vertically (@code{previous-line}). The up arrow key +Move up one line, vertically (@code{previous-line}). The up-arrow key has the same effect. @item M-r Move point to left margin, vertically centered in the window @@ -190,19 +212,24 @@ A numeric argument says which screen line to place point on. It counts screen lines down from the top of the window (zero for the top line). A negative argument counts lines from the bottom (@minus{}1 for the bottom line). -@item C-v -Scroll the display forward one windowfull. If your keyboard has a -@key{PageDown} key, it does the same. Scrolling commands are further -described in @ref{Scrolling}. -@item M-v -Scroll the display backward one windowfull. The @key{PageUp} key has -the same effect. @xref{Scrolling}. @item M-< Move to the top of the buffer (@code{beginning-of-buffer}). With numeric argument @var{n}, move to @var{n}/10 of the way from the top. @xref{Arguments}, for more information on numeric arguments.@refill @item M-> Move to the end of the buffer (@code{end-of-buffer}). +@item C-v +Scroll the display one screen forward, and move point if necessary to put +it on the screen (@code{scroll-up}). This doesn't always +move point, but it is commonly used to do so. +If your keyboard has a @key{PAGEDOWN} key, it does the same thing. + +Scrolling commands are further described in @ref{Scrolling}. +@item M-v +Scroll one screen backward, and move point if necessary to put it on +the screen (@code{scroll-down}). This doesn't always move point, but +it is commonly used to do so. The @key{PAGEUP} key has the same +effect. @item M-x goto-char Read a number @var{n} and move point to buffer position @var{n}. Position 1 is the beginning of the buffer. @@ -224,7 +251,7 @@ again try to stick to a fixed horizontal position, as usual. @vindex track-eol If you set the variable @code{track-eol} to a non-@code{nil} value, -then @kbd{C-n} and @kbd{C-p} when at the end of the starting line move +then @kbd{C-n} and @kbd{C-p}, when starting at the end of the line, move to the end of another line. Normally, @code{track-eol} is @code{nil}. @xref{Variables}, for how to set variables such as @code{track-eol}. @@ -235,7 +262,7 @@ if you set the variable @code{next-line-add-newlines} to a non-@code{nil} value, @kbd{C-n} on the last line of a buffer creates an additional line at the end and moves down onto it. -@node Erasing +@node Erasing @section Erasing Text @table @kbd @@ -243,6 +270,12 @@ an additional line at the end and moves down onto it. Delete the character before point (@code{delete-backward-char}). @item C-d Delete the character after point (@code{delete-char}). +@item @key{DELETE} +@itemx @key{BACKSPACE} +One of these keys, whichever is the large key above the @key{RET} or +@key{ENTER} key, deletes the character before point, like @key{DEL}. +If that is @key{BACKSPACE}, and your keyboard also has @key{DELETE}, +then @key{DELETE} deletes forwards, like @kbd{C-d}. @item C-k Kill to the end of the line (@code{kill-line}). @item M-d @@ -301,7 +334,7 @@ where it was before the command that made the change. Consecutive repetitions of @kbd{C-_} or @kbd{C-x u} undo earlier and earlier changes, back to the limit of the undo information available. If all recorded changes have already been undone, the undo command -prints an error message and does nothing. +displays an error message and does nothing. Any command other than an undo command breaks the sequence of undo commands. Starting from that moment, the previous undo commands become @@ -432,7 +465,6 @@ a description of all the help facilities. @xref{Help}.@refill Here are special commands and techniques for putting in and taking out blank lines. -@c widecommands @table @kbd @item C-o Insert one or more blank lines after the cursor (@code{open-line}). @@ -474,6 +506,7 @@ nonblank line. @cindex continuation line @cindex wrapping @cindex line wrapping +@cindex fringes, and continuation lines If you add too many characters to one line without breaking it with @key{RET}, the line grows to occupy two (or more) lines on the screen. On graphical displays, Emacs indicates line wrapping with small bent @@ -497,6 +530,7 @@ Auto Fill mode (@pxref{Filling}) if that's what you want. @vindex truncate-lines @cindex truncation +@cindex line truncation, and fringes As an alternative to continuation, Emacs can display long lines by @dfn{truncation}. This means that all the characters that do not fit in the width of the screen or window do not appear at all. They @@ -536,7 +570,11 @@ Display the number of lines in the current region (@code{count-lines-region}). Display the character code of character after point, character position of point, and column of point (@code{what-cursor-position}). @item M-x hl-line-mode -Enable or disable highlighting of the current line. +Enable or disable highlighting of the current line. @xref{Cursor +Display}. +@item M-x size-indication-mode +Toggle automatic display of the size of the buffer. +@xref{Optional Mode Line}. @end table @findex what-page @@ -551,31 +589,32 @@ area. To go to a given line by number, use @kbd{M-x goto-line}; it prompts you for the number. These line numbers count from one at the beginning of the buffer. - You can also see the current line number in the mode line; @xref{Mode + You can also see the current line number in the mode line; see @ref{Mode Line}. If you narrow the buffer, then the line number in the mode line is relative to the accessible portion (@pxref{Narrowing}). By contrast, @code{what-line} shows both the line number relative to the narrowed region and the line number relative to the whole buffer. - By contrast, @kbd{M-x what-page} counts pages from the beginning of -the file, and counts lines within the page, printing both numbers. + @kbd{M-x what-page} counts pages from the beginning of the file, and +counts lines within the page, showing both numbers in the echo area. @xref{Pages}. @kindex M-= @findex count-lines-region While on this subject, we might as well mention @kbd{M-=} (@code{count-lines-region}), -which prints the number of lines in the region (@pxref{Mark}). +which displays the number of lines in the region (@pxref{Mark}). @xref{Pages}, for the command @kbd{C-x l} which counts the lines in the current page. @kindex C-x = @findex what-cursor-position - The command @kbd{C-x =} (@code{what-cursor-position}) can be used to find out -the column that the cursor is in, and other miscellaneous information about -point. It prints a line in the echo area that looks like this: + The command @kbd{C-x =} (@code{what-cursor-position}) shows what +column the cursor is in, and other miscellaneous information about +point and the character after it. It displays a line in the echo area +that looks like this: @smallexample -Char: c (0143, 99, 0x63) point=21044 of 26883(78%) column 53 +Char: c (0143, 99, 0x63) point=21044 of 26883(78%) column 53 @end smallexample @noindent @@ -584,7 +623,7 @@ Char: c (0143, 99, 0x63) point=21044 of 26883(78%) column 53 The four values after @samp{Char:} describe the character that follows point, first by showing it and then by giving its character code in -octal, decimal and hex. For a non-ASCII multibyte character, these are +octal, decimal and hex. For a non-@acronym{ASCII} multibyte character, these are followed by @samp{ext} and the character's representation, in hex, in the buffer's coding system, if that coding system encodes the character safely and with a single byte (@pxref{Coding Systems}). If the @@ -600,12 +639,12 @@ percentage of the total size. columns from the left edge of the window. If the buffer has been narrowed, making some of the text at the -beginning and the end temporarily inaccessible, @kbd{C-x =} prints +beginning and the end temporarily inaccessible, @kbd{C-x =} displays additional text describing the currently accessible range. For example, it might display this: @smallexample -Char: C (0103, 67, 0x43) point=252 of 889(28%) <231 - 599> column 0 +Char: C (0103, 67, 0x43) point=252 of 889(28%) <231 - 599> column 0 @end smallexample @noindent @@ -618,23 +657,43 @@ part), the @w{@kbd{C-x =}} output does not describe a character after point. The output might look like this: @smallexample -point=26957 of 26956(100%) column 0 +point=26957 of 26956(100%) column 0 @end smallexample - @w{@kbd{C-u C-x =}} displays additional information about a character, -in place of the buffer coordinates and column: the character set name -and the codes that identify the character within that character set; -ASCII characters are identified as belonging to the @code{ASCII} -character set. In addition, the full character encoding, even if it -takes more than a single byte, is shown after @samp{ext}. Here's an -example for a Latin-1 character A with a grave accent in a buffer whose -coding system is iso-2022-7bit@footnote{On terminals that support -Latin-1 characters, the character shown after @samp{Char:} is displayed -as the actual glyph of A with grave accent.}: +@cindex character set of character at point +@cindex font of character at point +@cindex text properties at point + @w{@kbd{C-u C-x =}} displays additional information about a +character, including the character set name and the codes that +identify the character within that character set; @acronym{ASCII} characters are +identified as belonging to the @code{ascii} character set. It also +shows the character's syntax, categories, and encodings both +internally in the buffer and externally if you save the file. It also +shows the character's text properties (@pxref{Text Properties,,, +elisp, the Emacs Lisp Reference Manual}), and any overlays containing it +(@pxref{Overlays,,, elisp, the same manual}). + + Here's an example showing the Latin-1 character A with grave accent, +in a buffer whose coding system is @code{iso-2022-7bit}, whose +terminal coding system is @code{iso-latin-1} (so the terminal actually +displays the character as @samp{@`A}), and which has font-lock-mode +(@pxref{Font Lock}) enabled: -@example -Char: @`A (04300, 2240, 0x8c0, ext ESC , A @@) (latin-iso8859-1 64) -@end example +@smallexample + character: @`A (04300, 2240, 0x8c0) + charset: latin-iso8859-1 + (Right-Hand Part of Latin Alphabet 1@dots{} + code point: 64 + syntax: w which means: word + category: l:Latin + buffer code: 0x81 0xC0 + file code: ESC 2C 41 40 (encoded by coding system iso-2022-7bit) +terminal code: C0 + +Text properties + font-lock-face: font-lock-variable-name-face + fontified: t +@end smallexample @node Arguments @section Numeric Arguments @@ -658,16 +717,19 @@ act in the opposite direction. If your terminal keyboard has a @key{META} key, the easiest way to specify a numeric argument is to type digits and/or a minus sign while holding down the @key{META} key. For example, + @example M-5 C-n @end example + @noindent would move down five lines. The characters @kbd{Meta-1}, @kbd{Meta-2}, and so on, as well as @kbd{Meta--}, do this because they are keys bound to commands (@code{digit-argument} and @code{negative-argument}) that -are defined to contribute to an argument for the next command. Digits -and @kbd{-} modified with Control, or Control and Meta, also specify -numeric arguments. +are defined to contribute to an argument for the next command. +@kbd{Meta--} without digits normally means @minus{}1. Digits and +@kbd{-} modified with Control, or Control and Meta, also specify numeric +arguments. @kindex C-u @findex universal-argument @@ -727,6 +789,13 @@ the command. @section Repeating a Command @cindex repeating a command + Many simple commands, such as those invoked with a single key or +with @kbd{M-x @var{command-name} @key{RET}}, can be repeated by +invoking them with a numeric argument that serves as a repeat count +(@pxref{Arguments}). However, if the command you want to repeat +prompts for some input, or uses a numeric argument in another way, +repetition using a numeric argument might be problematical. + @kindex C-x z @findex repeat The command @kbd{C-x z} (@code{repeat}) provides another way to repeat @@ -744,3 +813,6 @@ additional times, to delete a total of 80 characters, by typing @kbd{C-x z z z}. The first @kbd{C-x z} repeats the command once, and each subsequent @kbd{z} repeats it once again. +@ignore + arch-tag: cda8952a-c439-41c1-aecf-4bc0d6482956 +@end ignore