Node:forward-paragraph in brief, Next:, Previous:forward-paragraph, Up:forward-paragraph



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 (< arg 0)        ; backward-moving-code
      ...
      (setq arg (1+ arg)))
    (while (> arg 0)        ; forward-moving-code
      ...
      (setq arg (1- arg)))))

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.