Shortened forward-paragraph function definition

Rather than print all of the forward-paragraph function, we will only print parts of it. Read without preparation, the function can be daunting!

In outline, the function looks like this:

(defun forward-paragraph (&optional arg)
  "documentation…"
  (interactive "p")
  (or arg (setq arg 1))
  (let*
      varlist
    (while (and (< arg 0) (not (bobp)))     ; backward-moving-code
      …
    (while (and (> arg 0) (not (eobp)))     ; forward-moving-code

The first parts of the function are routine: the function’s argument list consists of one optional argument. Documentation follows.

The lower case ‘p’ in the interactive declaration means that the processed prefix argument, if any, is passed to the function. This will be a number, and is the repeat count of how many paragraphs point will move. The or expression in the next line handles the common case when no argument is passed to the function, which occurs if the function is called from other code rather than interactively. This case was described earlier. (See The forward-sentence function.) Now we reach the end of the familiar part of this function.