File psl-1983/3-1/doc/nmode/nm-killing.ibm artifact 8470ae0bbd part of check-in d9e362f11e


,MOD
- R 44X (11 April 1983) <PSL.NMODE-DOC>NM-KILLING.ibm
PLA 97_LAS 80 0_FIR 2_INT 1 6.0_TYP 160 163 162 193_INP 12 101_MAR 2
,END
,PRO
201 OUT 160_202 OUT 163_203 OUT 162_204 OUT 193
205 INP 12 101_206 INP 12 102
,END
,DEFINE
 UNIT SPACE
 FUNCTION
,END

          201/NMODE Manual (Killing and Moving Text)                           Page 11-1


          202/11.  Killing and Moving Text

            201/The commonest way of moving or copying text with NMODE is to kill it, and
          get it back again in one or more places.  This is very safe because the last
          several pieces of killed text are all remembered, and it is versatile, because
          the many commands for killing syntactic units can also be used for moving
          those units.  There are also other ways of moving text for special purposes.

          202/11.1  Deletion and Killing

            201/Most commands which erase text from the buffer save it so that you can get
          it back if you change your mind, or move or copy it to other parts of the
          buffer.   These commands are known as 202/kill 201/commands.  The rest of the
          commands that erase text do not save it; they are known as 202/delete 201/commands.
          The delete commands include C-D and Backspace, which delete only one
          character at a time, and those commands that delete only spaces or line
          separators.  Commands that can destroy significant amounts of nontrivial data
          generally kill.   The commands' names and individual descriptions use the
          words "kill" and "delete" to say which they do.

                  C-D            Delete next character.
                  Backspace      Delete previous character.
                  M-\            Delete spaces and tabs around point.
                  C-X C-O       Delete blank lines around the current line.
                  M-^            Join two lines by deleting the line separator and any
                                  indentation.
                  C-K            Kill rest of line or one or more lines.
                  C-W            Kill region (from point to the mark).
                  M-D            Kill word.
                  M-Backspace   Kill word backwards.
                  C-X Rubout    Kill back to beginning of sentence.
                  M-K            Kill to end of sentence.
                  C-M-K         Kill Lisp form.
                  C-M-Rubout    Kill Lisp form backwards.


          202/11.1.1  Deletion

            201/The most basic delete commands are C-D and Backspace.  C-D deletes the
          character  after  the  cursor,  the  one  the  cursor  is  "on  top  of"  or
          "underneath".  The cursor doesn't move.  Backspace deletes the character
          before the cursor, and moves the cursor back.  Line separators act like
          single characters when deleted.  Actually, C-D and Backspace aren't always
          delete commands; if you give an argument, they kill instead.  This prevents
          you from losing a great deal of text by typing a large argument to a C-D or
          Backspace.

            The  other  delete  commands  are  those  which  delete  only  formatting
          characters:    spaces,    tabs     and     line     separators.          M-\
          (203/delete-horizontal-space-command201/) deletes all the spaces and tab characters
          before and after point.  C-X C-O (203/delete-blank-lines-command201/) deletes all
          blank lines after the current line, and if the current line is blank deletes all
          blank lines preceding the current line as well (leaving one blank line, the
          201/Page 11-2                                           NMODE Manual (Deletion)


          current line).  M-^ (203/delete-indentation-command201/) joins the current line and
          the previous line, or the current line and the next line if given an argument.
          See Section 13.3 [Indentation], page 3.

          202/11.1.2  Killing by Lines

            201/The simplest kill command is the C-K command (203/kill-line201/).  If given at the
          beginning of a line, it kills all the text on the line, leaving it blank.  If
          given on a blank line, the blank line disappears.  As a consequence, if you
          go to the front of a non-blank line and type two C-K's, the line disappears
          completely.

            More generally, C-K kills from point up to the end of the line, unless it is
          at the end of a line.  In that case it kills the line separator following the
          line, thus merging the next line into the current one.  Invisible spaces and
          tabs at the end of the line are ignored when deciding which case applies, so
          if point appears to be at the end of the line, you can be sure the line
          separator will be killed.

            If C-K is given a positive argument, it kills that many lines, and the
          separators that follow them (however, text on the current line before point is
          spared).   With a negative argument, it kills back to a number of line
          beginnings.  An argument of -2 means kill back to the second line beginning.
          If point is at the beginning of a line, that line beginning doesn't count, so
          C-U - 2 C-K with point at the front of a line kills the two previous lines.

            C-K with an argument of zero kills all the text before point on the current
          line.

          202/11.1.3  Other Kill Commands

            201/A kill command which is very general is C-W (203/kill-region201/), which kills
          everything between point and the mark.  With this command, you can kill any
          contiguous characters, if you first set the mark at one end of them and go to
          the other end.

            Other syntactic units can be killed: words, with M-Backspace and M-D (See
          Section 13.1 [Words], page 1.); forms, with C-M-Rubout and C-M-K (See
          Section 20.5.1 [Forms], page 3.); sentences, with C-X Rubout and M-K (See
          Section 13.2 [Sentences], page 2.).

          202/11.2  Un-Killing

            201/Un-killing is getting back text which was killed.  The usual way to move or
          copy text is to kill it and then un-kill it one or more times.

                  C-Y    Yank (re-insert) last killed text.
                  M-Y    Replace re-inserted killed text with the previously killed text.
                  M-W    Save region as last killed text without killing.
                  C-M-W Append next kill to last batch of killed text.

            Killed text is pushed onto a 202/ring buffer 201/called the 202/kill ring 201/that remembers
          the last 16 blocks of text that were killed.  (Why it is called a ring buffer
          201/NMODE Manual (Un-Killing)                                         Page 11-3


          will be explained below).  The command C-Y (203/insert-kill-buffer201/) reinserts the
          text of the most recent kill.  It leaves the cursor at the end of the text, and
          puts the mark at the beginning.  Thus, a single C-W undoes the C-Y.  C-U
          C-Y leaves the cursor in front of the text, and the mark after.  This is only
          if the argument is specified with just a C-U, precisely.  Any other sort of
          argument, including C-U and digits, has an effect described below.

            If you wish to copy a block of text, you  might  want  to  use  M-W
          (203/copy-region201/), which copies the region into the kill ring without removing it
          from the buffer.  This is approximately equivalent to C-W followed by C-Y,
          except that M-W does not mark the buffer as "changed" and does not
          temporarily change the screen.

            There is only one kill ring, and switching buffers or files has no effect on
          it.  After visiting a new file, whatever was last killed in the previous file is
          still on top of the kill ring.  This is important for moving text between files.

          202/11.2.1  Appending Kills

            201/Normally, each kill command pushes a new block onto the  kill  ring.
          However, two or more kill commands in a row combine their text into a single
          entry on the ring, so that a single C-Y command gets it all back as it was
          before it was killed.  This means that you don't have to kill all the text in
          one command; you can keep killing line after line, or word after word, until
          you have killed it all, and you can still get it all back at once.  (Thus we
          join television in leading people to kill thoughtlessly).

            Commands that kill forward from point add onto the end of the previous
          killed text.  Commands that kill backward from point add onto the beginning.
          This way, any sequence of mixed forward and backward kill commands puts
          all the killed text into one entry without rearrangement.

            If  a  kill  command is separated from the last kill command by other
          commands, it starts a new entry on the kill ring, unless you tell it not to by
          saying C-M-W (203/append-next-kill-command201/) in front of it.  The C-M-W tells
          the following command, if it is a kill command, to append the text it kills to
          the last killed text, instead of starting a new entry.  With C-M-W, you can
          kill several separated pieces of text and accumulate them to be yanked back
          in one place.

          202/11.2.2  Un-killing Earlier Kills

            201/To recover killed text that is no longer the most recent kill, you need the
          Meta-Y (203/unkill-previous201/) command.  The M-Y command should be used only
          after a C-Y command or another M-Y.  It takes the un-killed text inserted by
          the C-Y and replaces it with the text from an earlier kill.  So, to recover the
          text of the next-to-the-last kill, you first use C-Y to recover the last kill,
          and then use M-Y to move back to the previous kill.

            You can think of all the last few kills as living in a ring.  After a C-Y
          command, the text at the front of the ring is also present in the buffer.
          M-Y "rotates" the ring, bringing the previous string of text to the front,
          and this text replaces the other text in the buffer as well.  Enough M-Y
          201/Page 11-4                             NMODE Manual (Un-killing Earlier Kills)


          commands can rotate any part of the ring to the front, so you can get at any
          killed text as long as it is recent enough to be still in the ring.  Eventually
          the ring rotates all the way around and the most recent killed text comes to
          the front (and into the buffer) again.  M-Y with a negative argument rotates
          the ring backwards.  If the region doesn't match the text at the front of the
          ring, M-Y is not allowed.

            In any case, when the text you are looking for is brought into the buffer,
          you can stop doing M-Y's and it will stay there.  It's really just a copy of
          what's at the front of the ring, so editing it does not change what's in the
          ring.  And the ring, once rotated, stays rotated, so that doing another C-Y
          gets another copy of what you rotated to the front with M-Y.

            If you change your mind about un-killing, a C-W gets rid of the un-killed
          text at any point, after any number of M-Y's.  C-W pushes the text onto the
          ring again.

            If you know how many M-Y's it would take to find the text you want, then
          there is an alternative.  C-Y with an argument greater than one restores the
          text the specified number of entries down on the ring.  Thus, C-U 2 C-Y
          gets the next to the last block of killed text.  It differs from C-Y M-Y in
          that C-U 2 C-Y does not permanently rotate the ring.

          202/11.3  Other Ways of Copying Text

            201/Usually we copy or move text by killing it and un-killing it, but there are
          other ways that are useful for copying one block of text in many places, or
          for copying many scattered blocks of text into one place.


          202/11.3.1  Accumulating Text

            201/You can accumulate blocks of text from scattered locations either into a
          buffer or into a file if you like.

            To   append   them   into   a   buffer,   use   the   command   C-X   A
          (203/append-to-buffer-command201/), which inserts a copy of the region into the
          specified buffer at the location of point in that buffer.  This command will
          prompt for the name of a buffer, which should be terminated with Return.  If
          there is no buffer with the name you specify, one is created.  If you append
          text into a buffer which has been used for editing, the copied text goes into
          the middle of the text of the buffer, wherever point happens to be in it.

            Point in that buffer is left at the end of the copied text, so successive
          uses of C-X A accumulate the text in the specified buffer in the same order
          as they were copied.  If C-X A is given an argument, point in the other
          buffer is left before the copied text, so successive uses of C-X A add text in
          reverse order.

            You can retrieve the accumulated text from that buffer with M-X Insert
          Buffer (203/insert-buffer-command201/).  This inserts a copy of the text in that
          buffer into the selected buffer.  It prompts for the buffer name needed.  You
          can also select the other buffer for editing.  See Section 16 [Buffers], page
          201/NMODE Manual (Accumulating Text)                                 Page 11-5


          1, for background information on buffers.

            Strictly speaking, C-X A does not always append to the text already in the
          buffer.  But if it is used on a buffer which starts out empty, it does keep
          appending to the end.

            Instead of accumulating text within NMODE, in a buffer, you can append
          text directly  into  a  disk  file  with  the  command  M-X  Append  to  File
          (203/append-to-file-command201/).  It adds the text of the region to the end of the
          specified file.  M-X Prepend to File (203/prepend-to-file-command201/) adds the text
          to the beginning of the file instead.  Both commands prompt for the file
          name.   The file is changed immediately on disk.   These commands are
          normally used with files that are 203/not 201/being visited in NMODE.  They have the
          advantage of working even on files too large to fit into the NMODE address
          space.

          202/11.3.2  Copying Text Many Times

            201/When you want to insert a copy of the same piece of text frequently, the
          kill ring becomes impractical, since the text moves down on the ring as you
          edit, and will be in an unpredictable place on the ring when you need it
          again.      For   this   case,   you   can   use   the   commands   C-X   X
          (203/put-register-command201/) and C-X G (203/get-register-command201/) to move the text.

            C-X X stores a copy of the text of the region in a place called a register.
          With an argument, C-X X deletes the text as well.  C-X G inserts the text
          from a register into the buffer.  Both these commands prompt for the register
          name, which must be a single letter or digit.  This gives 36 places in which
          you can store a piece of text.  Normally C-X G leaves point before the text
          and places the mark after, but with a numeric argument it puts point after
          the text and the mark before.

REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]