annotate etc/news.texi @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents ac2d302a0011
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 \input texinfo @c -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @setfilename LNEWS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file describes the new Lisp features of Emacs version 19 as first
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 released to the public. For Lisp changes in subsequent Emacs 19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 releases, see the file NEWS.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 @section New Features in the Lisp Language
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 The new function @code{delete} is a traditional Lisp function. It takes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 two arguments, @var{elt} and @var{list}, and deletes from @var{list} any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 elements that are equal to @var{elt}. It uses the function @code{equal}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 to compare elements with @var{elt}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 The new function @code{member} is a traditional Lisp function. It takes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 two arguments, @var{elt} and @var{list}, and finds the first element of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 @var{list} that is equal to @var{elt}. It uses the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 @code{equal} to compare each list element with @var{elt}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 The value is a sublist of @var{list}, whose first element is the one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 that was found. If no matching element is found, the value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 @ignore @c Seems not to be true, from looking at the code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 The function @code{equal} is now more robust: it does not crash due to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 circular list structure.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 The new function @code{indirect-function} finds the effective function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 definition of an object called as a function. If the object is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 symbol, @code{indirect-function} looks in the function definition of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 symbol. It keeps doing this until it finds something that is not a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 There are new escape sequences for use in character and string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 constants. The escape sequence @samp{\a} is equivalent to @samp{\C-g},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 the @sc{ASCII} @sc{BEL} character (code 7). The escape sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 @samp{\x} followed by a hexadecimal number represents the character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 whose @sc{ASCII} code is that number. There is no limit on the number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 of digits in the hexadecimal value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 The function @code{read} when reading from a buffer now does not skip a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 terminator character that terminates a symbol. It leaves that character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 to be read (or just skipped, if it is whitespace) next time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 When you use a function @var{function} as the input stream for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 @code{read}, it is usually called with no arguments, and should return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 the next character. In Emacs 19, sometimes @var{function} is called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 with one argument (always a character). When that happens,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 @var{function} should save the argument and arrange to return it when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 called next time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 @code{random} with integer argument @var{n} returns a random number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 between 0 and @var{n}@minus{}1.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 The functions @code{documentation} and @code{documentation-property} now
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 take an additional optional argument which, if non-@code{nil}, says to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 refrain from calling @code{substitute-command-keys}. This way, you get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 the exact text of the documentation string as written, without the usual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 substitutions. Make sure to call @code{substitute-command-keys}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 yourself if you decide to display the string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 The new function @code{invocation-name} returns as a string the program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 name that was used to run Emacs, with any directory names discarded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 The new function @code{map-y-or-n-p} makes it convenient to ask a series
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 of similar questions. The arguments are @var{prompter}, @var{actor},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 @var{list}, and optional @var{help}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 The value of @var{list} is a list of objects, or a function of no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 arguments to return either the next object or @code{nil} meaning there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 are no more.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 The argument @var{prompter} specifies how to ask each question. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 @var{prompter} is a string, the question text is computed like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (format @var{prompter} @var{object})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 where @var{object} is the next object to ask about.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 If not a string, @var{prompter} should be a function of one argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (the next object to ask about) and should return the question text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 The argument @var{actor} should be a function of one argument, which is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 called with each object that the user says yes for. Its argument is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 always one object from @var{list}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 If @var{help} is given, it is a list @code{(@var{object} @var{objects}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 @var{action})}, where @var{object} is a string containing a singular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 noun that describes the objects conceptually being acted on;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 @var{objects} is the corresponding plural noun and @var{action} is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 transitive verb describing @var{actor}. The default is @code{("object"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "objects" "act on")}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 Each time a question is asked, the user may enter @kbd{y}, @kbd{Y}, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 @key{SPC} to act on that object; @kbd{n}, @kbd{N}, or @key{DEL} to skip
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 that object; @kbd{!} to act on all following objects; @key{ESC} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 @kbd{q} to exit (skip all following objects); @kbd{.} (period) to act on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 the current object and then exit; or @kbd{C-h} to get help.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 @code{map-y-or-n-p} returns the number of objects acted on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 You can now ``set'' environment variables with the @code{setenv}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 command. This works by setting the variable @code{process-environment},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 which @code{getenv} now examines in preference to the environment Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 received from its parent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 @section New Features for Loading Libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 You can now arrange to run a hook if a particular Lisp library is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 The variable @code{after-load-alist} is an alist of expressions to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 evalled when particular files are loaded. Each element looks like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 @code{(@var{filename} @var{forms}@dots{})}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 When @code{load} is run and the file name argument equals
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 @var{filename}, the @var{forms} in the corresponding element are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 executed at the end of loading. @var{filename} must match exactly!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 Normally @var{filename} is the name of a library, with no directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 specified, since that is how @code{load} is normally called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 An error in @var{forms} does not undo the load, but does prevent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 execution of the rest of the @var{forms}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 The function @code{eval-after-load} provides a convenient way to add
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 entries to the alist. Call it with two arguments, @var{file} and a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 form to execute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 The function @code{autoload} now supports autoloading a keymap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 Use @code{keymap} as the fourth argument if the autoloaded function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 will become a keymap when loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 There is a new feature for specifying which functions in a library should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 be autoloaded by writing special ``magic'' comments in that library itself.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 Write @samp{;;;###autoload} on a line by itself before the real
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 definition of the function, in its autoloadable source file; then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 command @kbd{M-x update-file-autoloads} automatically puts the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 @code{autoload} call into @file{loaddefs.el}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 You can also put other kinds of forms into @file{loaddefs.el}, by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 writing @samp{;;;###autoload} followed on the same line by the form.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 @kbd{M-x update-file-autoloads} copies the form from that line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 @section Compilation Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 Inline functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 You can define an @dfn{inline function} with @code{defsubst}. Use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 @code{defsubst} just like @code{defun}, and it defines a function which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 you can call in all the usual ways. Whenever the function thus defined
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 is used in compiled code, the compiler will open code it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 You can get somewhat the same effects with a macro, but a macro has the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 limitation that you can use it only explicitly; a macro cannot be called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 with @code{apply}, @code{mapcar} and so on. Also, it takes some work to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 convert an ordinary function into a macro. To convert it into an inline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 function, simply replace @code{defun} with @code{defsubst}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 Making a function inline makes explicit calls run faster. But it also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 has disadvantages. For one thing, it reduces flexibility; if you change
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 the definition of the function, calls already inlined still use the old
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 definition until you recompile them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 Another disadvantage is that making a large function inline can increase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 the size of compiled code both in files and in memory. Since the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 advantages of inline functions are greatest for small functions, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 generally should not make large functions inline.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 Inline functions can be used and open coded later on in the same file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 following the definition, just like macros.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 The command @code{byte-compile-file} now offers to save any buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 visiting the file you are compiling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 The new command @code{compile-defun} reads, compiles and executes the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 defun containing point. If you use this on a defun that is actually a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 function definition, the effect is to install a compiled version of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 that function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 Whenever you load a Lisp file or library, you now receive a warning if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 the directory contains both a @samp{.el} file and a @samp{.elc} file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 and the @samp{.el} file is newer. This typically indicates that someone
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 has updated the Lisp code but forgotten to recompile it, so the changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 do not take effect. The warning is a reminder to recompile.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 The special form @code{eval-when-compile} marks the forms it contains to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 be evaluated at compile time @emph{only}. At top-level, this is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 analogous to the Common Lisp idiom @code{(eval-when (compile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 @dots{})}. Elsewhere, it is similar to the Common Lisp @samp{#.} reader
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 macro (but not when interpreting).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 If you're thinking of using this feature, we recommend you consider whether
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 @code{provide} and @code{require} might do the job as well.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 The special form @code{eval-and-compile} is similar to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 @code{eval-when-compile}, but the whole form is evaluated both at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 compile time and at run time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 If you're thinking of using this feature, we recommend you consider
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 whether @code{provide} and @code{require} might do the job as well.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 Emacs Lisp has a new data type for byte-code functions. This makes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 them faster to call, and also saves space. Internally, a byte-code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 function object is much like a vector; however, the evaluator handles
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 this data type specially when it appears as a function to be called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 The printed representation for a byte-code function object is like that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 for a vector, except that it starts with @samp{#} before the opening
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 @samp{[}. A byte-code function object must have at least four elements;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 there is no maximum number, but only the first six elements are actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 used. They are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 @table @var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 @item arglist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 The list of argument symbols.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 @item byte-code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 The string containing the byte-code instructions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 @item constants
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 The vector of constants referenced by the byte code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 @item stacksize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 The maximum stack size this function needs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 @item docstring
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 The documentation string (if any); otherwise, @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 @item interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 The interactive spec (if any). This can be a string or a Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 expression. It is @code{nil} for a function that isn't interactive.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 The predicate @code{byte-code-function-p} tests whether a given object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 is a byte-code function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 You can create a byte-code function object in a Lisp program
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 with the function @code{make-byte-code}. Its arguments are the elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 to put in the byte-code function object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 You should not try to come up with the elements for a byte-code function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 yourself, because if they are inconsistent, Emacs may crash when you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 call the function. Always leave it to the byte compiler to create these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 objects; it, we hope, always makes the elements consistent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 @section Floating Point Numbers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 You can now use floating point numbers in Emacs, if you define the macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 @code{LISP_FLOAT_TYPE} when you compile Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 The printed representation for floating point numbers requires either a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 decimal point surrounded by digits, or an exponent, or both. For
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 example, @samp{1500.0}, @samp{15e2}, @samp{15.0e2} and @samp{1.5e3} are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 four ways of writing a floating point number whose value is 1500.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 The existing predicate @code{numberp} now returns @code{t} if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 argument is any kind of number---either integer or floating. The new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 predicates @code{integerp} and @code{floatp} check for specific types of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 You can do arithmetic on floating point numbers with the ordinary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 arithmetic functions, @code{+}, @code{-}, @code{*} and @code{/}. If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 call one of these functions with both integers and floating point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 numbers among the arguments, the arithmetic is done in floating point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 The same applies to the numeric comparison functions such as @code{=}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 and @code{<}. The remainder function @code{%} does not accept floating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 point arguments, and neither do the bitwise boolean operations such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 @code{logand} or the shift functions such as @code{ash}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 There is a new arithmetic function, @code{abs}, which returns the absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 value of its argument. It handles both integers and floating point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 To convert an integer to floating point, use the function @code{float}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 There are four functions to convert floating point numbers to integers;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 they differ in how they round. @code{truncate} rounds toward 0,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 @code{floor} rounds down, @code{ceil} rounds up, and @code{round}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 produces the nearest integer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 You can use @code{logb} to extract the binary exponent of a floating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 point number. More precisely, it is the logarithm base 2, rounded down
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 to an integer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 Emacs has several new mathematical functions that accept any kind of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 number as argument, but always return floating point numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 @item cos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 @findex cos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 @itemx sin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 @findex sin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 @itemx tan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 @findex tan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 Trigonometric functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 @item acos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 @findex acos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 @itemx asin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 @findex asin
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 @itemx atan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 @findex atan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 Inverse trigonometric functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 @item exp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 @findex exp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 The exponential function (power of @var{e}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 @item log
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 @findex log
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 Logarithm base @var{e}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 @item log10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 @findex log10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 Logarithm base 10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 @item expt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 @findex expt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 Raise @var{x} to power @var{y}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 @item sqrt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 @findex sqrt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 The square root function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 The new function @code{string-to-number} now parses a string containing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 either an integer or a floating point number, returning the number.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 The @code{format} function now handles the specifications @samp{%e},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 @samp{%f} and @samp{%g} for printing floating point numbers; likewise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 @code{message}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 The new variable @code{float-output-format} controls how Lisp prints
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 floating point numbers. Its value should be @code{nil} or a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 If it is a string, it should contain a @samp{%}-spec like those accepted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 by @code{printf} in C, but with some restrictions. It must start with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 the two characters @samp{%.}. After that comes an integer which is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 precision specification, and then a letter which controls the format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 The letters allowed are @samp{e}, @samp{f} and @samp{g}. Use @samp{e}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 for exponential notation (@samp{@var{dig}.@var{digits}e@var{expt}}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 Use @samp{f} for decimal point notation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (@samp{@var{digits}.@var{digits}}). Use @samp{g} to choose the shorter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 of those two formats for the number at hand.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 The precision in any of these cases is the number of digits following
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 the decimal point. With @samp{e}, a precision of 0 means to omit the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 decimal point. 0 is not allowed with @samp{f} or @samp{g}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 A value of @code{nil} means to use the format @samp{%.20g}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 No matter what the value of @code{float-output-format}, printing ensures
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 that the result fits the syntax rules for a floating point number. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 it doesn't fit (for example, if it looks like an integer), it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 modified to fit. By contrast, the @code{format} function formats
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 floating point numbers without requiring the output to fit the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 syntax rules for floating point number.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 @section New Features for Printing And Formatting Output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 The @code{format} function has a new feature: @samp{%S}. This print
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 spec prints any kind of Lisp object, even a string, using its Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 printed representation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 By contrast, @samp{%s} prints everything without quotation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 @code{prin1-to-string} now takes an optional second argument which says
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 not to print the Lisp quotation characters. (In other words, to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 @code{princ} instead of @code{prin1}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 The new variable @code{print-level} specifies the maximum depth of list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 nesting to print before cutting off all deeper structure. A value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 @code{nil} means no limit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @section Changes in Basic Editing Functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 There are two new primitives for putting text in the kill ring:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 @code{kill-new} and @code{kill-append}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 The function @code{kill-new} adds a string to the front of the kill ring.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 Use @code{kill-append} to add a string to a previous kill. The second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 argument @var{before-p}, if non-@code{nil}, says to add the string at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 the beginning; otherwise, it goes at the end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 Both of these functions apply @code{interprogram-cut-function} to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 entire string of killed text that ends up at the beginning of the kill
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 ring.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 The new function @code{current-kill} rotates the yanking pointer in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 kill ring by @var{n} places, and returns the text at that place in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ring. If the optional second argument @var{do-not-move} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 non-@code{nil}, it doesn't actually move the yanking point; it just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 returns the @var{n}th kill forward. If @var{n} is zero, indicating a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 request for the latest kill, @code{current-kill} calls
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 @code{interprogram-paste-function} (documented below) before consulting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 the kill ring.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 All Emacs Lisp programs should either use @code{current-kill},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 @code{kill-new}, and @code{kill-append} to manipulate the kill ring, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 be sure to call @code{interprogram-paste-function} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 @code{interprogram-cut-function} as appropriate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 The variables @code{interprogram-paste-function} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 @code{interprogram-cut-function} exist so that you can provide functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 to transfer killed text to and from other programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 The @code{kill-region} function can now be used in read-only buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 It beeps, but adds the region to the kill ring without deleting it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 The new function @code{compare-buffer-substrings} lets you compare two
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 substrings of the same buffer or two different buffers. Its arguments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 look like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (compare-buffer-substrings @var{buf1} @var{beg1} @var{end1} @var{buf2} @var{beg2} @var{end2})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 The first three arguments specify one substring, giving a buffer and two
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 positions within the buffer. The last three arguments specify the other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 substring in the same way.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 The value is negative if the first substring is less, positive if the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 first is greater, and zero if they are equal. The absolute value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 the result is one plus the index of the first different characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 Overwrite mode treats tab and newline characters specially. You can now
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 turn off this special treatment by setting @code{overwrite-binary-mode}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 to @code{t}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 Once the mark ``exists'' in a buffer, it normally never ceases to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 exist. However, in Transient Mark mode, it may become @dfn{inactive}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 The variable @code{mark-active}, which is always local in all buffers,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 indicates whether the mark is active: non-@code{nil} means yes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 When the mark is inactive, the function @code{mark} normally gets an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 error. However, @code{(mark t)} returns the position of the inactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 mark.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 The function @code{push-mark} normally does not activate the mark.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 However, it accepts an optional third argument @var{activate} which,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 if non-@code{nil}, says to activate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 A command can request deactivation of the mark upon return to the editor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 command loop by setting @code{deactivate-mark} to a non-@code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 value. Transient Mark mode works by causing the command loop to take
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 note of @code{deactivate-mark} and actually deactivate the mark.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 Transient Mark mode enables highlighting of the region when the mark is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 active. This is currently implemented only under the X Window System.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 A few other commands vary their behavior slightly in this case, by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 testing @code{transient-mark-mode}. More specifically, they avoid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 special display actions such as moving the cursor temporarily, which are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 not needed when the region is shown by highlighting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 The variables @code{activate-mark-hook} and @code{deactivate-mark-hook}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 are normal hooks run, respectively, when the mark becomes active and when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 it becomes inactive. The hook @code{activate-mark-hook} is also run at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 the end of a command if the mark is active and the region may have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 changed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 The function @code{move-to-column} now accepts a second optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 argument @var{force}, in addition to @var{column}; if the requested
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 column @var{column} is in the middle of a tab character and @var{force}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 is non-@code{nil}, @code{move-to-column} replaces the tab with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 appropriate sequence of spaces so that it can place point exactly at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 @var{column}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 The search functions when successful now return the value of point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 rather than just @code{t}. This affects the functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 @code{search-forward}, @code{search-backward},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 @code{word-search-forward}, @code{word-search-backward},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 @code{re-search-forward}, and @code{re-search-backward}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 When you do regular expression searching or matching, there is no longer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 a limit to how many @samp{\(@dots{}\)} pairs you can get information
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 about with @code{match-beginning} and @code{match-end}. Also, these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 parenthetical groupings may now be nested to any degree.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 In a regular expression, when you use an asterisk after a parenthetical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 grouping, and then ask about what range was matched by the grouping,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 Emacs 19 reports just its last occurrence. Emacs 18 used to report the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 range of all the repetitions put together.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (string-match "f\\(o\\)*" "foo")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (list (match-beginning 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 returns @code{(2 3)} in Emacs 19, corresponding to just the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 repetition of @samp{\(o\)}. In Emacs 18, that expression returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 @code{(1 3)}, encompassing both repetitions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 If you want the Emacs 18 behavior, use a grouping @emph{containing} the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 asterisk: @code{"f\\(o*\\)"}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 The new special form @code{save-match-data} preserves the regular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 expression match status. Usage: @code{(save-match-data
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 @var{body}@dots{})}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 The function @code{translate-region} applies a translation table to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 characters in a part of the buffer. Invoke it as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 @code{(translate-region @var{start} @var{end} @var{table})}; @var{start}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 and @var{end} bound the region to translate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 The translation table @var{table} is a string; @code{(aref @var{table}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 @var{ochar})} gives the translated character corresponding to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 @var{ochar}. If the length of @var{table} is less than 256, any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 characters with codes larger than the length of @var{table} are not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 altered by the translation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 @code{translate-region} returns the number of characters which were
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 actually changed by the translation. This does not count characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 which were mapped into themselves in the translation table.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 There are two new hook variables that let you notice all changes in all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 buffers (or in a particular buffer, if you make them buffer-local):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 @code{before-change-function} and @code{after-change-function}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 If @code{before-change-function} is non-@code{nil}, then it is called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 before any buffer modification. Its arguments are the beginning and end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 of the region that is going to change, represented as integers. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 buffer that's about to change is always the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 If @code{after-change-function} is non-@code{nil}, then it is called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 after any buffer modification. It takes three arguments: the beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 and end of the region just changed, and the length of the text that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 existed before the change. (To get the current length, subtract the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 region beginning from the region end.) All three arguments are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 integers. The buffer that has just changed is always the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 Both of these variables are temporarily bound to @code{nil} during the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 time that either of these hooks is running. This means that if one of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 these functions changes the buffer, that change won't run these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 functions. If you do want hooks to be run recursively, write your hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 functions to bind these variables back to their usual values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 The hook @code{first-change-hook} is run using @code{run-hooks} whenever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 a buffer is changed that was previously in the unmodified state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 The second argument to @code{insert-abbrev-table-description} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 now optional.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 @section Text Properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 Each character in a buffer or a string can have a @dfn{text property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 list}, much like the property list of a symbol. The properties belong
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 to a particular character at a particular place, such as, the letter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 @samp{T} at the beginning of this sentence. Each property has a name,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 which is usually a symbol, and an associated value, which can be any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 Lisp object---just as for properties of symbols.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 You can use the property @code{face} to control the font and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 color of text. Several other property names have special meanings. You
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 can create properties of any name and examine them later for your own
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 purposes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 Copying text between strings and buffers preserves the properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 along with the characters; this includes such diverse functions as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 @code{substring}, @code{insert}, and @code{buffer-substring}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 Since text properties are considered part of the buffer contents,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 changing properties in a buffer ``modifies'' the buffer, and you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 also undo such changes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 Strings with text properties have a special printed representation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 which describes all the properties. This representation is also the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 read syntax for such a string. It looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 #("@var{characters}" @var{property-data}...)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 where @var{property-data} is zero or more elements in groups of three as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 @var{beg} @var{end} @var{plist}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 The elements @var{beg} and @var{end} are integers, and together specify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 a portion of the string; @var{plist} is the property list for that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 portion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 @subsection Examining Text Properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 The simplest way to examine text properties is to ask for the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 a particular property of a particular character. For that, use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 @code{get-text-property}. Use @code{text-properties-at} to get the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 entire property list of a character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 @code{(get-text-property @var{pos} @var{prop} @var{object})} returns the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 @var{prop} property of the character after @var{pos} in @var{object} (a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 buffer or string). The argument @var{object} is optional and defaults
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 to the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 @code{(text-properties-at @var{pos} @var{object})} returns the entire
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 property list of the character after @var{pos} in the string or buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 @var{object} (which defaults to the current buffer).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 @subsection Changing Text Properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 There are four primitives for changing properties of a specified
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 range of text:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 @item add-text-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662 This function puts on specified properties, leaving other existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 properties unaltered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 @item put-text-property
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 This function puts on a single specified property, leaving others
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 unaltered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 @item remove-text-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670 This function removes specified properties, leaving other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 properties unaltered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 @item set-text-properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 This function replaces the entire property list, leaving no vestige of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 the properties that that text used to have.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 All these functions take four arguments: @var{start}, @var{end},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679 @var{props}, and @var{object}. The last argument is optional and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 defaults to the current buffer. The argument @var{props} has the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 of a property list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 @subsection Property Search Functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 In typical use of text properties, most of the time several or many
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 consecutive characters have the same value for a property. Rather than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 writing your programs to examine characters one by one, it is much
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 faster to process chunks of text that have the same property value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 The functions @code{next-property-change} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 @code{previous-property-change} scan forward or backward from position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 @var{pos} in @var{object}, looking for a change in any property between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693 two characters scanned. They returns the position between those two
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 characters, or @code{nil} if no change is found.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 The functions @code{next-single-property-change} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 @code{previous-single-property-change} are similar except that you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698 specify a particular property and they look for changes in the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 that property only. The property is the second argument, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 @var{object} is third.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 @subsection Special Properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 If a character has a @code{category} property, we call it the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 @dfn{category} of the character. It should be a symbol. The properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 of the symbol serve as defaults for the properties of the character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 You can use the property @code{face} to control the font and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 color of text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711 You can specify a different keymap for a portion of the text by means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 of a @code{local-map} property. The property's value, for the character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 after point, replaces the buffer's local map.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 If a character has the property @code{read-only}, then modifying that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 character is not allowed. Any command that would do so gets an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 If a character has the property @code{modification-hooks}, then its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719 value should be a list of functions; modifying that character calls all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 of those functions. Each function receives two arguments: the beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 and end of the part of the buffer being modified. Note that if a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 particular modification hook function appears on several characters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 being modified by a single primitive, you can't predict how many times
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 the function will be called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 Insertion of text does not, strictly speaking, change any existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727 character, so there is a special rule for insertion. It compares the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 @code{read-only} properties of the two surrounding characters; if they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 are @code{eq}, then the insertion is not allowed. Assuming insertion is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 allowed, it then gets the @code{modification-hooks} properties of those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 characters and calls all the functions in each of them. (If a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732 appears on both characters, it may be called once or twice.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 The special properties @code{point-entered} and @code{point-left}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 record hook functions that report motion of point. Each time point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 moves, Emacs compares these two property values:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 the @code{point-left} property of the character after the old location,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 the @code{point-entered} property of the character after the new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 location.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748 If these two values differ, each of them is called (if not @code{nil})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 with two arguments: the old value of point, and the new one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 The same comparison is made for the characters before the old and new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 locations. The result may be to execute two @code{point-left} functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 (which may be the same function) and/or two @code{point-entered}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 functions (which may be the same function). The @code{point-left}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755 functions are always called before the @code{point-entered} functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 A primitive function may examine characters at various positions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 without moving point to those positions. Only an actual change in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 value of point runs these hook functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761 @section New Features for Files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 The new function @code{file-accessible-directory-p} tells you whether
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 you can open files in a particular directory. Specify as an argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767 either a directory name or a file name which names a directory file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 The function returns @code{t} if you can open existing files in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772 The new function @code{file-executable-p} returns @code{t} if its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 argument is the name of a file you have permission to execute.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776 The function @code{file-truename} returns the ``true name'' of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 specified file. This is the name that you get by following symbolic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 links until none remain. The argument must be an absolute file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 New functions @code{make-directory} and @code{delete-directory} create and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 delete directories. They both take one argument, which is the name of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 the directory as a file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 The function @code{read-file-name} now takes an additional argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787 which specifies an initial file name. If you specify this argument,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 @code{read-file-name} inserts it along with the directory name. It puts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 the cursor between the directory and the initial file name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 The user can then use the initial file name unchanged, modify it, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792 simply kill it with @kbd{C-k}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 If the variable @code{insert-default-directory} is @code{nil}, then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795 default directory is not inserted, and the new argument is ignored.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 The function @code{file-relative-name} does the inverse of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799 expansion---it tries to return a relative name which is equivalent to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 @var{filename} when interpreted relative to @var{directory}. (If such a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 relative name would be longer than the absolute name, it returns the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 absolute name instead.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 The function @code{file-newest-backup} returns the name of the most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806 recent backup file for @var{filename}, or @code{nil} that file has no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 backup files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 The list returned by @code{file-attributes} now has 12 elements. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 12th element is the file system number of the file system that the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812 is in. This element together with the file's inode number, which is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 11th element, give enough information to distinguish any two files on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 the system---no two files can have the same values for both of these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 numbers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 The new function @code{set-visited-file-modtime} updates the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 buffer's recorded modification time from the visited file's time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 This is useful if the buffer was not read from the file normally, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 if the file itself has been changed for some known benign reason.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 If you give the function an argument, that argument specifies the new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 value for the recorded modification time. The argument should be a list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 of the form @code{(@var{high} . @var{low})} or @code{(@var{high}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 @var{low})} containing two integers, each of which holds 16 bits of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 time. (This is the same format that @code{file-attributes} uses to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 return time values.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 The new function @code{visited-file-modtime} returns the recorded last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 modification time, in that same format.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 The function @code{directory-files} now takes an optional fourth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 argument which, if non-@code{nil}, inhibits sorting the file names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837 Use this if you want the utmost possible speed and don't care what order
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 the files are processed in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 If the order of processing is at all visible to the user, then the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 will probably be happier if you do sort the names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 The variable @code{directory-abbrev-alist} contains an alist of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 abbreviations to use for file directories. Each element has the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 @code{(@var{from} . @var{to})}, and says to replace @var{from} with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 @var{to} when it appears in a directory name. This replacement is done
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848 when setting up the default directory of a newly visited file. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 @var{from} string is actually a regular expression; it should always
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 start with @samp{^}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 You can set this variable in @file{site-init.el} to describe the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 abbreviations appropriate for your site.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856 The function @code{abbreviate-file-name} applies abbreviations from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 @code{directory-abbrev-alist} to its argument, and substitutes @samp{~}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 for the user's home directory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 Abbreviated directory names are useful for directories that are normally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 accessed through symbolic links. If you think of the link's name as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 ``the name'' of the directory, you can define it as an abbreviation for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863 the directory's official name; then ordinarily Emacs will call that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 directory by the link name you normally use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 @code{write-region} can write a given string instead of text from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 buffer. Use the string as the first argument (in place of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 starting character position).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871 You can supply a second file name as the fifth argument (@var{visit}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 Use this to write the data to one file (the first argument,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 @var{filename}) while nominally visiting a different file (the fifth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 argument, @var{visit}). The argument @var{visit} is used in the echo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 area message and also for file locking; @var{visit} is stored in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 @code{buffer-file-name}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 The value of @code{write-file-hooks} does not change when you switch to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880 a new major mode. The intention is that these hooks have to do with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 where the file came from, and not with what it contains.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 There is a new hook variable for saving files:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 @code{write-contents-hooks}. It works just like @code{write-file-hooks}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886 except that switching to a new major mode clears it back to @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 Major modes should use this hook variable rather than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 @code{write-file-hooks}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891 The hook @code{after-save-buffer-hook} runs just after a buffer has been
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 saved in its visited file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 The new function @code{set-default-file-modes} sets the file protection
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 for new files created with Emacs. The argument must be an integer. (It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 would be better to permit symbolic arguments like the @code{chmod}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898 program, but that would take more work than this function merits.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 Use the new function @code{default-file-modes} to read the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 default file mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904 Call the new function @code{unix-sync} to force all pending disk output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 to happen as soon as possible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 @section Making Certain File Names ``Magic''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 You can implement special handling for a class of file names. You must
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911 supply a regular expression to define the class of names (all those
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 which match the regular expression), plus a handler that implements all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 the primitive Emacs file operations for file names that do match.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 The value of @code{file-name-handler-alist} is a list of handlers,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 together with regular expressions that decide when to apply each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 handler. Each element has the form @code{(@var{regexp}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 . @var{handler})}. If a file name matches @var{regexp}, then all work
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919 on that file is done by calling @var{handler}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 All the Emacs primitives for file access and file name transformation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 check the given file name against @code{file-name-handler-alist}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 call @var{handler} to do the work if appropriate. The first argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 given to @var{handler} is the name of the primitive; the remaining
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925 arguments are the arguments that were passed to that primitive. (The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 first of these arguments is typically the file name itself.) For
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927 example, if you do this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 (file-exists-p @var{filename})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 and @var{filename} has handler @var{handler}, then @var{handler} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 called like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 (funcall @var{handler} 'file-exists-p @var{filename})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941 Here are the primitives that you can handle in this way:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 @quotation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 @code{add-name-to-file}, @code{copy-file}, @code{delete-directory},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 @code{delete-file}, @code{directory-file-name}, @code{directory-files},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 @code{dired-compress-file}, @code{dired-uncache},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947 @code{expand-file-name}, @code{file-accessible-directory-p},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 @code{file-attributes}, @code{file-directory-p},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 @code{file-executable-p}, @code{file-exists-p}, @code{file-local-copy},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 @code{file-modes}, @code{file-name-all-completions},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 @code{file-name-as-directory}, @code{file-name-completion},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 @code{file-name-directory}, @code{file-name-nondirectory},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953 @code{file-name-sans-versions}, @code{file-newer-than-file-p},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 @code{file-readable-p}, @code{file-symlink-p}, @code{file-writable-p},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 @code{insert-directory}, @code{insert-file-contents}, @code{load},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 @code{make-directory}, @code{make-symbolic-link}, @code{rename-file},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 @code{set-file-modes}, @code{set-visited-file-modtime},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958 @code{unhandled-file-name-directory},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 @code{verify-visited-file-modtime}, @code{write-region}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 @end quotation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 The handler function must handle all of the above operations, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 possibly others to be added in the future. Therefore, it should always
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 reinvoke the ordinary Lisp primitive when it receives an operation it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965 does not recognize. Here's one way to do this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 (defun my-file-handler (operation &rest args)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 ;; @r{First check for the specific operations}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 ;; @r{that we have special handling for.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 (cond ((eq operation 'insert-file-contents) @dots{})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972 ((eq operation 'write-region) @dots{})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 @dots{}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 ;; @r{Handle any operation we don't know about.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 (t (let (file-name-handler-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 (apply operation args)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 The function @code{file-local-copy} copies file @var{filename} to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 local site, if it isn't there already. If @var{filename} specifies a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981 ``magic'' file name which programs outside Emacs cannot directly read or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 write, this copies the contents to an ordinary file and returns that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 file's name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985 If @var{filename} is an ordinary file name, not magic, then this function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 does nothing and returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 The function @code{unhandled-file-name-directory} is used to get a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 non-magic directory name from an arbitrary file name. It uses the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990 directory part of the specified file name if that is not magic.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 Otherwise, it asks the file name's handler what to do.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 @section Frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 @cindex frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 Emacs now supports multiple X windows via a new data type known as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 @dfn{frame}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 A frame is a rectangle on the screen that contains one or more Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000 windows. Subdividing a frame works just like subdividing the screen in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 earlier versions of Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 @cindex terminal frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 There are two kinds of frames: terminal frames and X window frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 Emacs creates one terminal frame when it starts up with no X display; it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 uses Termcap or Terminfo to display using characters. There is no way
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007 to create another terminal frame after startup. If Emacs has an X
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 display, it does not make a terminal frame, and there is none.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 @cindex X window frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011 When you are using X windows, Emacs starts out with a single X window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 frame. You can create any number of X window frames using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 @code{make-frame}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 Use the predicate @code{framep} to determine whether a given Lisp object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 is a frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 The function @code{redraw-frame} redisplays the entire contents of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 given frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 @subsection Creating and Deleting Frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 Use @code{make-frame} to create a new frame. This is the only primitive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 for creating frames. In principle it could work under any window system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025 which Emacs understands; the only one we support is X.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 @code{make-frame} takes just one argument, which is an alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 specifying frame parameters. Any parameters not mentioned in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029 argument alist default based on the value of @code{default-frame-alist};
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 parameters not specified there default from the standard X defaults file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 and X resources.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033 When you invoke Emacs, if you specify arguments for window appearance
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 and so forth, these go into @code{default-frame-alist} and that is how
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 they have their effect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037 You can specify the parameters for the initial startup X window frame by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 setting @code{initial-frame-alist} in your @file{.emacs} file. If these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 parameters specify a separate minibuffer-only frame, and you have not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 created one, Emacs creates one for you, using the parameter values
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 specified in @code{minibuffer-frame-alist}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 You can specify the size and position of a frame using the frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 parameters @code{left}, @code{top}, @code{height} and @code{width}. You
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045 must specify either both size parameters or neither. You must specify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 either both position parameters or neither. The geometry parameters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 that you don't specify are chosen by the window manager in its usual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 fashion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050 The function @code{x-parse-geometry} converts a standard X-style
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 geometry string to an alist which you can use as part of the argument to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 @code{make-frame}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 Use the function @code{delete-frame} to eliminate a frame. Frames are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055 like buffers where deletion is concerned; a frame actually continues to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 exist as a Lisp object until it is deleted @emph{and} there are no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 references to it, but once it is deleted, it has no further effect on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058 the screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 The function @code{frame-live-p} returns non-@code{nil} if the argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 (a frame) has not been deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 @subsection Finding All Frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065 The function @code{frame-list} returns a list of all the frames that have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 not been deleted. It is analogous to @code{buffer-list}. The list that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 you get is newly created, so modifying the list doesn't have any effect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 on the internals of Emacs. The function @code{visible-frame-list} returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 the list of just the frames that are visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071 @code{next-frame} lets you cycle conveniently through all the frames from an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 arbitrary starting point. Its first argument is a frame. Its second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 argument @var{minibuf} says what to do about minibuffers:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 @item @code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 Exclude minibuffer-only frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078 @item a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 Consider only the frames using that particular window as their
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 @item anything else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082 Consider all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 @subsection Frames and Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 All the non-minibuffer windows in a frame are arranged in a tree of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 subdivisions; the root of this tree is available via the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 @code{frame-root-window}. Each window is part of one and only one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 frame; you can get the frame with @code{window-frame}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 At any time, exactly one window on any frame is @dfn{selected within the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 frame}. You can get the frame's current selected window with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 @code{frame-selected-window}. The significance of this designation is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095 that selecting the frame selects for Emacs as a whole the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 currently selected within that frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 Conversely, selecting a window for Emacs with @code{select-window} also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 makes that window selected within its frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 @subsection Frame Visibility
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 A frame may be @dfn{visible}, @dfn{invisible}, or @dfn{iconified}. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104 it is invisible, it doesn't show in the screen, not even as an icon.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 You can set the visibility status of a frame with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 @code{make-frame-visible}, @code{make-frame-invisible}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 @code{iconify-frame}. You can examine the visibility status with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 @code{frame-visible-p}---it returns @code{t} for a visible frame,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 @code{nil} for an invisible frame, and @code{icon} for an iconified
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 @subsection Selected Frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114 At any time, one frame in Emacs is the @dfn{selected frame}. The selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 window always resides on the selected frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 @defun selected-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118 This function returns the selected frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 The X server normally directs keyboard input to the X window that the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 mouse is in. Some window managers use mouse clicks or keyboard events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 to @dfn{shift the focus} to various X windows, overriding the normal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 behavior of the server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 Lisp programs can switch frames ``temporarily'' by calling the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127 @code{select-frame}. This does not override the window manager; rather,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 it escapes from the window manager's control until that control is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 somehow reasserted. The function takes one argument, a frame, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 selects that frame. The selection lasts until the next time the user
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 does something to select a different frame, or until the next time this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132 function is called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 Emacs cooperates with the X server and the window managers by arranging
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 to select frames according to what the server and window manager ask
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 for. It does so by generating a special kind of input event, called a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 @dfn{focus} event. The command loop handles a focus event by calling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138 @code{internal-select-frame}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 @subsection Frame Size and Position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 The new functions @code{frame-height} and @code{frame-width} return the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 height and width of a specified frame (or of the selected frame),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 measured in characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 The new functions @code{frame-pixel-height} and @code{frame-pixel-width}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 return the height and width of a specified frame (or of the selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 frame), measured in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 The new functions @code{frame-char-height} and @code{frame-char-width}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 return the height and width of a character in a specified frame (or in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 the selected frame), measured in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 @code{set-frame-size} sets the size of a frame, measured in characters;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 its arguments are @var{frame}, @var{cols} and @var{rows}. To set the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156 size with values measured in pixels, you can use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 @code{modify-frame-parameters}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 The function @code{set-frame-position} sets the position of the top left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 corner of a frame. Its arguments are @var{frame}, @var{left} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 @var{top}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 New functions @code{set-frame-height} and @code{set-frame-width} set the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 size of a specified frame. The frame is the first argument; the size is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 the second.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 @subsection Frame Parameters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 A frame has many parameters that affect how it displays. Use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 function @code{frame-parameters} to get an alist of all the parameters
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 of a given frame. To alter parameters, use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 @code{modify-frame-parameters}, which takes two arguments: the frame to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175 modify, and an alist of parameters to change and their new values. Each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 element of @var{alist} has the form @code{(@var{parm} . @var{value})},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 where @var{parm} is a symbol. Parameters that aren't meaningful are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 ignored. If you don't mention a parameter in @var{alist}, its value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 doesn't change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 Just what parameters a frame has depends on what display mechanism it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182 uses. Here is a table of the parameters of an X
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 window frame:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 @item name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 The name of the frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 @item left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190 The screen position of the left edge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 @item top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 The screen position of the top edge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 @item height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196 The height of the frame contents, in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 @item width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 The width of the frame contents, in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201 @item window-id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 The number of the X window for the frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 @item minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 Whether this frame has its own minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206 @code{t} means yes, @code{none} means no,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 @code{only} means this frame is just a minibuffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 a minibuffer window (in some other frame)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 means the new frame uses that minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 @item font
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 The name of the font for the text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214 @item foreground-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 The color to use for the inside of a character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 Use strings to designate colors;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 the X server defines the meaningful color names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 @item background-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 The color to use for the background of text.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 @item mouse-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223 The color for the mouse cursor.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 @item cursor-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 The color for the cursor that shows point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 @item border-color
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 The color for the border of the frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 @item cursor-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232 The way to display the cursor. There are two legitimate values:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 @code{bar} and @code{box}. The value @code{bar} specifies a vertical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 bar between characters as the cursor. The value @code{box} specifies an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 ordinary black box overlaying the character after point; that is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236 default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 @item icon-type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239 Non-@code{nil} for a bitmap icon, @code{nil} for a text icon.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 @item border-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 The width in pixels of the window border.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244 @item internal-border-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 The distance in pixels between text and border.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 @item auto-raise
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248 Non-@code{nil} means selecting the frame raises it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 @item auto-lower
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251 Non-@code{nil} means deselecting the frame lowers it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 @item vertical-scroll-bars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 Non-@code{nil} gives the frame a scroll bar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 for vertical scrolling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 @item horizontal-scroll-bars
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 Non-@code{nil} gives the frame a scroll bar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 for horizontal scrolling.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 @subsection Minibufferless Frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 Normally, each frame has its own minibuffer window at the bottom, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 is used whenever that frame is selected. However, you can also create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 frames with no minibuffers. These frames must use the minibuffer window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 of some other frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271 The variable @code{default-minibuffer-frame} specifies where to find a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 minibuffer for frames created without minibuffers of their own. Its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 value should be a frame which does have a minibuffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 You can also specify a minibuffer window explicitly when you create a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 frame; then @code{default-minibuffer-frame} is not used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 @section X Window System Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 The new functions @code{mouse-position} and @code{set-mouse-position} give
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 access to the current position of the mouse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 @code{mouse-position} returns a description of the position of the mouse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286 The value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 and @var{y} are measured in pixels relative to the top left corner of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 the inside of @var{frame}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 @code{set-mouse-position} takes three arguments, @var{frame}, @var{x}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 and @var{y}, and warps the mouse cursor to that location on the screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294 @code{track-mouse} is a new special form for tracking mouse motion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 Use it in definitions of mouse clicks that want pay to attention to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 the motion of the mouse, not just where the buttons are pressed and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 released. Here is how to use it:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 (track-mouse @var{body}@dots{})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 While @var{body} executes, mouse motion generates input events just as mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 clicks do. @var{body} can read them with @code{read-event} or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 @code{read-key-sequence}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 @code{track-mouse} returns the value of the last form in @var{body}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 The format of these events is described under ``New Input Event Formats.''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 @code{x-set-selection} sets a ``selection'' in the X server.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 It takes two arguments: a selection type @var{type}, and the value to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 assign to it, @var{data}. If @var{data} is @code{nil}, it means to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 clear out the selection. Otherwise, @var{data} may be a string, a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316 symbol, an integer (or a cons of two integers or list of two integers),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 or a cons of two markers pointing to the same buffer. In the last case,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 the selection is considered to be the text between the markers. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 data may also be a vector of valid non-vector selection values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 Each possible @var{type} has its own selection value, which changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 independently. The usual values of @var{type} are @code{PRIMARY} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 @code{SECONDARY}; these are symbols with upper-case names, in accord
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 with X protocol conventions. The default is @code{PRIMARY}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 To get the value of the selection, call @code{x-get-selection}. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 function accesses selections set up by Emacs and those set up by other X
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328 clients. It takes two optional arguments, @var{type} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 @var{data-type}. The default for @var{type} is @code{PRIMARY}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 The @var{data-type} argument specifies the form of data conversion to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 use; meaningful values include @code{TEXT}, @code{STRING},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333 @code{TARGETS}, @code{LENGTH}, @code{DELETE}, @code{FILE_NAME},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 @code{CHARACTER_POSITION}, @code{LINE_NUMBER}, @code{COLUMN_NUMBER},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 @code{OWNER_OS}, @code{HOST_NAME}, @code{USER}, @code{CLASS},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 @code{NAME}, @code{ATOM}, and @code{INTEGER}. (These are symbols with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337 upper-case names in accord with X Windows conventions.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 The default for @var{data-type} is @code{STRING}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 The X server has a set of numbered @dfn{cut buffers} which can store text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 or other data being moved between applications. Use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 @code{x-get-cut-buffer} to get the contents of a cut buffer; specify the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 cut buffer number as argument. Use @code{x-set-cut-buffer} with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345 argument @var{string} to store a new string into the first cut buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 (moving the other values down through the series of cut buffers,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 kill-ring-style).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 Cut buffers are considered obsolete, but Emacs supports them for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 sake of X clients that still use them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 You can close the connection with the X server with the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 @code{x-close-current-connection}. This takes no arguments.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 Then you can connect to a different X server with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357 @code{x-open-connection}. The first argument, @var{display}, is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 name of the display to connect to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 The optional second argument @var{xrm-string} is a string of resource
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 names and values, in the same format used in the @file{.Xresources}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 file. The values you specify override the resource values recorded in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 the X server itself. Here's an example of what this string might look
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364 like:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 "*BorderWidth: 3\n*InternalBorder: 2\n"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 A series of new functions give you information about the X server and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 the screen you are using.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375 @item x-display-screens
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 The number of screens associated with the current display.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 @item x-server-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 The version numbers of the X server in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 @item x-server-vendor
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 The vendor supporting the X server in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 @item x-display-pixel-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385 The height of this X screen in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 @item x-display-mm-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 The height of this X screen in millimeters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 @item x-display-pixel-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 The width of this X screen in pixels.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 @item x-display-mm-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 The width of this X screen in millimeters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 @item x-display-backing-store
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 The backing store capability of this screen. Values can be the symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 @code{always}, @code{when-mapped}, or @code{not-useful}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 @item x-display-save-under
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401 Non-@code{nil} if this X screen supports the SaveUnder feature.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 @item x-display-planes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 The number of planes this display supports.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406 @item x-display-visual-class
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 The visual class for this X screen. The value is one of the symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408 @code{static-gray}, @code{gray-scale}, @code{static-color},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 @code{pseudo-color}, @code{true-color}, and @code{direct-color}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 @item x-display-color-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 @code{t} if the X screen in use is a color screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 @item x-display-color-cells
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 The number of color cells this X screen supports.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 There is also a variable @code{x-no-window-manager}, whose value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419 @code{t} if no X window manager is in use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 The function @code{x-synchronize} enables or disables an X Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 debugging mode: synchronous communication. It takes one argument,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 non-@code{nil} to enable the mode and @code{nil} to disable.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 In synchronous mode, Emacs waits for a response to each X protocol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 command before doing anything else. This means that errors are reported
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 right away, and you can directly find the erroneous command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 Synchronous mode is not the default because it is much slower.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 The function @code{x-get-resource} retrieves a resource value from the X
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 Windows defaults database. Its three arguments are @var{attribute},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 @var{name} and @var{class}. It searches using a key of the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435 @samp{@var{instance}.@var{attribute}}, with class @samp{Emacs}, where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 @var{instance} is the name under which Emacs was invoked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 The optional arguments @var{component} and @var{subclass} add to the key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 and the class, respectively. You must specify both of them or neither.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 If you specify them, the key is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441 @samp{@var{instance}.@var{component}.@var{attribute}}, and the class is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 @samp{Emacs.@var{subclass}}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 @code{x-display-color-p} returns @code{t} if you are using an X server
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 with a color display, and @code{nil} otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 @c ??? Name being changed from x-defined-color.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449 @code{x-color-defined-p} takes as argument a string describing a color; it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 returns @code{t} if the display supports that color. (If the color is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451 @code{"black"} or @code{"white"} then even black-and-white displays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 support it.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 @code{x-popup-menu} has been generalized. It now accepts a keymap as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 the @var{menu} argument. Then the menu items are the prompt strings of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457 individual key bindings, and the item values are the keys which have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 those bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 You can also supply a list of keymaps as the first argument; then each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 keymap makes one menu pane (but keymaps that don't provide any menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 items don't appear in the menu at all).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 @code{x-popup-menu} also accepts a mouse button event as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 @var{position} argument. Then it displays the menu at the location at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 which the event took place. This is convenient for mouse-invoked
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 commands that pop up menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 x-pointer-shape, x-nontext-pointer-shape, x-mode-pointer-shape.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 You can use the function @code{x-rebind-key} to change the sequence of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 characters generated by the X server for one of the keyboard keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 The first two arguments, @var{keycode} and @var{shift-mask}, should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479 numbers representing the keyboard code and shift mask respectively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 They specify what key to change.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 The third argument, @var{newstring}, is the new definition of the key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 It is a sequence of characters that the key should produce as input.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 The shift mask value is a combination of bits according to this table:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 @item 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 Control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 @item 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 Meta
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 @item 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 Shift
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 @item 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 Shift Lock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 If you specify @code{nil} for @var{shift-mask}, then the key specified
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499 by @var{keycode} is redefined for all possible shift combinations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 For the possible values of @var{keycode} and their meanings, see the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 file @file{/usr/lib/Xkeymap.txt}. Keep in mind that the codes in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 file are in octal!
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 @ignore @c Presumably this is already fixed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 NOTE: due to an X bug, this function will not take effect unless the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 user has a @file{~/.Xkeymap} file. (See the documentation for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 @code{keycomp} program.) This problem will be fixed in X version 11.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 The related function @code{x-rebind-keys} redefines a single keyboard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 key, specifying the behavior for each of the 16 shift masks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 independently. The first argument is @var{keycode}, as in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 @code{x-rebind-key}. The second argument @var{strings} is a list of 16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515 elements, one for each possible shift mask value; each element says how
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 to redefine the key @var{keycode} with the corresponding shift mask
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 value. If an element is a string, it is the new definition. If an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 element is @code{nil}, the definition does not change for that shift
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 mask.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 The function @code{x-parse-geometry} parses a string specifying window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 size and position in the usual X format. It returns an alist describing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 which parameters were specified, and the values that were given for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 The elements of the alist look like @code{(@var{parameter} .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 @var{value})}. The possible @var{parameter} values are @code{left},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 @code{top}, @code{width}, and @code{height}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 @section New Window Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 The new function @code{window-at} tells you which window contains a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537 given horizontal and vertical position on a specified frame. Call it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 with three arguments, like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 (window-at @var{x} @var{column} @var{frame})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 The function returns the window which contains that cursor position in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 the frame @var{frame}. If you omit @var{frame}, the selected frame is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 The function @code{coordinates-in-window-p} takes two arguments and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 checks whether a particular frame position falls within a particular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 (coordinates-in-window-p @var{coordinates} @var{window})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 The argument @var{coordinates} is a cons cell of this form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 (@var{x} . @var{y})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 The two coordinates are measured in characters, and count from the top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 left corner of the screen or frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 The value of the function tells you what part of the window the position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 is in. The possible values are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 @item (@var{relx} . @var{rely})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 The coordinates are inside @var{window}. The numbers @var{relx} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 @var{rely} are equivalent window-relative coordinates, counting from 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 at the top left corner of the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 @item mode-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 The coordinates are in the mode line of @var{window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 @item vertical-split
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 The coordinates are in the vertical line between @var{window} and its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 neighbor to the right.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 @item nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 The coordinates are not in any sense within @var{window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587 You need not specify a frame when you call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 @code{coordinates-in-window-p}, because it assumes you mean the frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 which window @var{window} is on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 The function @code{minibuffer-window} now accepts a frame as argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593 and returns the minibuffer window used for that frame. If you don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 specify a frame, the currently selected frame is used. The minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 window may be on the frame in question, but if that frame has no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 minibuffer of its own, it uses the minibuffer window of some other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597 frame, and @code{minibuffer-window} returns that window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 Use @code{window-live-p} to test whether a window is still alive (that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 is, not deleted).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 Use @code{window-minibuffer-p} to determine whether a given window is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 minibuffer or not. It no longer works to do this by comparing the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 window with the result of @code{(minibuffer-window)}, because there can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607 be more than one minibuffer window at a time (if you have multiple
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 frames).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 If you set the variable @code{pop-up-frames} non-@code{nil}, then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 functions to show something ``in another window'' actually create a new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613 frame for the new window. Thus, you will tend to have a frame for each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 window, and you can easily have a frame for each buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 The value of the variable @code{pop-up-frame-function} controls how new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 frames are made. The value should be a function which takes no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618 arguments and returns a frame. The default value is a function which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 creates a frame using parameters from @code{pop-up-frame-alist}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 @code{display-buffer} is the basic primitive for finding a way to show a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 buffer on the screen. You can customize its behavior by storing a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 function in the variable @code{display-buffer-function}. If this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625 variable is non-@code{nil}, then @code{display-buffer} calls it to do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 the work. Your function should accept two arguments, as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 @table @var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 @item buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630 The buffer to be displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 @item flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 A flag which, if non-@code{nil}, means you should find another window to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634 display @var{buffer} in, even if it is already visible in the selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 The function you supply will be used by commands such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639 @code{switch-to-buffer-other-window} and @code{find-file-other-window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 as well as for your own calls to @code{display-buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 @code{delete-window} now gives all of the deleted window's screen space
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 to a single neighboring window. Likewise, @code{enlarge-window} takes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 space from only one neighboring window until that window disappears;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646 only then does it take from another window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 @code{next-window} and @code{previous-window} accept another argument,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 @var{all-frames}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 These functions now take three optional arguments: @var{window},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 @var{minibuf} and @var{all-frames}. @var{window} is the window to start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654 from (@code{nil} means use the selected window). @var{minibuf} says
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 whether to include the minibuffer in the windows to cycle through:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 @code{t} means yes, @code{nil} means yes if it is active, and anything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 else means no.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 Normally, these functions cycle through all the windows in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660 selected frame, plus the minibuffer used by the selected frame even if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 it lies in some other frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 If @var{all-frames} is @code{t}, then these functions cycle through
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664 all the windows in all the frames that currently exist. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 @var{all-frames} is neither @code{t} nor @code{nil}, then they limit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 themselves strictly to the windows in the selected frame, excluding the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 minibuffer in use if it lies in some other frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 The functions @code{get-lru-window} and @code{get-largest-window} now
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 take an optional argument @var{all-frames}. If it is non-@code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 the functions consider all windows on all frames. Otherwise, they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 consider just the windows on the selected frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 Likewise, @code{get-buffer-window} takes an optional second argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676 @var{all-frames}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 The variable @code{other-window-scroll-buffer} specifies which buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680 @code{scroll-other-window} should scroll.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 You can now mark a window as ``dedicated'' to its buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 Then Emacs will not try to use that window for any other buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 unless you explicitly request it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 Use the new function @code{set-window-dedicated-p} to set the dedication
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 flag of a window @var{window} to the value @var{flag}. If @var{flag} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 @code{t}, this makes the window dedicated. If @var{flag} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690 @code{nil}, this makes the window non-dedicated.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 Use @code{window-dedicated-p} to examine the dedication flag of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 specified window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 The new function @code{walk-windows} cycles through all visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 windows, calling @code{proc} once for each window with the window as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698 its sole argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 The optional second argument @var{minibuf} says whether to include minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 windows. A value of @code{t} means count the minibuffer window even if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 not active. A value of @code{nil} means count it only if active. Any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 other value means not to count the minibuffer even if it is active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 If the optional third argument @var{all-frames} is @code{t}, that means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 include all windows in all frames. If @var{all-frames} is @code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 it means to cycle within the selected frame, but include the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 window (if @var{minibuf} says so) that that frame uses, even if it is on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 another frame. If @var{all-frames} is neither @code{nil} nor @code{t},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710 @code{walk-windows} sticks strictly to the selected frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 The function @code{window-end} is a counterpart to @code{window-start}:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714 it returns the buffer position of the end of the display in a given
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 window (or the selected window).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 The function @code{window-configuration-p} returns non-@code{nil} when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 given an object that is a window configuration (such as is returned by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720 @code{current-window-configuration}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 @section Display Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 @code{baud-rate} is now a variable rather than a function. This is so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 you can set it to reflect the effective speed of your terminal, when the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 system doesn't accurately know the speed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 You can now remove any echo area message and make the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 visible. To do this, call @code{message} with @code{nil} as the only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 argument. This clears any existing message, and lets the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735 minibuffer contents show through. Previously, there was no reliable way
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 to make sure that the minibuffer contents were visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 The variable @code{temp-buffer-show-hook} has been renamed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 @code{temp-buffer-show-function}, because its value is a single function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 (of one argument), not a normal hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744 The new function @code{force-mode-line-update} causes redisplay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 of the current buffer's mode line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 @section Display Tables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750 @cindex display table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 You can use the @dfn{display table} feature to control how all 256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 possible character codes display on the screen. This is useful for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 displaying European languages that have letters not in the ASCII
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 character set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 The display table maps each character code into a sequence of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 @dfn{glyphs}, each glyph being an image that takes up one character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758 position on the screen. You can also define how to display each glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 on your terminal, using the @dfn{glyph table}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 @subsection Display Tables Proper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 Use @code{make-display-table} to create a display table. The table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 initially has @code{nil} in all elements.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 A display table is actually an array of 261 elements. The first 256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 elements of a display table control how to display each possible text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 character. The value should be @code{nil} or a vector (which is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769 sequence of glyphs; see below). @code{nil} as an element means to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 display that character following the usual display conventions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 The remaining five elements of a display table serve special purposes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 (@code{nil} means use the default stated below):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 @item 256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777 The glyph for the end of a truncated screen line (the default for this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 is @samp{\}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779 @item 257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 The glyph for the end of a continued line (the default is @samp{$}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 @item 258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 The glyph for the indicating an octal character code (the default is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 @samp{\}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784 @item 259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 The glyph for indicating a control characters (the default is @samp{^}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 @item 260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787 The vector of glyphs for indicating the presence of invisible lines (the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 default is @samp{...}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 Each buffer typically has its own display table. The display table for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 the current buffer is stored in @code{buffer-display-table}. (This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 variable automatically becomes local if you set it.) If this variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 is @code{nil}, the value of @code{standard-display-table} is used in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 that buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 Each window can have its own display table, which overrides the display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 table of the buffer it is showing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 If neither the selected window nor the current buffer has a display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 table, and if @code{standard-display-table} is @code{nil}, then Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 uses the usual display conventions:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 Character codes 32 through 127 map to glyph codes 32 through 127.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 Codes 0 through 31 map to sequences of two glyphs, where the first glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 is the ASCII code for @samp{^}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811 Character codes 128 through 255 map to sequences of four glyphs, where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 the first glyph is the ASCII code for @samp{\}, and the others represent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 digits.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1816 The usual display conventions are also used for any character whose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1817 entry in the active display table is @code{nil}. This means that when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1818 you set up a display table, you need not specify explicitly what to do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1819 with each character, only the characters for which you want unusual
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1820 behavior.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1821
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1822 @subsection Glyphs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1824 @cindex glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1825 A glyph stands for an image that takes up a single character position on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1826 the screen. A glyph is represented in Lisp as an integer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1827
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1828 @cindex glyph table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1829 The meaning of each integer, as a glyph, is defined by the glyph table,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1830 which is the value of the variable @code{glyph-table}. It should be a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1831 vector; the @var{g}th element defines glyph code @var{g}. The possible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1832 definitions of a glyph code are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1834 @table @var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1835 @item integer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1836 Define this glyph code as an alias for code @var{integer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1837 This is used with X Windows to specify a face code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1838
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1839 @item string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1840 Send the characters in @var{string} to the terminal to output this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1841 glyph. This alternative is available only for character terminals, not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1842 with X.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1844 @item @code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1845 This glyph is simple. On an ordinary terminal, the glyph code mod 256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1846 is the character to output. With X, the glyph code mod 256 is character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1847 to output, and the glyph code divided by 256 specifies the @dfn{face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1848 code} to use while outputting it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1849 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1850
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1851 Any glyph code beyond the length of the glyph table is automatically simple.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1853 If @code{glyph-table} is @code{nil}, then all possible glyph codes are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1854 simple.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1855
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1856 A @dfn{face} is a named combination of a font and a pair of colors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1857 (foreground and background). A glyph code can specify a face id number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1858 to use for displaying that glyph.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1859
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1860 @subsection ISO Latin 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1861
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1862 If you have a terminal that can handle the entire ISO Latin 1 character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1863 set, you can arrange to use that character set as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1865 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1866 (standard-display-european 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1867 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1868
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1869 If you are editing buffers written in the ISO Latin 1 character set and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1870 your terminal doesn't handle anything but ASCII, you can load the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1871 @code{iso-ascii} to set up a display table which makes the other ISO
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1872 characters display as sequences of ASCII characters. For example, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1873 character ``o with umlaut'' displays as @samp{@{"o@}}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1874
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1875 Some European countries have terminals that don't support ISO Latin 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1876 but do support the special characters for that country's language. You
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1877 can define a display table to work one language using such terminals.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1878 For an example, see @file{lisp/iso-swed.el}, which handles certain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1879 Swedish terminals.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1881 You can load the appropriate display table for your terminal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1882 automatically by writing a terminal-specific Lisp file for the terminal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1883 type.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1884
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1885 @section Overlays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1886 @cindex overlays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1887
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1888 You can use @dfn{overlays} to alter the appearance of a buffer's text on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1889 the screen. An overlay is an object which belongs to a particular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1890 buffer, and has a specified beginning and end. It also has properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1891 which you can examine and set; these affect the display of the text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1892 within the overlay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1894 @subsection Overlay Properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1895
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1896 Overlay properties are like text properties in some respects, but the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1897 differences are more important than the similarities. Text properties
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1898 are considered a part of the text; overlays are specifically considered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1899 not to be part of the text. Thus, copying text between various buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1900 and strings preserves text properties, but does not try to preserve
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1901 overlays. Changing a buffer's text properties marks the buffer as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1902 modified, while moving an overlay or changing its properties does not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1904 @table @code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1905 @item face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1906 @kindex face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1907 This property specifies a face for displaying the text within the overlay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1908
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1909 @item priority
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1910 @kindex priority
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1911 This property's value (which should be a nonnegative number) determines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1912 the priority of the overlay. The priority matters when two or more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1913 overlays cover the same character and both specify a face for display;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1914 the one whose @code{priority} value is larger takes priority over the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1915 other, and its face attributes override the face attributes of the lower
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1916 priority overlay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1918 Currently, all overlays take priority over text properties. Please
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1919 avoid using negative priority values, as we have not yet decided just
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1920 what they should mean.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1921
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1922 @item window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1923 @kindex window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1924 If the @code{window} property is non-@code{nil}, then the overlay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1925 applies only on that window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1926 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1927
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1928 @subsection Overlay Functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1929
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1930 Use the functions @code{overlay-get} and @code{overlay-put}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1931 to access and set the properties of an overlay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1932 They take arguments like @code{get} and @code{put}, except
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1933 that the first argument is an overlay rather than a symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1934
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1935 To create an overlay, call @code{(make-overlay @var{start} @var{end})}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1936 You can specify the buffer as the third argument if you wish.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1937 To delete one, use @code{delete-overlay}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1938
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1939 Use @code{overlay-start}, @code{overlay-end} and @code{overlay-buffer}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1940 to examine the location and range of an overlay. Use @code{move-overlay}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1941 to change them; its arguments are @var{overlay}, @var{start}, @var{end}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1942 and (optionally) the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1943
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1944 There are two functions to search for overlays: @code{overlays-at} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1945 @code{next-overlay-change}. @code{overlays-at} returns a list of all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1946 the overlays containing a particular position.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1947 @code{(next-overlay-change @var{pos})} returns the position of the next
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1948 overlay beginning or end following @var{pos}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1949
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1950 @section Faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1951
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1952 A @dfn{face} is a named collection of graphical attributes: font,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1953 foreground color, background color and optional underlining. Faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1954 control the display of text on the screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1955
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1956 Each face has its own @dfn{face id number} which distinguishes faces at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1957 low levels within Emacs. However, for most purposes, you can refer to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1958 faces in Lisp programs by their names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1959
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1960 Each face name is meaningful for all frames, and by default it has the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1961 same meaning in all frames. But you can arrange to give a particular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1962 face name a special meaning in one frame if you wish.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1963
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1964 @subsection Choosing a Face for Display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1966 Here are all the ways to specify which face to use for display of text:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1967
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1968 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1969 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1970 With defaults. Each frame has a @dfn{default face}, whose id number is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1971 zero, which is used for all text that doesn't somehow specify another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1972 face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1974 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1975 With text properties. A character may have a @code{face} property; if so,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1976 it's displayed with that face. If the character has a @code{mouse-face}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1977 property, that is used instead of the @code{face} property when the mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1978 is ``near enough'' to the character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1979
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1980 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1981 With overlays. An overlay may have @code{face} and @code{mouse-face}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1982 properties too; they apply to all the text covered by the overlay.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1983
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1984 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1985 With special glyphs. Each glyph can specify a particular face id
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1986 number.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1987 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1988
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1989 If these various sources together specify more than one face for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1990 particular character, Emacs merges the attributes of the various faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1991 specified. The attributes of the faces of special glyphs come first;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1992 then come attributes of faces from overlays, followed by those from text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1993 properties, and last the default face.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1994
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1995 When multiple overlays cover one character, an overlay with higher
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1996 priority overrides those with lower priority.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1997
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1998 If an attribute such as the font or a color is not specified in any of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1999 the above ways, the frame's own font or color is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2001 @xref{Face Functions,, Face Functions, elisp, The Emacs Lisp Reference
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2002 Manual}, for functions to create and change faces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2003
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2004 @section New Input Event Formats
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2005
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2006 Mouse clicks, mouse movements and function keys no longer appear in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2007 input stream as characters; instead, other kinds of Lisp objects
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2008 represent them as input.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2009
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2010 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2011 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2012 An ordinary input character event consists of a @dfn{basic code} between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2013 0 and 255, plus any or all of these @dfn{modifier bits}:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2014
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2015 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2016 @item meta
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2017 The 2**23 bit in the character code indicates a character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2018 typed with the meta key held down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2020 @item control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2021 The 2**22 bit in the character code indicates a non-@sc{ASCII}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2022 control character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2023
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2024 @sc{ASCII} control characters such as @kbd{C-a} have special basic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2025 codes of their own, so Emacs needs no special bit to indicate them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2026 Thus, the code for @kbd{C-a} is just 1.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2027
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2028 But if you type a control combination not in @sc{ASCII}, such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2029 @kbd{%} with the control key, the numeric value you get is the code
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2030 for @kbd{%} plus 2**22 (assuming the terminal supports non-@sc{ASCII}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2031 control characters).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2032
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2033 @item shift
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2034 The 2**21 bit in the character code indicates an @sc{ASCII} control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2035 character typed with the shift key held down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2037 For letters, the basic code indicates upper versus lower case; for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2038 digits and punctuation, the shift key selects an entirely different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2039 character with a different basic code. In order to keep within
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2040 the @sc{ASCII} character set whenever possible, Emacs avoids using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2041 the 2**21 bit for those characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2042
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2043 However, @sc{ASCII} provides no way to distinguish @kbd{C-A} from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2044 @kbd{C-a}, so Emacs uses the 2**21 bit in @kbd{C-A} and not in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2045 @kbd{C-a}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2046
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2047 @item hyper
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2048 The 2**20 bit in the character code indicates a character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2049 typed with the hyper key held down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2050
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2051 @item super
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2052 The 2**19 bit in the character code indicates a character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2053 typed with the super key held down.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2054
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2055 @item alt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2056 The 2**18 bit in the character code indicates a character typed with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2057 the alt key held down. (On some terminals, the key labeled @key{ALT}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2058 is actually the meta key.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2059 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2060
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2061 In the future, Emacs may support a larger range of basic codes. We may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2062 also move the modifier bits to larger bit numbers. Therefore, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2063 should avoid mentioning specific bit numbers in your program. Instead,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2064 the way to test the modifier bits of a character is with the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2065 @code{event-modifiers} (see below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2066
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2067 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2068 Function keys are represented as symbols. The symbol's name is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2069 the function key's label. For example, pressing a key labeled @key{F1}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2070 places the symbol @code{f1} in the input stream.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2072 There are a few exceptions to the symbol naming convention:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2073
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2074 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2075 @item @code{kp-add}, @code{kp-decimal}, @code{kp-divide}, @dots{}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2076 Keypad keys (to the right of the regular keyboard).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2077 @item @code{kp-0}, @code{kp-1}, @dots{}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2078 Keypad keys with digits.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2079 @item @code{kp-f1}, @code{kp-f2}, @code{kp-f3}, @code{kp-f4}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2080 Keypad PF keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2081 @item @code{left}, @code{up}, @code{right}, @code{down}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2082 Cursor arrow keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2083 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2084
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2085 You can use the modifier keys @key{CTRL}, @key{META}, @key{HYPER},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2086 @key{SUPER}, @key{ALT} and @key{SHIFT} with function keys. The way
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2087 to represent them is with prefixes in the symbol name:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2088
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2089 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2090 @item A-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2091 The alt modifier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2092 @item C-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2093 The control modifier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2094 @item H-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2095 The hyper modifier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2096 @item M-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2097 The meta modifier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2098 @item s-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2099 The super modifier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2100 @item S-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2101 The shift modifier.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2102 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2104 Thus, the symbol for the key @key{F3} with @key{META} held down is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2105 @kbd{M-@key{F3}}. When you use more than one prefix, we recommend you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2106 write them in alphabetical order (though the order does not matter in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2107 arguments to the key-binding lookup and modification functions).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2109 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2110 Mouse events are represented as lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2112 If you press a mouse button and release it at the same location, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2113 generates a ``click'' event. Mouse click events have this form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2115 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2116 (@var{button-symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2117 (@var{window} (@var{column} . @var{row})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2118 @var{buffer-pos} @var{timestamp}))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2119 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2121 Here is what the elements normally mean:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2122
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2123 @table @var
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2124 @item button-symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2125 indicates which mouse button was used. It is one of the symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2126 @code{mouse-1}, @code{mouse-2}, @dots{}, where the buttons are normally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2127 numbered left to right.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2129 You can also use prefixes @samp{A-}, @samp{C-}, @samp{H-}, @samp{M-},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2130 @samp{S-} and @samp{s-} for modifiers alt, control, hyper, meta, shift
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2131 and super, just as you would with function keys.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2133 @item window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2134 is the window in which the click occurred.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2135
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2136 @item column
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2137 @itemx row
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2138 are the column and row of the click, relative to the top left corner of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2139 @var{window}, which is @code{(0 . 0)}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2141 @item buffer-pos
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2142 is the buffer position of the character clicked on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2144 @item timestamp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2145 is the time at which the event occurred, in milliseconds. (Since this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2146 value wraps around the entire range of Emacs Lisp integers in about five
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2147 hours, it is useful only for relating the times of nearby events.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2148 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2150 The meanings of @var{buffer-pos}, @var{row} and @var{column} are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2151 somewhat different when the event location is in a special part of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2152 screen, such as the mode line or a scroll bar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2153
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2154 If the position is in the window's scroll bar, then @var{buffer-pos} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2155 the symbol @code{vertical-scroll-bar}, and the pair @code{(@var{column}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2156 . @var{row})} is replaced with a pair @code{(@var{portion}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2157 . @var{whole})}, where @var{portion} is the distance of the click from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2158 the top or left end of the scroll bar, and @var{whole} is the length of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2159 the entire scroll bar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2160
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2161 If the position is on a mode line or the vertical line separating
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2162 @var{window} from its neighbor to the right, then @var{buffer-pos} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2163 the symbol @code{mode-line} or @code{vertical-line}. In this case
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2164 @var{row} and @var{column} do not have meaningful data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2166 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2167 Releasing a mouse button above a different character position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2168 generates a ``drag'' event, which looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2170 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2171 (@var{button-symbol}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2172 (@var{window1} (@var{column1} . @var{row1})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2173 @var{buffer-pos1} @var{timestamp1})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2174 (@var{window2} (@var{column2} . @var{row2})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2175 @var{buffer-pos2} @var{timestamp2}))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2176 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2178 The name of @var{button-symbol} contains the prefix @samp{drag-}. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2179 second and third elements of the event give the starting and ending
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2180 position of the drag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2181
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2182 The @samp{drag-} prefix follows the modifier key prefixes such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2183 @samp{C-} and @samp{M-}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2185 If @code{read-key-sequence} receives a drag event which has no key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2186 binding, and the corresponding click event does have a binding, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2187 changes the drag event into a click event at the drag's starting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2188 position. This means that you don't have to distinguish between click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2189 and drag events unless you want to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2191 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2192 Click and drag events happen when you release a mouse button. Another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2193 kind of event happens when you press a button. It looks just like a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2194 click event, except that the name of @var{button-symbol} contains the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2195 prefix @samp{down-}. The @samp{down-} prefix follows the modifier key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2196 prefixes such as @samp{C-} and @samp{M-}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2197
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2198 The function @code{read-key-sequence}, and the Emacs command loop,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2199 ignore any down events that don't have command bindings. This means
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2200 that you need not worry about defining down events unless you want them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2201 to do something. The usual reason to define a down event is so that you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2202 can track mouse motion until the button is released.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2203
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2204 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2205 For example, if the user presses and releases the left mouse button over
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2206 the same location, Emacs generates a sequence of events like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2208 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2209 (down-mouse-1 (#<window 18 on NEWS> 2613 (0 . 38) -864320))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2210 (mouse-1 (#<window 18 on NEWS> 2613 (0 . 38) -864180))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2211 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2213 Or, while holding the control key down, the user might hold down the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2214 second mouse button, and drag the mouse from one line to the next.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2215 That produces two events, as shown here:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2217 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2218 (C-down-mouse-2 (#<window 18 on NEWS> 3440 (0 . 27) -731219))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2219 (C-drag-mouse-2 (#<window 18 on NEWS> 3440 (0 . 27) -731219)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2220 (#<window 18 on NEWS> 3510 (0 . 28) -729648))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2221 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2223 Or, while holding down the meta and shift keys, the user might press
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2224 the second mouse button on the window's mode line, and then drag the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2225 mouse into another window. That produces an event like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2227 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2228 (M-S-down-mouse-2 (#<window 18 on NEWS> mode-line (33 . 31) -457844))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2229 (M-S-drag-mouse-2 (#<window 18 on NEWS> mode-line (33 . 31) -457844)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2230 (#<window 20 on carlton-sanskrit.tex> 161 (33 . 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2231 -453816))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2232 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2233
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2234 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2235 A key sequence that starts with a mouse click is read using the keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2236 of the buffer in the window clicked on, not the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2238 This does not imply that clicking in a window selects that window or its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2239 buffer. The execution of the command begins with no change in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2240 selected window or current buffer. However, the command can switch
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2241 windows or buffers if programmed to do so.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2243 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2244 Mouse motion events are represented by lists. During the execution of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2245 the body of a @code{track-mouse} form, moving the mouse generates events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2246 that look like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2247
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2248 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2249 (mouse-movement (@var{window} (@var{column} . @var{row})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2250 @var{buffer-pos} @var{timestamp}))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2251 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2252
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2253 The second element of the list describes the current position of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2254 mouse, just as in a mouse click event.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2256 Outside of @code{track-mouse} forms, Emacs does not generate events for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2257 mere motion of the mouse, and these events do not appear.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2259 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2260 Focus shifts between frames are represented by lists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2262 When the mouse shifts temporary input focus from one frame to another,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2263 Emacs generates an event like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2265 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2266 (switch-frame @var{new-frame})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2267 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2269 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2270 where @var{new-frame} is the frame switched to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2272 In X windows, most window managers are set up so that just moving the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2273 mouse into a window is enough to set the focus there. As far as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2274 user is concerned, Emacs behaves consistently with this. However, there is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2275 no need for the Lisp program to know about the focus change until some
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2276 other kind of input arrives. So Emacs generates the focus event only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2277 when the user actually types a keyboard key or presses a mouse button in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2278 the new frame; just moving the mouse between frames does not generate a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2279 focus event.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2280
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2281 The global key map usually binds this event to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2282 @code{internal-select-frame} function, so that characters typed at a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2283 frame apply to that frame's selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2285 If the user switches frames in the middle of a key sequence, then Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2286 delays the @code{switch-frame} event until the key sequence is over.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2287 For example, suppose @kbd{C-c C-a} is a key sequence in the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2288 buffer's keymaps. If the user types @kbd{C-c}, moves the mouse to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2289 another frame, and then types @kbd{C-a}, @code{read-key-sequence}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2290 returns the sequence @code{"\C-c\C-a"}, and the next call to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2291 @code{read-event} or @code{read-key-sequence} will return the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2292 @code{switch-frame} event.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2293 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2295 @section Working with Input Events
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2297 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2298 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2299 Functions which work with key sequences now handle non-character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2300 events. Functions like @code{define-key}, @code{global-set-key}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2301 @code{local-set-key} used to accept strings representing key sequences;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2302 now, since events may be arbitrary lisp objects, they also accept
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2303 vectors. The function @code{read-key-sequence} may return a string or a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2304 vector, depending on whether or not the sequence read contains only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2305 characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2307 List events may be represented by the symbols at their head; to bind
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2308 clicks of the left mouse button, you need only present the symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2309 @code{mouse-1}, not an entire mouse click event. If you do put an event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2310 which is a list in a key sequence, only the event's head symbol is used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2311 in key lookups.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2313 For example, to globally bind the left mouse button to the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2314 @code{mouse-set-point}, you could evaluate this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2316 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2317 (global-set-key [mouse-1] 'mouse-set-point)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2318 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2320 To bind the sequence @kbd{C-c @key{F1}} to the command @code{tex-view}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2321 in @code{tex-mode-map}, you could evaluate this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2322
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2323 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2324 (define-key tex-mode-map [?\C-c f1] 'tex-view)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2325 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2326
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2327 To find the binding for the function key labeled @key{NEXT} in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2328 @code{minibuffer-local-map}, you could evaluate this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2329
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2330 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2331 (lookup-key minibuffer-local-map [next])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2332 @result{} next-history-element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2333 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2335 If you call the function @code{read-key-sequence} and then press
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2336 @kbd{C-x C-@key{F5}}, here is how it behaves:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2338 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2339 (read-key-sequence "Press `C-x C-F5': ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2340 @result{} [24 C-f5]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2341 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2342
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2343 Note that @samp{24} is the character @kbd{C-x}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2344
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2345 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2346 The documentation functions (@code{single-key-description},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2347 @code{key-description}, etc.) now handle the new event types. Wherever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2348 a string of keyboard input characters was acceptable in previous
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2349 versions of Emacs, a vector of events should now work.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2350
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2351 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2352 Special parts of a window can have their own bindings for mouse events.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2354 When mouse events occur in special parts of a window, such as a mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2355 line or a scroll bar, the event itself shows nothing special---only the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2356 symbol that would normally represent that mouse button and modifier
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2357 keys. The information about the screen region is kept in other parts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2358 of the event list. But @code{read-key-sequence} translates this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2359 information into imaginary prefix keys, all of which are symbols:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2360 @code{mode-line}, @code{vertical-line}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2361 @code{vertical-scroll-bar}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2363 For example, if you call @code{read-key-sequence} and then click the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2364 mouse on the window's mode line, this is what happens:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2366 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2367 (read-key-sequence "Click on the mode line: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2368 @result{} [mode-line (mouse-1 (#<window 6 on NEWS> mode-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2369 (40 . 63) 5959987))]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2370 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2371
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2372 You can define meanings for mouse clicks in special window regions by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2373 defining key sequences using these imaginary prefix keys. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2374 here is how to bind the third mouse button on a window's mode line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2375 delete the window:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2377 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2378 (global-set-key [mode-line mouse-3] 'mouse-delete-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2379 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2381 Here's how to bind the middle button (modified by @key{META}) on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2382 vertical line at the right of a window to scroll the window to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2383 left.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2385 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2386 (global-set-key [vertical-line M-mouse-2] 'scroll-left)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2387 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2389 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2390 Decomposing an event symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2392 Each symbol used to identify a function key or mouse button has a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2393 property named @code{event-symbol-elements}, which is a list containing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2394 an unmodified version of the symbol, followed by modifiers the symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2395 name contains. The modifiers are symbols; they include @code{shift},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2396 @code{control}, and @code{meta}. In addition, a mouse event symbol has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2397 one of @code{click}, @code{drag}, and @code{down}. For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2399 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2400 (get 'f5 'event-symbol-elements)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2401 @result{} (f5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2402 (get 'C-f5 'event-symbol-elements)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2403 @result{} (f5 control)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2404 (get 'M-S-f5 'event-symbol-elements)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2405 @result{} (f5 meta shift)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2406 (get 'mouse-1 'event-symbol-elements)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2407 @result{} (mouse-1 click)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2408 (get 'down-mouse-1 'event-symbol-elements)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2409 @result{} (mouse-1 down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2410 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2412 Note that the @code{event-symbol-elements} property for a mouse click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2413 explicitly contains @code{click}, but the event symbol name itself does
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2414 not contain @samp{click}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2416 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2417 Use @code{read-event} to read input if you want to accept any kind of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2418 event. The old function @code{read-char} now discards events other than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2419 keyboard characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2420
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2421 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2422 @code{last-command-char} and @code{last-input-char} can now hold any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2423 kind of event.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2425 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2426 The new variable @code{unread-command-events} is much like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2427 @code{unread-command-char}. Its value is a list of events of any type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2428 to be processed as command input in order of appearance in the list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2429
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2430 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2431 The function @code{this-command-keys} may return a string or a vector,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2432 depending on whether or not the sequence read contains only characters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2433 You may need to upgrade code which uses this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2435 The function @code{recent-keys} now returns a vector of events.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2436 You may need to upgrade code which uses this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2437
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2438 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2439 A keyboard macro's definition can now be either a string or a vector.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2440 All that really matters is what elements it has. If the elements are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2441 all characters, then the macro can be a string; otherwise, it has to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2442 a vector.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2444 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2445 The variable @code{last-event-frame} records which frame the last input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2446 event was directed to. Usually this is the frame that was selected when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2447 the event was generated, but if that frame has redirected input focus to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2448 another frame, @code{last-event-frame} is the frame to which the event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2449 was redirected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2451 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2452 The interactive specification now allows a new code letter @samp{e} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2453 simplify commands bound to events which are lists. This code supplies
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2454 as an argument the complete event object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2455
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2456 You can use @samp{e} more than once in a single command's interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2457 specification. If the key sequence which invoked the command has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2458 @var{n} events with parameters, the @var{n}th @samp{e} provides the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2459 @var{n}th parameterized event. Events which are not lists, such as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2460 function keys and ASCII keystrokes, do not count where @samp{e} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2461 concerned.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2463 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2464 You can extract the starting and ending position values from a mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2465 button or motion event using the two functions @code{event-start} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2466 @code{event-end}. These two functions return different values for drag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2467 and motion events; for click and button-down events, they both return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2468 the position of the event.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2470 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2471 The position, a returned by @code{event-start} and @code{event-end}, is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2472 a list of this form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2474 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2475 (@var{window} @var{buffer-position} (@var{col} . @var{row}) @var{timestamp})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2476 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2478 You can extract parts of this list with the functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2479 @code{posn-window}, @code{posn-point}, @code{posn-col-row}, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2480 @code{posn-timestamp}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2482 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2483 The function @code{scroll-bar-scale} is useful for computing where to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2484 scroll to in response to a mouse button event from a scroll bar. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2485 takes two arguments, @var{ratio} and @var{total}, and in effect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2486 multiplies them. We say ``in effect'' because @var{ratio} is not a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2487 number; rather a pair @code{(@var{num} . @var{denom})}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2488
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2489 Here's the usual way to use @code{scroll-bar-scale}:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2491 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2492 (scroll-bar-scale (posn-col-row (event-start event))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2493 (buffer-size))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2494 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2495 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2496
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2497 @section Putting Keyboard Events in Strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2499 In most of the places where strings are used, we conceptualize the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2500 string as containing text characters---the same kind of characters found
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2501 in buffers or files. Occasionally Lisp programs use strings which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2502 conceptually contain keyboard characters; for example, they may be key
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2503 sequences or keyboard macro definitions. There are special rules for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2504 how to put keyboard characters into a string, because they are not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2505 limited to the range of 0 to 255 as text characters are.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2507 A keyboard character typed using the @key{META} key is called a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2508 @dfn{meta character}. The numeric code for such an event includes the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2509 2**23 bit; it does not even come close to fitting in a string. However,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2510 earlier Emacs versions used a different representation for these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2511 characters, which gave them codes in the range of 128 to 255. That did
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2512 fit in a string, and many Lisp programs contain string constants that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2513 use @samp{\M-} to express meta characters, especially as the argument to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2514 @code{define-key} and similar functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2516 We provide backward compatibility to run those programs with special
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2517 rules for how to put a keyboard character event in a string. Here are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2518 the rules:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2519
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2520 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2521 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2522 If the keyboard event value is in the range of 0 to 127, it can go in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2523 string unchanged.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2524
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2525 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2526 The meta variants of those events, with codes in the range of 2**23 to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2527 2**23+127, can also go in the string, but you must change their numeric
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2528 values. You must set the 2**7 bit instead of the 2**23 bit, resulting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2529 in a value between 128 and 255.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2530
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2531 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2532 Other keyboard character events cannot fit in a string. This includes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2533 keyboard events in the range of 128 to 255.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2534 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2536 Functions such as @code{read-key-sequence} that can construct strings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2537 containing events follow these rules.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2539 When you use the read syntax @samp{\M-} in a string, it produces a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2540 code in the range of 128 to 255---the same code that you get if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2541 modify the corresponding keyboard event to put it in the string. Thus,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2542 meta events in strings work consistently regardless of how they get into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2543 the strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2544
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2545 New programs can avoid dealing with these rules by using vectors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2546 instead of strings for key sequences when there is any possibility that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2547 these issues might arise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2549 The reason we changed the representation of meta characters as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2550 keyboard events is to make room for basic character codes beyond 127,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2551 and support meta variants of such larger character codes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2553 @section Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2554
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2555 You can now define menus conveniently as keymaps. Menus are normally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2556 used with the mouse, but they can work with the keyboard also.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2557
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2558 @subsection Defining Menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2560 A keymap is suitable for menu use if it has an @dfn{overall prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2561 string}, which is a string that appears as an element of the keymap. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2562 should describes the purpose of the menu. The easiest way to construct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2563 a keymap with a prompt string is to specify the string as an argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2564 when you run @code{make-keymap} or @code{make-sparse-keymap}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2565
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2566 The individual bindings in the menu keymap should also have prompt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2567 strings; these strings are the items in the menu. A binding with a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2568 prompt string looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2569
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2570 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2571 (@var{char} @var{string} . @var{real-binding})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2572 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2573
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2574 As far as @code{define-key} is concerned, the string is part of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2575 character's binding---the binding looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2576
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2577 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2578 (@var{string} . @var{real-binding}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2579 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2580
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2581 However, only @var{real-binding} is used for executing the key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2583 You can also supply a second string, called the help string, as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2584
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2585 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2586 (@var{char} @var{string} @var{help-string} . @var{real-binding})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2587 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2589 Currently Emacs does not actually use @var{help-string}; it knows only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2590 how to ignore @var{help-string} in order to extract @var{real-binding}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2591 In the future we hope to make @var{help-string} serve as longer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2592 documentation for the menu item, available on request.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2594 The prompt string for a binding should be short---one or two words. Its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2595 meaning should describe the command it corresponds to.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2596
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2597 If @var{real-binding} is @code{nil}, then @var{string} appears in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2598 menu but cannot be selected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2599
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2600 If @var{real-binding} is a symbol, and has a non-@code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2601 @code{menu-enable} property, that property is an expression which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2602 controls whether the menu item is enabled. Every time the keymap is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2603 used to display a menu, Emacs evaluates the expression, and it enables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2604 the menu item only if the expression's value is non-@code{nil}. When a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2605 menu item is disabled, it is displayed in a ``fuzzy'' fashion, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2606 cannot be selected with the mouse.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2608 @subsection Menus and the Mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2609
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2610 The way to make a menu keymap produce a menu is to make it the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2611 definition of a prefix key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2612
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2613 When the prefix key ends with a mouse event, Emacs handles the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2614 keymap by popping up a visible menu that you can select from with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2615 mouse. When you click on a menu item, the event generated is whatever
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2616 character or symbol has the binding which brought about that menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2617
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2618 A single keymap can appear as multiple panes, if you explicitly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2619 arrange for this. The way to do this is to make a keymap for each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2620 pane, then create a binding for each of those maps in the main keymap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2621 of the menu. Give each of these bindings a prompt string that starts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2622 with @samp{@@}. The rest of the prompt string becomes the name of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2623 pane. See the file @file{lisp/mouse.el} for an example of this. Any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2624 ordinary bindings with prompt strings are grouped into one pane, which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2625 appears along with the other panes explicitly created for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2626 submaps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2627
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2628 You can also get multiple panes from separate keymaps. The full
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2629 definition of a prefix key always comes from merging the definitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2630 supplied by the various active keymaps (minor modes, local, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2631 global). When more than one of these keymaps is a menu, each of them
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2632 makes a separate pane or panes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2634 @subsection Menus and the Keyboard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2635
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2636 When a prefix key ending with a keyboard event (a character or function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2637 key) has a definition that is a menu keymap, you can use the keyboard
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2638 to choose a menu item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2640 Emacs displays the menu alternatives in the echo area. If they don't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2641 all fit at once, type @key{SPC} to see the next line of alternatives.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2642 If you keep typing @key{SPC}, you eventually get to the end of the menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2643 and then cycle around to the beginning again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2644
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2645 When you have found the alternative you want, type the corresponding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2646 character---the one whose binding is that alternative.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2647
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2648 In a menu intended for keyboard use, each menu item must clearly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2649 indicate what character to type. The best convention to use is to make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2650 the character the first letter of the menu item prompt string. That is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2651 something users will understand without being told.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2652
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2653 @subsection The Menu Bar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2655 Under X Windows, each frame can have a @dfn{menu bar}---a permanently
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2656 displayed menu stretching horizontally across the top of the frame. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2657 items of the menu bar are the subcommands of the fake ``function key''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2658 @code{menu-bar}, as defined by all the active keymaps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2659
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2660 To add an item to the menu bar, invent a fake ``function key'' of your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2661 own (let's call it @var{key}), and make a binding for the key sequence
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2662 @code{[menu-bar @var{key}]}. Most often, the binding is a menu keymap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2663 so that pressing a button on the menu bar item leads to another menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2665 In order for a frame to display a menu bar, its @code{menu-bar-lines}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2666 property must be greater than zero. Emacs uses just one line for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2667 menu bar itself; if you specify more than one line, the other lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2668 serve to separate the menu bar from the windows in the frame. We
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2669 recommend you try one or two as the @code{menu-bar-lines} value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2671 @section Keymaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2672
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2673 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2674 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2675 The representation of keymaps has changed to support the new event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2676 types. All keymaps now have the form @code{(keymap @var{element}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2677 @var{element} @dots{})}. Each @var{element} takes one of the following
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2678 forms:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2680 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2681 @item @var{prompt-string}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2682 A string as an element of the keymap marks the keymap as a menu, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2683 serves as the overall prompt string for it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2684
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2685 @item @code{(@var{key} . @var{binding})}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2686 A cons cell binds @var{key} to @var{definition}. Here @var{key} may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2687 any sort of event head---a character, a function key symbol, or a mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2688 button symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2689
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2690 @item @var{vector}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2691 A vector of 128 elements binds all the ASCII characters; the @var{n}th
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2692 element holds the binding for character number @var{n}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2693
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2694 @item @code{(t . @var{binding})}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2695 A cons cell whose @sc{car} is @code{t} is a default binding; anything
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2696 not bound by previous keymap elements is given @var{binding} as its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2697 binding.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2699 Default bindings are important because they allow a keymap to bind all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2700 possible events without having to enumerate all the possible function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2701 keys and mouse clicks, with all possible modifier prefixes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2702
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2703 The function @code{lookup-key} (and likewise other functions for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2704 examining a key binding) normally report only explicit bindings of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2705 specified key sequence; if there is none, they return @code{nil}, even
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2706 if there is a default binding that would apply to that key sequence if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2707 it were actually typed in. However, these functions now take an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2708 optional argument @var{accept-defaults} which, if non-@code{nil}, says
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2709 to consider default bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2711 Note that if a vector in the keymap binds an ASCII character to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2712 @code{nil} (thus making it ``unbound''), the default binding does not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2713 apply to the character. Think of the vector element as an explicit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2714 binding of @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2715
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2716 Note also that if the keymap for a minor or major mode contains a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2717 default binding, it completely masks out any lower-priority keymaps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2718 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2720 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2721 A keymap can now inherit from another keymap. To do this, make the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2722 latter keymap the ``tail'' of the new one. Such a keymap looks like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2723 this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2724
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2725 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2726 (keymap @var{bindings}@dots{} . @var{other-keymap})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2727 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2728
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2729 The effect is that this keymap inherits all the bindings of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2730 @var{other-keymap}, but can add to them or override them with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2731 @var{bindings}. Subsequent changes in the bindings of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2732 @var{other-keymap} @emph{do} affect this keymap.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2733
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2734 For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2735
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2736 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2737 (setq my-mode-map (cons 'keymap text-mode-map))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2738 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2739
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2740 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2741 makes a keymap that by default inherits all the bindings of Text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2742 mode---whatever they may be at the time a key is looked up. Any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2743 bindings made explicitly in @code{my-mode-map} override the bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2744 inherited from Text mode, however.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2745
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2746 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2747 Minor modes can now have local keymaps. Thus, a key can act a special
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2748 way when a minor mode is in effect, and then revert to the major mode or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2749 global definition when the minor mode is no longer in effect. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2750 precedence of keymaps is now: minor modes (in no particular order), then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2751 major mode, and lastly the global map.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2752
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2753 The new @code{current-minor-mode-maps} function returns a list of all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2754 the keymaps of currently enabled minor modes, in the other that they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2755 apply.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2756
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2757 To set up a keymap for a minor mode, add an element to the alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2758 @code{minor-mode-map-alist}. Its elements look like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2759
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2760 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2761 (@var{symbol} . @var{keymap})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2762 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2763
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2764 The keymap @var{keymap} is active whenever @var{symbol} has a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2765 non-@code{nil} value. Use for @var{symbol} the variable which indicates
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2766 whether the minor mode is enabled.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2768 When more than one minor mode keymap is active, their order of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2769 precedence is the order of @code{minor-mode-map-alist}. But you should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2770 design minor modes so that they don't interfere with each other, and if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2771 you do this properly, the order will not matter.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2773 The function @code{minor-mode-key-binding} returns a list of all the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2774 active minor mode bindings of @var{key}. More precisely, it returns an
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2775 alist of pairs @code{(@var{modename} . @var{binding})}, where
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2776 @var{modename} is the variable which enables the minor mode, and
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2777 @var{binding} is @var{key}'s definition in that mode. If @var{key} has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2778 no minor-mode bindings, the value is @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2779
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2780 If the first binding is a non-prefix, all subsequent bindings from other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2781 minor modes are omitted, since they would be completely shadowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2782 Similarly, the list omits non-prefix bindings that follow prefix
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2783 bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2785 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2786 The new function @code{copy-keymap} copies a keymap, producing a new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2787 keymap with the same key bindings in it. If the keymap contains other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2788 keymaps directly, these subkeymaps are copied recursively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2789
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2790 If you want to, you can define a prefix key with a binding that is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2791 symbol whose function definition is another keymap. In this case,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2792 @code{copy-keymap} does not look past the symbol; it doesn't copy the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2793 keymap inside the symbol.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2794
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2795 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2796 @code{substitute-key-definition} now accepts an optional fourth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2797 argument, which is a keymap to use as a template.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2798
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2799 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2800 (substitute-key-definition olddef newdef keymap oldmap)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2801 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2802
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2803 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2804 finds all characters defined in @var{oldmap} as @var{olddef},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2805 and defines them in @var{keymap} as @var{newdef}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2807 In addition, this function now operates recursively on the keymaps that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2808 define prefix keys within @var{keymap} and @var{oldmap}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2809 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2810
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2811 @section Minibuffer Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2813 The minibuffer input functions @code{read-from-minibuffer} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2814 @code{completing-read} have new features.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2815
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2816 @subsection Minibuffer History
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2818 A new optional argument @var{hist} specifies which history list to use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2819 If you specify a variable (a symbol), that variable is the history
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2820 list. If you specify a cons cell @code{(@var{variable}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2821 . @var{startpos})}, then @var{variable} is the history list variable,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2822 and @var{startpos} specifies the initial history position (an integer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2823 counting from zero which specifies the most recent element of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2824 history).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2825
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2826 If you specify @var{startpos}, then you should also specify that element
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2827 of the history as @var{initial-input}, for consistency.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2828
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2829 If you don't specify @var{hist}, then the default history list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2830 @code{minibuffer-history} is used. Other standard history lists that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2831 you can use when appropriate include @code{query-replace-history},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2832 @code{command-history}, and @code{file-name-history}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2834 The value of the history list variable is a list of strings, most recent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2835 first. You should set a history list variable to @code{nil} before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2836 using it for the first time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2838 @code{read-from-minibuffer} and @code{completing-read} add new elements
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2839 to the history list automatically, and provide commands to allow the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2840 user to reuse items on the list. The only thing your program needs to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2841 do to use a history list is to initialize it and to pass its name to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2842 input functions when you wish. But it is safe to modify the list by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2843 hand when the minibuffer input functions are not using it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2844
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2845 @subsection Other Minibuffer Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2846
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2847 The @var{initial} argument to @code{read-from-minibuffer} and other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2848 minibuffer input functions can now be a cons cell @code{(@var{string}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2849 . @var{position})}. This means to start off with @var{string} in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2850 minibuffer, but put the cursor @var{position} characters from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2851 beginning, rather than at the end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2852
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2853 In @code{read-no-blanks-input}, the @var{initial} argument is now
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2854 optional; if it is omitted, the initial input string is the empty
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2855 string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2857 @section New Features for Defining Commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2858
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2859 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2860 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2861 If the interactive specification begins with @samp{@@}, this means to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2862 select the window under the mouse. This selection takes place before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2863 doing anything else with the command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2864
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2865 You can use both @samp{@@} and @samp{*} together in one command; they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2866 are processed in order of appearance.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2867
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2868 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2869 Prompts in an interactive specification can incorporate the values of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2870 the preceding arguments. Emacs replaces @samp{%}-sequences (as used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2871 with the @code{format} function) in the prompt with the interactive
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2872 arguments that have been read so far. For example, a command with this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2873 interactive specification
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2874
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2875 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2876 (interactive "sReplace: \nsReplace %s with: ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2877 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2878
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2879 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2880 prompts for the first argument with @samp{Replace: }, and then prompts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2881 for the second argument with @samp{Replace @var{foo} with: }, where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2882 @var{foo} is the string read as the first argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2883
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2884 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2885 If a command name has a property @code{enable-recursive-minibuffers}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2886 which is non-@code{nil}, then the command can use the minibuffer to read
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2887 arguments even if it is invoked from the minibuffer. The minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2888 command @code{next-matching-history-element} (normally bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2889 @kbd{M-s} in the minibuffer) uses this feature.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2890 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2892 @section New Features for Reading Input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2893
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2894 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2895 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2896 The function @code{set-input-mode} now takes four arguments. The last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2897 argument is optional. Their names are @var{interrupt}, @var{flow},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2898 @var{meta} and @var{quit}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2899
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2900 The argument @var{interrupt} says whether to use interrupt-driven
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2901 input. Non-@code{nil} means yes, and @code{nil} means no (use CBREAK
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2902 mode).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2903
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2904 The argument @var{flow} says whether to enable terminal flow control.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2905 Non-@code{nil} means yes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2906
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2907 The argument @var{meta} controls support for input character codes above
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2908 127. If @var{meta} is @code{t}, Emacs converts characters with the 8th
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2909 bit set into Meta characters. If @var{meta} is @code{nil}, Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2910 disregards the 8th bit; this is necessary when the terminal uses it as a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2911 parity bit. If @var{meta} is neither @code{t} nor @code{nil}, Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2912 uses all 8 bits of input unchanged. This is good for terminals using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2913 European 8-bit character sets.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2914
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2915 If @var{quit} non-@code{nil}, it is the character to use for quitting.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2916 (Normally this is @kbd{C-g}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2917
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2918 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2919 The variable @code{meta-flag} has been deleted; use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2920 @code{set-input-mode} to enable or disable support for a @key{META}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2921 key. This change was made because @code{set-input-mode} can send the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2922 terminal the appropriate commands to enable or disable operation of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2923 @key{META} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2924
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2925 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2926 The new variable @code{extra-keyboard-modifiers} lets Lisp programs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2927 ``press'' the modifier keys on the keyboard.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2928 The value is a bit mask:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2929
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2930 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2931 @item 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2932 The @key{SHIFT} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2933 @item 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2934 The @key{LOCK} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2935 @item 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2936 The @key{CTL} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2937 @item 8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2938 The @key{META} key.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2939 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2940
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2941 When you use X windows, the program can press any of the modifier keys
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2942 in this way. Otherwise, only the @key{CTL} and @key{META} keys can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2943 virtually pressed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2944
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2945 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2946 You can use the new function @code{keyboard-translate} to set up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2947 @code{keyboard-translate-table} conveniently.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2948
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2949 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2950 Y-or-n questions using the @code{y-or-n-p} function now accept @kbd{C-]}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2951 (usually mapped to @code{abort-recursive-edit}) as well as @kbd{C-g} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2952 quit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2953
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2954 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2955 The variable @code{num-input-keys} is the total number of key sequences
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2956 that the user has typed during this Emacs session.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2957
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2958 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2959 A new Lisp variable, @code{function-key-map}, holds a keymap which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2960 describes the character sequences sent by function keys on an ordinary
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2961 character terminal. This uses the same keymap data structure that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2962 used to hold bindings of key sequences, but it has a different meaning:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2963 it specifies translations to make while reading a key sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2964
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2965 If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2966 @var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2967 key sequence, it is replaced with @var{v}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2968
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2969 For example, VT100 terminals send @kbd{@key{ESC} O P} when the ``keypad''
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2970 PF1 key is pressed. Thus, on a VT100, @code{function-key-map} should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2971 ``bind'' that sequence to @code{[pf1]}. This specifies translation of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2972 @kbd{@key{ESC} O P} into @key{PF1} anywhere in a key sequence.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2973
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2974 Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2975 @key{ESC} O P}, but @code{read-key-sequence} translates this back into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2976 @kbd{C-c @key{PF1}}, which it returns as the vector @code{[?\C-c PF1]}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2977
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2978 Entries in @code{function-key-map} are ignored if they conflict with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2979 bindings made in the minor mode, local, or global keymaps.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2980
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2981 The value of @code{function-key-map} is usually set up automatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2982 according to the terminal's Terminfo or Termcap entry, and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2983 terminal-specific Lisp files. Emacs comes with a number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2984 terminal-specific files for many common terminals; their main purpose is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2985 to make entries in @code{function-key-map} beyond those that can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2986 deduced from Termcap and Terminfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2987
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2988 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2989 The variable @code{key-translation-map} works like @code{function-key-map}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2990 except for two things:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2991
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2992 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2993 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2994 @code{key-translation-map} goes to work after @code{function-key-map} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2995 finished; it receives the results of translation by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2996 @code{function-key-map}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2997
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2998 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2999 @code{key-translation-map} overrides actual key bindings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3000 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3001
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3002 The intent of @code{key-translation-map} is for users to map one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3003 character set to another, including ordinary characters normally bound
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3004 to @code{self-insert-command}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3005 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3006
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3007 @section New Syntax Table Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3008
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3009 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3010 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3011 You can use two new functions to move across characters in certain
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3012 syntax classes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3013
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3014 @code{skip-syntax-forward} moves point forward across characters whose
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3015 syntax classes are mentioned in its first argument, a string. It stops
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3016 when it encounters the end of the buffer, or position @var{lim} (the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3017 optional second argument), or a character it is not supposed to skip.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3018 The function @code{skip-syntax-backward} is similar but moves backward.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3019
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3020 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3021 The new function @code{forward-comment} moves point by comments. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3022 takes one argument, @var{count}; it moves point forward across
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3023 @var{count} comments (backward, if @var{count} is negative). If it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3024 finds anything other than a comment or whitespace, it stops, leaving
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3025 point at the far side of the last comment found. It also stops after
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3026 satisfying @var{count}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3027
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3028 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3029 The new variable @code{words-include-escapes} affects the behavior of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3030 @code{forward-word} and everything that uses it. If it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3031 non-@code{nil}, then characters in the ``escape'' and ``character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3032 quote'' syntax classes count as part of words.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3034 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3035 There are two new syntax flags for use in syntax tables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3036
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3037 @itemize -
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3038 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3039 The prefix flag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3040
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3041 The @samp{p} flag identifies additional ``prefix characters'' in Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3042 syntax. You can set this flag with @code{modify-syntax-entry} by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3043 including the letter @samp{p} in the syntax specification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3044
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3045 These characters are treated as whitespace when they appear between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3046 expressions. When they appear within an expression, they are handled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3047 according to their usual syntax codes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3048
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3049 The function @code{backward-prefix-chars} moves back over these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3050 characters, as well as over characters whose primary syntax class is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3051 prefix (@samp{'}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3052
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3053 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3054 The @samp{b} comment style flag.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3056 Emacs can now supports two comment styles simultaneously. (This is for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3057 the sake of C++.) More specifically, it can recognize two different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3058 comment-start sequences. Both must share the same first character; only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3059 the second character may differ. Mark the second character of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3060 @samp{b}-style comment start sequence with the @samp{b} flag. You can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3061 set this flag with @code{modify-syntax-entry} by including the letter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3062 @samp{b} in the syntax specification.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3063
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3064 The two styles of comment can have different comment-end sequences. A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3065 comment-end sequence (one or two characters) applies to the @samp{b}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3066 style if its first character has the @samp{b} flag set; otherwise, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3067 applies to the @samp{a} style.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3068
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3069 The appropriate comment syntax settings for C++ are as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3070
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3071 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3072 @item @samp{/}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3073 @samp{124b}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3074 @item @samp{*}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3075 @samp{23}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3076 @item newline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3077 @samp{>b}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3078 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3079
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3080 Thus @samp{/*} is a comment-start sequence for @samp{a} style, @samp{//}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3081 is a comment-start sequence for @samp{b} style, @samp{*/} is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3082 comment-end sequence for @samp{a} style, and newline is a comment-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3083 sequence for @samp{b} style.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3084 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3085 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3087 @section The Case Table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3088
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3089 You can customize case conversion using the new case table feature. A
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3090 case table is a collection of strings that specifies the mapping between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3091 upper case and lower case letters. Each buffer has its own case table.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3092 You need a case table if you are using a language which has letters that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3093 are not standard ASCII letters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3094
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3095 A case table is a list of this form:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3096
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3097 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3098 (@var{downcase} @var{upcase} @var{canonicalize} @var{equivalences})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3099 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3101 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3102 where each element is either @code{nil} or a string of length 256. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3103 element @var{downcase} says how to map each character to its lower-case
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3104 equivalent. The element @var{upcase} maps each character to its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3105 upper-case equivalent. If lower and upper case characters are in 1-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3106 correspondence, use @code{nil} for @var{upcase}; then Emacs deduces the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3107 upcase table from @var{downcase}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3109 For some languages, upper and lower case letters are not in 1-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3110 correspondence. There may be two different lower case letters with the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3111 same upper case equivalent. In these cases, you need to specify the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3112 maps for both directions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3114 The element @var{canonicalize} maps each character to a canonical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3115 equivalent; any two characters that are related by case-conversion have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3116 the same canonical equivalent character.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3118 The element @var{equivalences} is a map that cyclicly permutes each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3119 equivalence class (of characters with the same canonical equivalent).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3121 You can provide @code{nil} for both @var{canonicalize} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3122 @var{equivalences}, in which case both are deduced from @var{downcase}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3123 and @var{upcase}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3125 Here are the functions for working with case tables:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3127 @code{case-table-p} is a predicate that says whether a Lisp object is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3128 valid case table.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3130 @code{set-standard-case-table} takes one argument and makes that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3131 argument the case table for new buffers created subsequently.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3132 @code{standard-case-table} returns the current value of the new buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3133 case table.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3135 @code{current-case-table} returns the case table of the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3136 @code{set-case-table} sets the current buffer's case table to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3137 argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3139 @code{set-case-syntax-pair} is a convenient function for specifying a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3140 pair of letters, upper case and lower case. Call it with two arguments,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3141 the upper case letter and the lower case letter. It modifies the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3142 standard case table and a few syntax tables that are predefined in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3143 Emacs. This function is intended as a subroutine for packages that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3144 define non-ASCII character sets.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3145
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3146 Load the library @file{iso-syntax} to set up the syntax and case table for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3147 the 256 bit ISO Latin 1 character set.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3149 @section New Features for Dealing with Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3151 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3152 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3153 The new function @code{buffer-modified-tick} returns a buffer's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3154 modification-count that ticks every time the buffer is modified. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3155 takes one optional argument, which is the buffer you want to examine.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3156 If the argument is @code{nil} (or omitted), the current buffer is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3158 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3159 @code{buffer-disable-undo} is a new name for the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3160 formerly known as @code{buffer-flush-undo}. This turns off recording
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3161 of undo information in the buffer given as argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3163 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3164 The new function @code{generate-new-buffer-name} chooses a name that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3165 would be unique for a new buffer---but does not create the buffer. Give
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3166 it one argument, a starting name. It produces a name not in use for a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3167 buffer by appending a number inside of @samp{<@dots{}>}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3169 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3170 The function @code{rename-buffer} now takes an optional second argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3171 which tells it that if the specified new name corresponds to an existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3172 buffer, it should use @code{generate-new-buffer-name} to modify the name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3173 to be unique, rather than signaling an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3175 @code{rename-buffer} now returns the name to which the buffer was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3176 renamed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3178 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3179 The function @code{list-buffers} now looks at the local variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3180 @code{list-buffers-directory} in each non-file-visiting buffer, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3181 shows its value where the file would normally go. Dired sets this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3182 variable in each Dired buffer, so the buffer list now shows which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3183 directory each Dired buffer is editing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3184
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3185 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3186 The function @code{other-buffer} now takes an optional second argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3187 @var{visible-ok} which, if non-@code{nil}, indicates that buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3188 currently being displayed in windows may be returned even if there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3189 other buffers not visible. Normally, @code{other-buffer} returns a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3190 currently visible buffer only as a last resort, if there are no suitable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3191 invisible buffers.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3193 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3194 The hook @code{kill-buffer-hook} now runs whenever a buffer is killed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3195 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3197 @section Local Variables Features
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3199 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3200 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3201 If a local variable name has a non-@code{nil} @code{permanent-local}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3202 property, then @code{kill-all-local-variables} does not kill it. Such
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3203 local variables are ``permanent''---they remain unchanged even if you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3204 select a different major mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3206 Permanent locals are useful when they have to do with where the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3207 came from or how to save it, rather than with how to edit the contents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3209 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3210 The function @code{make-local-variable} now never changes the value of the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3211 that it makes local. If the variable had no value before, it still has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3212 no value after becoming local.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3214 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3215 The new function @code{default-boundp} tells you whether a variable has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3216 a default value (as opposed to being unbound in its default value). If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3217 @code{(default-boundp 'foo)} returns @code{nil}, then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3218 @code{(default-value 'foo)} would get an error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3220 @code{default-boundp} is to @code{default-value} as @code{boundp} is to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3221 @code{symbol-value}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3223 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3224 The special forms @code{defconst} and @code{defvar}, when the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3225 is local in the current buffer, now set the variable's default value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3226 rather than its local value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3227 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3229 @section New Features for Subprocesses
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3230
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3231 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3232 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3233 @code{call-process} and @code{call-process-region} now return a value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3234 that indicates how the synchronous subprocess terminated. It is either
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3235 a number, which is the exit status of a process, or a signal name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3236 represented as a string.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3238 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3239 @code{process-status} now returns @code{open} and @code{closed} as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3240 status values for network connections.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3241
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3242 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3243 The standard asynchronous subprocess features work on VMS now,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3244 and the special VMS asynchronous subprocess functions have been deleted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3246 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3247 You can use the transaction queue feature for more convenient
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3248 communication with subprocesses using transactions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3249
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3250 Call @code{tq-create} to create a transaction queue communicating with a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3251 specified process. Then you can call @code{tq-enqueue} to send a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3252 transaction. @code{tq-enqueue} takes these five arguments:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3254 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3255 (tq-enqueue @var{tq} @var{question} @var{regexp} @var{closure} @var{fn})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3256 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3257
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3258 @var{tq} is the queue to use. (Specifying the queue has the effect of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3259 specifying the process to talk to.) The argument @var{question} is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3260 outgoing message which starts the transaction. The argument @var{fn} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3261 the function to call when the corresponding answer comes back; it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3262 called with two arguments: @var{closure}, and the answer received.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3264 The argument @var{regexp} is a regular expression to match the entire
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3265 answer; that's how @code{tq-enqueue} tells where the answer ends.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3266
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3267 Call @code{tq-close} to shut down a transaction queue and terminate its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3268 subprocess.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3270 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3271 The function @code{signal-process} sends a signal to process @var{pid},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3272 which need not be a child of Emacs. The second argument @var{signal}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3273 specifies which signal to send; it should be an integer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3274 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3275
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3276 @section New Features for Dealing with Times And Time Delays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3278 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3279 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3280 The new function @code{current-time} returns the system's time value as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3281 a list of three integers: @code{(@var{high} @var{low} @var{microsec})}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3282 The integers @var{high} and @var{low} combine to give the number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3283 seconds since 0:00 January 1, 1970, which is @var{high} * 2**16 +
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3284 @var{low}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3285
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3286 @var{microsec} gives the microseconds since the start of the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3287 second (or 0 for systems that return time only on the resolution of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3288 second).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3290 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3291 The function @code{current-time-string} accepts an optional argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3292 @var{time-value}. If given, this specifies a time to format instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3293 the current time. The argument should be a cons cell containing two
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3294 integers, or a list whose first two elements are integers. Thus, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3295 can use times obtained from @code{current-time} (see above) and from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3296 @code{file-attributes}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3297
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3298 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3299 You can now find out the user's time zone using @code{current-time-zone}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3301 The value has the form @code{(@var{OFFSET} @var{name})}. Here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3302 @var{offset} is an integer giving the number of seconds ahead of UTC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3303 (east of Greenwich). A negative value means west of Greenwich. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3304 second element, @var{name} is a string giving the name of the time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3305 zone. Both elements change when daylight savings time begins or ends;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3306 if the user has specified a time zone that does not use a seasonal time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3307 adjustment, then the value is constant through time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3308
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3309 If the operating system doesn't supply all the information necessary to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3310 compute the value, both elements of the list are @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3312 The optional argument @var{time-value}, if given, specifies a time to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3313 analyze instead of the current time. The argument should be a cons cell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3314 containing two integers, or a list whose first two elements are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3315 integers. Thus, you can use times obtained from @code{current-time} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3316 from @code{file-attributes}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3317
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3318 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3319 @code{sit-for}, @code{sleep-for} now let you specify the time period in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3320 milliseconds as well as in seconds. The first argument gives the number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3321 of seconds, as before, and the optional second argument gives additional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3322 milliseconds. The time periods specified by these two arguments are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3323 added together.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3325 Not all systems support this; you get an error if you specify nonzero
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3326 milliseconds and it isn't supported.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3328 @code{sit-for} also accepts an optional third argument @var{nodisp}. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3329 this is non-@code{nil}, @code{sit-for} does not redisplay. It still
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3330 waits for the specified time or until input is available.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3331
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3332 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3333 @code{accept-process-output} now accepts a timeout specified by optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3334 second and third arguments. The second argument specifies the number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3335 seconds, while the third specifies the number of milliseconds. The time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3336 periods specified by these two arguments are added together.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3338 Not all systems support this; you get an error if you specify nonzero
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3339 milliseconds and it isn't supported.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3340
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3341 The function returns @code{nil} if the timeout expired before output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3342 arrived, or non-@code{nil} if it did get some output.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3344 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3345 You can set up a timer to call a function at a specified future time.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3346 To do so, call @code{run-at-time}, like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3348 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3349 (run-at-time @var{time} @var{repeat} @var{function} @var{args}@dots{})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3350 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3352 Here, @var{time} is a string saying when to call the function. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3353 argument @var{function} is the function to call later, and @var{args}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3354 are the arguments to give it when it is called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3356 The argument @var{repeat} specifies how often to repeat the call. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3357 @var{repeat} is @code{nil}, there are no repetitions; @var{function} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3358 called just once, at @var{time}. If @var{repeat} is an integer, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3359 specifies a repetition period measured in seconds.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3360
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3361 Absolute times may be specified in a wide variety of formats; The form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3362 @samp{@var{hour}:@var{min}:@var{sec} @var{timezone}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3363 @var{month}/@var{day}/@var{year}}, where all fields are numbers, works;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3364 the format that @code{current-time-string} returns is also allowed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3366 To specify a relative time, use numbers followed by units.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3367 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3369 @table @samp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3370 @item 1 min
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3371 denotes 1 minute from now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3372 @item 1 min 5 sec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3373 denotes 65 seconds from now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3374 @item 1 min 2 sec 3 hour 4 day 5 week 6 fortnight 7 month 8 year
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3375 denotes exactly 103 months, 123 days, and 10862 seconds from now.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3376 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3378 If @var{time} is an integer, that specifies a relative time measured in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3379 seconds.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3380 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3381
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3382 To cancel the requested future action, pass the value that @code{run-at-time}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3383 returned to the function @code{cancel-timer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3385 @section Profiling Lisp Programs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3387 You can now make execution-time profiles of Emacs Lisp programs using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3388 the @file{profile} library. See the file @file{profile.el} for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3389 instructions; if you have written a Lisp program big enough to be worth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3390 profiling, you can surely understand them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3392 @section New Features for Lisp Debuggers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3394 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3395 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3396 You can now specify which kinds of errors should invoke the Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3397 debugger by setting the variable @code{debug-on-error} to a list of error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3398 conditions. For example, if you set it to the list @code{(void-variable)},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3399 then only errors about a variable that has no value invoke the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3400 debugger.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3402 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3403 The variable @code{command-debug-status} is used by Lisp debuggers. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3404 records the debugging status of current interactive command. Each time
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3405 a command is called interactively, this variable is bound to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3406 @code{nil}. The debugger can set this variable to leave information for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3407 future debugger invocations during the same command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3409 The advantage of this variable over some other variable in the debugger
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3410 itself is that the data will not be visible for any other command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3411 invocation.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3412
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3413 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3414 The function @code{backtrace-frame} is intended for use in Lisp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3415 debuggers. It returns information about what a frame on the Lisp call
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3416 stack is doing. You specify one argument, which is the number of stack
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3417 frames to count up from the current execution point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3419 If that stack frame has not evaluated the arguments yet (or is a special
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3420 form), the value is @code{(nil @var{function} @var{arg-forms}@dots{})}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3422 If that stack frame has evaluated its arguments and called its function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3423 already, the value is @code{(t @var{function}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3424 @var{arg-values}@dots{})}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3425
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3426 In the return value, @var{function} is whatever was supplied as @sc{car}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3427 of evaluated list, or a @code{lambda} expression in the case of a macro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3428 call. If the function has a @code{&rest} argument, that is represented
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3429 as the tail of the list @var{arg-values}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3430
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3431 If the argument is out of range, @code{backtrace-frame} returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3432 @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3433 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3434
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3435 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3437 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3438 @code{kill-ring-save} now gives visual feedback to indicate the region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3439 of text being added to the kill ring. If the opposite end of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3440 region is visible in the current window, the cursor blinks there.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3441 Otherwise, some text from the other end of the region is displayed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3442 the message area.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3443 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3444
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3445 @section Memory Allocation Changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3446
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3447 The list that @code{garbage-collect} returns now has one additional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3448 element. This is a cons cell containing two numbers. It gives
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3449 information about the number of used and free floating point numbers,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3450 much as the first element gives such information about the number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3451 used and free cons cells.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3453 The new function @code{memory-limit} returns an indication of the last
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3454 address allocated by Emacs. More precisely, it returns that address
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3455 divided by 1024. You can use this to get a general idea of how your
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3456 actions affect the memory usage.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3458 @section Hook Changes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3459
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3460 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3461 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3462 Expanding an abbrev first runs the new hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3463 @code{pre-abbrev-expand-hook}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3464
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3465 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3466 The editor command loop runs the normal hook @code{pre-command-hook}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3467 before each command, and runs @code{post-command-hook} after each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3468 command.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3470 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3471 Auto-saving runs the new hook @code{auto-save-hook} before actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3472 starting to save any files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3474 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3475 The new variable @code{revert-buffer-insert-file-contents-function}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3476 holds a function that @code{revert-buffer} now uses to read in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3477 contents of the reverted buffer---instead of calling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3478 @code{insert-file-contents}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3480 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3481 The variable @code{lisp-indent-hook} has been renamed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3482 @code{lisp-indent-function}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3484 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3485 The variable @code{auto-fill-hook} has been renamed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3486 @code{auto-fill-function}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3487
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3488 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3489 The variable @code{blink-paren-hook} has been renamed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3490 @code{blink-paren-function}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3492 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3493 The variable @code{temp-buffer-show-hook} has been renamed to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3494 @code{temp-buffer-show-function}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3495
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3496 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3497 The variable @code{suspend-hook} is now a normal hook.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3498 It used to be a special kind of hook; its value had to be a single
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3499 function, and if the function returned a non-@code{nil} value,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3500 then suspension was inhibited.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3501
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3502 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3503 The new function @code{add-hook} provides a handy way to add a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3504 to a hook variable. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3505
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3506 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3507 (add-hook 'text-mode-hook 'my-text-hook-function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3508 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3510 @noindent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3511 arranges to call @code{my-text-hook-function}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3512 when entering Text mode or related modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3514 @code{add-hook} takes an optional third argument which says to add the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3515 new hook function at the end of the list (normally, it goes at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3516 beginning).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3517 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3518
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3519 @bye