Go to the previous, next section.

Install a Function Definition

If you are reading this inside of Info in Emacs, you can try out the  multiply-by-seven function by first evaluating the function definition and then evaluating  (multiply-by-seven 3) . A copy of the function definition follows. Place the cursor after the last parenthesis of the function definition and type C-x C-e. When you do this,  multiply-by-seven will appear in the echo area. (What this means is that when a function definition is evaluated, the value it returns is the name of the defined function.) At the same time, this action installs the function definition.

(defun multiply-by-seven (number)
  "Multiply NUMBER by seven."
  (* 7 number))

By evaluating this  defun , you have just installed  multiply-by-seven in Emacs. The function is now just as much a part of Emacs as  forward-word or any other editing function you use. ( multiply-by-seven will stay installed until you quit Emacs. To reload code automatically whenever you start Emacs, see section Install Code Permanently.)

You can see the effect of installing  multiply-by-seven by evaluating the following sample. Place the cursor after the following expression and type C-x C-e. The number 21 will appear in the echo area.

(multiply-by-seven 3)

If you wish, you can read the documentation for the function by typing C-h f ( describe-function ) and then the name of the function,   multiply-by-seven . When you do this, a `*Help*' window will appear on your screen that says:

Multiply NUMBER by seven.

(To return to a single window on your screen, type C-x 1.)

Go to the previous, next section.