Next: , Previous: , Up: Text   [Contents][Index]


20.3 Sentences

The Emacs commands for manipulating sentences and paragraphs are mostly on Meta- keys, and therefore are 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 Meta-a and Meta-e (backward-sentence and forward-sentence) move to the beginning and end of the current sentence, respectively. They resemble Control-a and Control-e, which move to the beginning and end of a line. Unlike their counterparts, Meta-a and Meta-e move over successive sentences if repeated or given numeric arguments. Emacs assumes the typist’s convention is followed, and thus considers a sentence to end 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.

Neither M-a nor M-e moves past the newline or spaces beyond the sentence edge at which it is stopping.

M-a and M-e have a corresponding kill command, just like C-a and C-e have C-k. The command is M-k (kill-sentence) which kills from point to the end of the sentence. With minus one as an argument it kills back to the beginning of the sentence. Larger arguments serve as repeat counts.

There is a special command, C-x DEL (backward-kill-sentence), for killing back to the beginning of a sentence, which is useful when you change your mind in the middle of composing text.

The variable sentence-end controls recognition of the end of a sentence. It is a regexp that matches the last few characters of a sentence, together with the whitespace following the sentence. Its normal value is:

"[.?!][]\"')]*\\($\\|\t\\|  \\)[ \t\n]*"

This example is explained in the section on regexps. See Regexps.


Next: , Previous: , Up: Text   [Contents][Index]