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


20.5 Pages

Files are often thought of as divided into pages by the formfeed character (ASCII Control-L, octal code 014). For example, if a file is printed on a line printer, each “page” of the file starts on a new page of paper. Emacs treats a page-separator character just like any other character. It can be inserted with C-q C-l or deleted with DEL. You are free to paginate your file or not. However, since pages are often meaningful divisions of the file, commands are provided to move over them and operate on them.

C-x [

Move point to previous page boundary (backward-page).

C-x ]

Move point to next page boundary (forward-page).

C-x C-p

Put point and mark around this page (or another page) (mark-page).

C-x l

Count the lines in this page (count-lines-page).

The C-x [ (backward-page) command moves point to immediately after the previous page delimiter. If point is already right after a page delimiter, the command skips that one and stops at the previous one. A numeric argument serves as a repeat count. The C-x ] (forward-page) command moves forward past the next page delimiter.

The C-x C-p command (mark-page) puts point at the beginning of the current page and the mark at the end. The page delimiter at the end is included (the mark follows it). The page delimiter at the front is excluded (point follows it). You can follow this command by C-w to kill a page you want to move elsewhere. If you insert the page after a page delimiter, at a place where C-x ] or C-x [ would take you, the page will be properly delimited before and after once again.

A numeric argument to C-x C-p is used to specify which page to go to, relative to the current one. Zero means the current page. One means the next page, and -1 means the previous one.

The C-x l command (count-lines-page) can help you decide where to break a page in two. It prints the total number of lines in the current page in the echo area, then divides the lines into those preceding the current line and those following it, for example

Page has 96 (72+25) lines

Notice that the sum is off by one; this is correct if point is not at the beginning of a line.

The variable page-delimiter should have as its value a regexp that matches the beginning of a line that separates pages. This defines where pages begin. The normal value of this variable is "^\f", which matches a formfeed character at the beginning of a line.


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