In summary, when moving forward, the forward-paragraph
function
does the following:
For review, here is the code we have just been discussing, formatted for clarity:
(interactive "p") (or arg (setq arg 1)) (let* ( (fill-prefix-regexp (and fill-prefix (not (equal fill-prefix "")) (not paragraph-ignore-fill-prefix) (regexp-quote fill-prefix))) (paragraph-separate (if fill-prefix-regexp (concat paragraph-separate "\\|^" fill-prefix-regexp "[ \t]*$") paragraph-separate))) backward-moving-code (omitted) ... (while (> arg 0) ; forward-moving-code (beginning-of-line) (while (prog1 (and (not (eobp)) (looking-at paragraph-separate)) (forward-line 1))) (if fill-prefix-regexp (while (and (not (eobp)) ; then-part (not (looking-at paragraph-separate)) (looking-at fill-prefix-regexp)) (forward-line 1)) ; else-part: the inner-if (if (re-search-forward paragraph-start nil t) (goto-char (match-beginning 0)) (goto-char (point-max)))) (setq arg (1- arg))))) ; decrementer
The full definition for the forward-paragraph
function not only
includes this code for going forwards, but also code for going backwards.
If you are reading this inside of GNU Emacs and you want to see the
whole function, you can type M-. (find-tag
) and the name
of the function when prompted for it. If the find-tag
function
first asks you for the name of a `TAGS' table, give it the name
of the `TAGS' file in your `emacs/src' directory, which will
have a pathname such as `/usr/local/lib/emacs/19.23/src/TAGS'.
(The exact path to the `emacs/src' directory depends on how your
copy of Emacs was installed. If you don't know the path, you can
sometimes find out by typing C-h i to enter Info and then typing
C-x C-f to see the path to the `emacs/info' directory. The
path to the `TAGS' file is often the corresponding
`emacs/src' path; sometimes, however, Info files are stored
elsewhere.)
You can also create your own `TAGS' file for directories that lack one.
Go to the first, previous, next, last section, table of contents.