25.2 Sentences
The Emacs commands for manipulating sentences and paragraphs are mostly on Meta keys, like the word-handling commands.
M-a
β
Move back to the beginning of the sentence (backward-sentence
).
M-e
β
Move forward to the end of the sentence (forward-sentence
).
M-k
β
Kill forward to the end of the sentence (kill-sentence
).
C-x DEL
β
Kill back to the beginning of the sentence (backward-kill-sentence
).
The commands M-a
(backward-sentence
) and M-e
(forward-sentence
) move to the beginning and end of the current sentence, respectively. Their bindings were chosen to resemble C-a
and C-e
, which move to the beginning and end of a line. Unlike them, M-a
and M-e
move over successive sentences if repeated.
Moving backward over a sentence places point just before the first character of the sentence; moving forward places point right after the punctuation that ends the sentence. Neither one moves over the whitespace at the sentence boundary.
Just as C-a
and C-e
have a kill command, C-k
, to go with them, M-a
and M-e
have a corresponding kill command: M-k
(kill-sentence
) kills from point to the end of the sentence. With a positive numeric argument n
, it kills the next n
sentences; with a negative argument -n
, it kills back to the beginning of the n
th preceding sentence.
The C-x DEL
(backward-kill-sentence
) kills back to the beginning of a sentence.
The sentence commands assume that you follow the American typistβs convention of putting two spaces at the end of a sentence. That is, a sentence ends wherever there is a β.
β, β?
β or β!
β followed by the end of a line or two spaces, with any number of β)
β, β]
β, β'
β, or β"
β characters allowed in between. A sentence also begins or ends wherever a paragraph begins or ends. It is useful to follow this convention, because it allows the Emacs sentence commands to distinguish between periods that end a sentence and periods that indicate abbreviations.
If you want to use just one space between sentences, you can set the variable sentence-end-double-space
to nil
to make the sentence commands stop for single spaces. However, this has a drawback: there is no way to distinguish between periods that end sentences and those that indicate abbreviations. For convenient and reliable editing, we therefore recommend you follow the two-space convention. The variable sentence-end-double-space
also affects filling (see Fill Commands).
The variable sentence-end
controls how to recognize the end of a sentence. If non-nil
, its value should be a regular expression, which is used to match the last few characters of a sentence, together with the whitespace following the sentence (see Regexps). If the value is nil
, the default, then Emacs computes sentence ends according to various criteria such as the value of sentence-end-double-space
.
Some languages, such as Thai, do not use periods to indicate the end of a sentence. Set the variable sentence-end-without-period
to t
in such cases.