Copyright (C) 2000-2012 |
GNU Info (emacs-lisp-intro.info)fwd-para summarySummary ------- In summary, when moving forward, the `forward-paragraph' function does the following: * Move point to the beginning of the line. * Skip over lines between paragraphs. * Check whether there is a fill prefix, and if there is: -- Go forward line by line so long as the line is not a paragraph separating line. * But if there is no fill prefix, -- Search for the next paragraph start pattern. -- Go to the beginning of the paragraph start pattern, which will be the end of the previous paragraph. -- Or else go to the end of the accessible portion of the buffer. 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))) OMITTED-BACKWARD-MOVING-CODE ... (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 `C-h f' (`describe-function') and the name of the function. This gives you the function documentation and the name of the library containing the function's source. Place point over the name of the library and press the RET key; you will be taken directly to the source. (Be sure to install your sources! Without them, you are like a person who tries to drive a car with his eyes shut!) Or - a good habit to get into - you can type `M-.' (`find-tag') and the name of the function when prompted for it. This will take you directly to the source. If the `find-tag' function first asks you for the name of a `TAGS' table, give it the name of the `TAGS' file such as `/usr/local/share/emacs/21.0.100/lisp/TAGS'. (The exact path to your `TAGS' file depends on how your copy of Emacs was installed.) You can also create your own `TAGS' file for directories that lack one. Note: Create Your Own `TAGS' File. automatically generated by info2www version 1.2.2.9 |