Mercurial > hg > xemacs-beta
comparison man/lispref/functions.texi @ 2492:6780963faf78
[xemacs-hg @ 2005-01-21 09:43:09 by aidan]
Rename "functions" node to "functions and commands," move the definition of
a command further up the list of types of functions, give information on a
trivial (interactive) declaration, and cross-reference to the key binding
detail. Cf. 87vf9wgd08.fsf@tleepslib.sk.tsukuba.ac.jp (comp.emacs.xemacs,
2005-01-18).
author | aidan |
---|---|
date | Fri, 21 Jan 2005 09:43:12 +0000 |
parents | 576fb035e263 |
children | 755ae5b97edb |
comparison
equal
deleted
inserted
replaced
2491:876c400e58d7 | 2492:6780963faf78 |
---|---|
1 @c -*-texinfo-*- | 1 @c -*-texinfo-*- |
2 @c This is part of the XEmacs Lisp Reference Manual. | 2 @c This is part of the XEmacs Lisp Reference Manual. |
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. | 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. |
4 @c See the file lispref.texi for copying conditions. | 4 @c See the file lispref.texi for copying conditions. |
5 @setfilename ../../info/functions.info | 5 @setfilename ../../info/functions.info |
6 @node Functions, Macros, Variables, Top | 6 @node Functions and Commands, Macros, Variables, Top |
7 @chapter Functions | 7 @chapter Functions and Commands |
8 | 8 |
9 A Lisp program is composed mainly of Lisp functions. This chapter | 9 A Lisp program is composed mainly of Lisp functions. This chapter |
10 explains what functions are, how they accept arguments, and how to | 10 explains what functions are, how they accept arguments, and how to |
11 define them. | 11 define them. |
12 | 12 |
43 In XEmacs Lisp, a @dfn{function} is anything that can be applied to | 43 In XEmacs Lisp, a @dfn{function} is anything that can be applied to |
44 arguments in a Lisp program. In some cases, we use it more | 44 arguments in a Lisp program. In some cases, we use it more |
45 specifically to mean a function written in Lisp. Special forms and | 45 specifically to mean a function written in Lisp. Special forms and |
46 macros are not functions. | 46 macros are not functions. |
47 | 47 |
48 @item command | |
49 @cindex command | |
50 | |
51 A @dfn{command} is a possible definition for a key sequence---we count | |
52 mouse events and menu accesses as key sequences for this purpose. More | |
53 formally, within XEmacs lisp, a command is something that | |
54 @code{command-execute} can invoke. | |
55 | |
56 Some functions are commands; a function written in Lisp is a command if | |
57 it contains an interactive declaration. A trivial interactive | |
58 declaration is a line @code{(interactive)} immediately after the | |
59 documentation string. For more complex examples, with prompting and | |
60 completion, see @xref{Defining Commands}. Such a function can be called | |
61 from Lisp expressions like other functions; in this case, the fact that | |
62 the function is a command makes no difference. | |
63 | |
64 Keyboard macros (strings and vectors) are commands also, even though | |
65 they are not functions. A symbol is a command if its function | |
66 definition is a command; such symbols can be invoked with @kbd{M-x}. | |
67 The symbol is a function as well if the definition is a function. | |
68 | |
69 In the case where you want to call a command in reaction to a | |
70 user-generated event, you'll need to bind it to that event. For how to | |
71 do this, see @xref{Key Binding Commands}. | |
72 @xref{Command Overview}. | |
73 | |
74 @item keystroke command | |
75 @cindex keystroke command | |
76 A @dfn{keystroke command} is a command that is bound to a key sequence | |
77 (typically one to three keystrokes). The distinction is made here | |
78 merely to avoid confusion with the meaning of ``command'' in non-Emacs | |
79 editors; for Lisp programs, the distinction is normally unimportant. | |
80 | |
48 @item primitive | 81 @item primitive |
49 @cindex primitive | 82 @cindex primitive |
50 @cindex subr | 83 @cindex subr |
51 @cindex built-in function | 84 @cindex built-in function |
52 A @dfn{primitive} is a function callable from Lisp that is written in C, | 85 A @dfn{primitive} is a function callable from Lisp that is written in C, |
81 differs from a function in that it translates a Lisp expression that you | 114 differs from a function in that it translates a Lisp expression that you |
82 write into an equivalent expression to be evaluated instead of the | 115 write into an equivalent expression to be evaluated instead of the |
83 original expression. Macros enable Lisp programmers to do the sorts of | 116 original expression. Macros enable Lisp programmers to do the sorts of |
84 things that special forms can do. @xref{Macros}, for how to define and | 117 things that special forms can do. @xref{Macros}, for how to define and |
85 use macros. | 118 use macros. |
86 | |
87 @item command | |
88 @cindex command | |
89 A @dfn{command} is an object that @code{command-execute} can invoke; it | |
90 is a possible definition for a key sequence. Some functions are | |
91 commands; a function written in Lisp is a command if it contains an | |
92 interactive declaration (@pxref{Defining Commands}). Such a function | |
93 can be called from Lisp expressions like other functions; in this case, | |
94 the fact that the function is a command makes no difference. | |
95 | |
96 Keyboard macros (strings and vectors) are commands also, even though | |
97 they are not functions. A symbol is a command if its function | |
98 definition is a command; such symbols can be invoked with @kbd{M-x}. | |
99 The symbol is a function as well if the definition is a function. | |
100 @xref{Command Overview}. | |
101 | |
102 @item keystroke command | |
103 @cindex keystroke command | |
104 A @dfn{keystroke command} is a command that is bound to a key sequence | |
105 (typically one to three keystrokes). The distinction is made here | |
106 merely to avoid confusion with the meaning of ``command'' in non-Emacs | |
107 editors; for Lisp programs, the distinction is normally unimportant. | |
108 | 119 |
109 @item compiled function | 120 @item compiled function |
110 A @dfn{compiled function} is a function that has been compiled by the | 121 A @dfn{compiled function} is a function that has been compiled by the |
111 byte compiler. @xref{Compiled-Function Type}. | 122 byte compiler. @xref{Compiled-Function Type}. |
112 @end table | 123 @end table |