Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Moving Around
         Simple Movement Commands
         Moving in Larger Units
         Searching
         . . .
         Comparing
      Changing Text
         Inserting and Deleting
         Killing Text
         Clipboard Access
         Rectangle Commands
         . . .
      Language Modes
         Asm Mode
         Batch Mode
         C Mode
         . . .
         Visual Basic Mode
      . . .

Previous   Up    Next
Inserting and Deleting  Commands by Topic   Clipboard Access


Epsilon User's Manual and Reference > Commands by Topic > Changing Text >

Killing Text

Epsilon has many commands to erase characters from a buffer. Some of these commands save the erased characters away in a special group of buffers called kill buffers, and some do not.

In Epsilon's terminology, to kill means to delete text and save it away in a kill buffer, and to delete means simply to remove the text and not save it away. Any consecutive sequence of killing commands will produce a single block of saved text. The Ctrl-Y command then yanks back the entire block of text, inserting it before point. (Even when Epsilon deletes text and doesn't save it, you can usually use the undo command to recover the text. See Undoing.)

The Ctrl-K command kills to the end of the line, but does not remove the line separator. At the end of a line, though, it kills just the line separator. Thus, use two Ctrl-K's to completely remove a nonempty line. Give this command a numeric argument of n to kill exactly n lines, including the line separators. If you give the Ctrl-K command a negative numeric argument, -n, the command kills from the beginning of the previous nth line to point.

The kill-current-line command is an alternative to Ctrl-K. It kills the entire line in one step, including the line separator. The kill-to-end-of-line command kills the rest of the line. If point is at the end of the line, it does nothing. In Brief mode Epsilon uses these two commands in place of the kill-line command that's normally bound to Ctrl-K.

The commands to delete single characters will also save the characters if you give them a numeric argument (to delete that number of characters) or if they follow a command which itself kills text.

Several Epsilon commands operate on a region of text. To specify a region, move to either end of the region and press the Ctrl-@ key or the Ctrl-<Space> key. This sets the mark to the current value of point. Then move point to the other end of the region. The text between the mark and point specifies the region.

When you set the mark with Ctrl-@, Epsilon turns on highlighting for the region. As you move point away from the mark, the region appears in a highlighted color. This allows you to see exactly what text a region-sensitive command would operate upon. To turn the highlighting off, type Ctrl-X Ctrl-H. The Ctrl-X Ctrl-H command toggles highlighting for the region. If you prefix a nonzero numeric argument, it turns highlighting on; a numeric argument of zero turns highlighting off.

You can also check the ends of the region with the Ctrl-X Ctrl-X command. This switches point and mark, to let you see the other end of the region. Most commands do not care whether point (or mark) refers to the beginning or the end of the region.

The mark-whole-buffer command on Ctrl-X H provides a quick way to set point and mark around the entire buffer.

Another way to select text is to hold down the Shift key and move around using the arrow keys, or the keys <Home>, <End>, <PageUp>, or <PageDown>. Epsilon will select the text you move through. The shift-selects variable controls this feature.

The Ctrl-W command kills the region, saving it in a kill buffer. The Ctrl-Y command then yanks back the text you've just killed, whether by the Ctrl-W command or any other command that kills text. It sets the region around the yanked text, so you can kill it again with a Ctrl-W, perhaps after adjusting the region at either end. The Alt-W command works like Ctrl-W, except that it does not remove any text from the buffer; it simply copies the text between point and mark to a kill buffer.

Each time you issue a sequence of killing commands, Epsilon saves the entire block of deleted text as a unit in one of its kill buffers. The Ctrl-Y command yanks back the last of these blocks. To access the other blocks of killed text, use the Alt-Y command. It follows a Ctrl-Y or Alt-Y command, and replaces the retrieved text with an earlier block of killed text. Each time you press Alt-Y, Epsilon substitutes a block from another kill buffer, cycling from most recent back through the oldest, and then around to the most recent again.

In normal use, you go to the place you want to insert the text and issue the Ctrl-Y command. If this doesn't provide the right text, give the Alt-Y command repeatedly until you see the text you want. If the text you want does not appear in any of the killed blocks, you can get rid of the block with Ctrl-W, since both Ctrl-Y and Alt-Y always place point and mark around the retrieved block.

By default, Epsilon provides ten kill buffers. You can set the variable kill-buffers if you want a different number of kill buffers. Setting this variable to a new value makes Epsilon throw away the contents of all the kill buffers the next time you execute a command that uses kill buffers.

The Alt-Y command doesn't do anything if the region changed since the last Ctrl-Y or Alt-Y, so you can't lose text with a misplaced Alt-Y. Neither of these commands changes the kill buffers themselves. The Alt-Y command uses the undo facility, so if you've disabled undo, it won't work.

Epsilon can automatically reindent yanked text. By default it does this in C mode buffers. See Indenting Commands for details. If you invoke Ctrl-Y or Alt-Y with a negative numeric prefix argument, by typing Alt-<Minus> Ctrl-Y for example, the command won't reindent the yanked text, and will insert one copy. (Providing a positive numeric prefix argument makes Epsilon yank that many copies of the text. See Repeating a Single Command.)

Each time you issue a sequence of killing commands, all the killed text goes into one kill buffer. When a killing command follows a non-killing command, the text goes into a new kill buffer (assuming you haven't set up Epsilon to have only one kill buffer). You may sometimes want to append a new kill to the current kill buffer, rather than using the next kill buffer. That would let you yank all the text back at once. The Ctrl-Alt-W command makes an immediately following kill command append to a kill buffer instead of moving to a new one.

The Ctrl-Y command can come in handy when entering text for another command. For example, suppose the current buffer contains a line with "report.txt" on it, and you now want to read in the file with that name. Simply kill the line with Ctrl-K and yank it back (so as not to change the buffer) then give the Ctrl-X Ctrl-F command (see Reading Files) to read in a file. When prompted for the file name, press Ctrl-Y and the text "report.txt" appears as if you typed it yourself.

Pressing a self-inserting key like "j" while text is highlighted normally deletes the highlighted selection, replacing it with the key. Pressing <Backspace> simply deletes the text. You can disable this behavior by setting the variable typing-deletes-highlight to zero. If you turn off this feature, you may also wish to set the variable insert-default-response to zero. At many prompts Epsilon will insert a highlighted default response before you start typing, if this variable is nonzero. You may also wish to set typing-hides-highlight if you've disabled typing-deletes-highlight, so pressing a self-inserting key turns off highlighting but doesn't delete anything.

You can use the delete-region command to delete the current region without saving it in a kill buffer; this is especially useful if you've set <Backspace> so it doesn't delete highlighted text.

In addition to the above commands which put the text into temporary kill buffers, Epsilon provides commands to make more permanent copies of text. The Ctrl-X X key copies the text in the region between point and mark to a permanent buffer. The command prompts you for a letter (or number), then associates the text with that letter. Thereafter, you can retrieve the text using the Ctrl-X Y key. That command asks you for the letter, then inserts the corresponding text before point.

Standard bindings:

  Ctrl-@, Alt-@  set-mark
 Ctrl-X Ctrl-H  highlight-region
 Ctrl-X Ctrl-X  exchange-point-and-mark
 Ctrl-K  kill-line
 Ctrl-W  kill-region
 Alt-W  copy-region
 Ctrl-Y  yank
 Alt-Y  yank-pop
 Ctrl-Alt-W  append-next-kill
 Ctrl-X X  copy-to-scratch
 Ctrl-X Y  insert-scratch
 Ctrl-X H  mark-whole-buffer
   kill-current-line
   kill-to-end-of-line
   delete-region
 



Previous   Up    Next
Inserting and Deleting  Commands by Topic   Clipboard Access


Lugaru Copyright (C) 1984, 2012 Lugaru Software Ltd. All Rights Reserved.