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