help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help


From: Sebastian Tennant
Subject: Re: help
Date: Thu, 13 Dec 2007 21:16:10 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Quoth HANS jackman <address@hidden>:
> i just want to know how to create interfaces with Emacs and how to
> create functions and calling them.

Type:

 C-h f <function-name> RET

  or,

 M-x describe-function RET <function-name> RET

for a short description about a function.

C-h f defun RET 

 "defun is a special form in `C source code'.
  (defun NAME ARGLIST [DOCSTRING] BODY...)

  Define NAME as a function.
  The definition is (lambda ARGLIST [DOCSTRING] BODY...).
  See also the function `interactive'."

Here's an example function definiton:

 (defun foo (bar baz) "Join strings" (let ((fum (concat bar " " baz)))
                                        (message "%s" fum)))
         ^      ^            ^       |________________________________|
         |      |            |                      |
         |      |            |                      |
       NAME  ARGLIST     DOCSTRING                 BODY

Copy this function definition to the *scratch* buffer, place point (the
cursor) below it and type:

 C-j

to 'evalute' the function.  The word 'foo' should appear.

Now type:

 (foo "hello" "world")
 C-j

and the string "hello world" should appear.

Congratulations!

You have just written, evaluated and called your first function.

Hope this helps,

Sebastian

P.S. C-h  is the key sequence Ctrl-h ('Ctrl' key + 'h' key, together)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]