There is a wide variety of basic text-modification commands, but once again the simplest ones are the most often used. [annotate]
In Hemlock, you can insert characters with graphic representations by typing the corresponding key-event which you normally generate with the obvious keyboard key. You can only insert characters whose codes correspond to ASCII codes. To insert those without graphic representations, use Quoted Insert. [annotate]
Self Insert inserts into the buffer the character corresponding to the key-event typed to invoke the command. This command is normally bound to all such key-events Space. If a prefix argument is supplied, then this inserts the character that many times. [annotate] |
This command, which has roughly the same effect as inserting a Newline, is used to move onto a new blank line. If there are at least two blank lines beneath the current one then Return cleans off any whitespace on the next line and uses it, instead of inserting a newline. This behavior is desirable when inserting in the middle of text, because the bottom half of the screen does not scroll down each time New Line is used. [annotate] |
Many key-events have corresponding ASCII characters, but these key-events are bound to commands other than Self Insert. Sometimes they are otherwise encumbered such as with C-g. Quoted Insert prompts for a key-event, without any command interpretation semantics, and inserts the corresponding character. If the appropriate character has some code other than an ASCII code, this will beep and abort the command. A common use for this command is inserting a Formfeed by typing C-q C-l. If a prefix argument is supplied, then the character is inserted that many times. [annotate] |
This command inserts a newline into the buffer without moving the point. This command may also be given a prefix argument to insert a number of newlines, thus opening up some room to work in the middle of a screen of text. See also Delete Blank Lines. [annotate] |
There are a number of commands for deleting characters as well. [annotate]
If more than this many characters are deleted by a character deletion command, then the deleted text is placed in the kill ring. [annotate] |
| Delete Next Character | (bound to C-d) | [Command] |
| Delete Previous Character | (bound to Delete, Backspace) | [Command] |
Delete Next Character deletes the character immediately following the point, that is, the character which appears under the cursor. When given a prefix argument, C-d deletes that many characters after the point. Delete Previous Character is identical, except that it deletes characters before the point. [annotate] |
Delete Previous Character Expanding Tabs is identical to Delete Previous Character, except that it treats tabs as the equivalent number of spaces. Various language modes that use tabs for indentation bind Delete to this command. [annotate] |
Hemlock has many commands which kill text. Killing is a variety of deletion which saves the deleted text for later retrieval. The killed text is saved in a ring buffer known as the kill ring. Killing has two main advantages over deletion: [annotate]
Killing is not the same as deleting. When a command is said to delete text, the text is permanently gone and is not pushed on the kill ring. Commands which delete text generally only delete things of little importance, such as single characters or whitespace. [annotate]
This command "yanks" back the most recently killed piece of text, leaving the mark before the inserted text and the point after. If a prefix argument is supplied, then the text that distance back in the kill ring is yanked. [annotate] |
This command rotates the kill ring forward, replacing the most recently yanked text with the next most recent text in the kill ring. M-y may only be used immediately after a use of C-y or a previous use of M-y. This command is used to step back through the text in the kill ring if the desired text was not the most recently killed, and thus could not be retrieved directly with a C-y. If a prefix argument is supplied, then the kill ring is rotated that many times. [annotate] |
This command kills the text between the point and mark, pushing it onto the kill ring. This command is usually the best way to move or remove large quantities of text. [annotate] |
This command pushes the text in the region on the kill ring, but doesn't actually kill it, giving an effect similar to typing C-w C-y. This command is useful for duplicating large pieces of text. [annotate] |
Most commands which kill text append into the kill ring, meaning that consecutive uses of killing commands will insert all text killed into the top entry in the kill ring. This allows large pieces of text to be killed by repeatedly using a killing command. [annotate]
Kill Line kills the text from the point to the end of the current line, deleting the line if it is empty. If a prefix argument is supplied, then that many lines are killed. Note that a prefix argument is not the same as a repeat count. [annotate] Backward Kill Line is similar, except that it kills from the point to the beginning of the line. If it is called at the beginning of the line, it kills the newline and any trailing whitespace on the previous line. With a prefix argument, this command is the same as Kill Line with a negated argument. [annotate] |
| Kill Next Word | (bound to M-d) | [Command] |
| Kill Previous Word | (bound to M-Backspace, M-Delete) | [Command] |
Kill Next Word kills from the point to the end of the current or next word. If a prefix argument is supplied, then that many words are killed. Kill Previous Word is identical, except that it kills backward. [annotate] |
Hemlock provides a few case modification commands, which are often useful for correcting typos. [annotate]
| Capitalize Word | (bound to M-c) | [Command] |
| Lowercase Word | (bound to M-l) | [Command] |
| Uppercase Word | (bound to M-u) | [Command] |
These commands modify the case of the characters from the point to the end of the current or next word, leaving the point after the end of the word affected. A positive prefix argument modifies that many words, moving forward. A negative prefix argument modifies that many words before the point, but leaves the point unmoved. [annotate] |
These commands case-fold the text in the region. Since these commands can damage large amounts of text, they ask for confirmation before modifying large regions and can be undone with Undo. [annotate] |
Hemlock provides a number of transposition commands. A transposition command swaps the "things" before and after the point and moves forward one "thing". Just how a "thing" is defined depends on the particular transposition command. Transposition commands, particularly Transpose Characters and Transpose Words, are useful for correcting typos. More obscure transposition commands can be used to amaze your friends and demonstrate your immense knowledge of exotic Emacs commands. [annotate]
To the uninitiated, the behavior of transposition commands may seem mysterious; this has led some implementors to attempt to improve the definition of transposition, but right-thinking people will accept no substitutes. The Emacs transposition definition used in Hemlock has two useful properties: [annotate]
This command exchanges the characters on either side of the point and moves forward, unless at the end of a line, in which case it transposes the previous two characters without moving. [annotate] |
This command transposes the previous and current line, moving down to the next line. With a zero argument, it transposes the current line and the line the mark is on. [annotate] |
This command transposes the previous word and the current or next word. [annotate] |
This command transposes two regions with endpoints defined by the mark stack and point. To use this command, place three marks (in order) at the start and end of the first region, and at the start of the second region, then place the point at the end of the second region. Unlike the other transposition commands, a second use will simply undo the effect of the first use, and to do even this, you must reactivate the current region. [annotate] |
These commands change the amount of space between words. See also the indentation commands in section 7.2. [annotate]
This command deletes all whitespace characters before and after the point and then inserts one space. If a prefix argument is supplied, then that number of spaces is inserted. [annotate] |
This command deletes all blank characters around the point. [annotate] |
This command deletes all blank lines surrounding the current line, leaving the point on a single blank line. If the point is already on a single blank line, then that line is deleted. If the point is on a non-blank line, then all blank lines immediately following that line are deleted. This command is often used to clean up after Open Line. [annotate] |