@setfilename LNEWS@section New Features in the Lisp Language@end itemize@itemize @bullet@itemThe new function @code{delete} is a traditional Lisp function. It takestwo arguments, @var{elt} and @var{list}, and deletes from @var{list} anyelements that are equal to @var{elt}. It uses the function @code{equal}to compare elements with @var{elt}.@itemThe new function @code{member} is a traditional Lisp function. It takestwo arguments, @var{elt} and @var{list}, and finds the first element of@var{list} that is equal to @var{elt}. It uses the function@code{equal} to compare each list element with @var{elt}.The value is a sublist of @var{list}, whose first element is the onethat was found. If no matching element is found, the value is@code{nil}.@ignore @c Seems not to be true, from looking at the code.@itemThe function @code{equal} is now more robust: it does not crash due tocircular list structure.@end ignore@itemThe new function @code{indirect-function} finds the effective functiondefinition of an object called as a function. If the object is asymbol, @code{indirect-function} looks in the function definition of thesymbol. It keeps doing this until it finds something that is not asymbol.@itemThere are new escape sequences for use in character and stringconstants. The escape sequence @samp{\a} is equivalent to @samp{\C-g},the @sc{ASCII} @sc{BEL} character (code 7). The escape sequence@samp{\x} followed by a hexidecimal number represents the characterwhose @sc{ASCII} code is that number. There is no limit on the numberof digits in the hexidecimal value.@itemThe function @code{read} when reading from a buffer now does not skip aterminator character that terminates a symbol. It leaves that characterto be read (or just skipped, if it is whitespace) next time.@itemWhen you use a function @var{function} as the input stream for@code{read}, it is usually called with no arguments, and should returnthe next character. In Emacs 19, sometimes @var{function} is calledwith one argument (always a character). When that happens,@var{function} should save the argument and arrange to return it whencalled next time.@item@code{random} with integer argument @var{n} returns a random numberbetween 0 and @var{n}@minus{}1.@itemThe functions @code{documentation} and @code{documentation-property} nowtake an additional optional argument which, if non-@code{nil}, says torefrain from calling @code{substitute-command-keys}. This way, you getthe exact text of the documentation string as written, without the usualsubstitutions. Make sure to call @code{substitute-command-keys}yourself if you decide to display the string.@ignore@itemThe new function @code{invocation-name} returns as a string the programname that was used to run Emacs, with any directory names discarded.@c ??? This hasn't been written yet. ???@end ignore@itemThe new function @code{map-y-or-n-p} makes it convenient to ask a seriesof similar questions. The arguments are @var{prompter}, @var{actor},@var{list}, and optional @var{help}.The value of @var{list} is a list of objects, or a function of noarguments to return either the next object or @code{nil} meaning thereare no more.The argument @var{prompter} specifies how to ask each question. If@var{prompter} is a string, the question text is computed like this:@example(format @var{prompter} @var{object})@end example@noindentwhere @var{object} is the next object to ask about.If not a string, @var{prompter} should be a function of one argument(the next object to ask about) and should return the question text.The argument @var{actor} should be a function of one argument, which iscalled with each object that the user says yes for. Its argument isalways one object from @var{list}.If @var{help} is given, it is a list @code{(@var{object} @var{objects}@var{action})}, where @var{object} is a string containing a singularnoun that describes the objects conceptually being acted on;@var{objects} is the corresponding plural noun and @var{action} is atransitive verb describing @var{actor}. The default is @code{("object""objects" "act on")}.Each time a question is asked, the user may enter @kbd{y}, @kbd{Y}, or@key{SPC} to act on that object; @kbd{n}, @kbd{N}, or @key{DEL} to skipthat object; @kbd{!} to act on all following objects; @key{ESC} or@kbd{q} to exit (skip all following objects); @kbd{.} (period) to act onthe current object and then exit; or @kbd{C-h} to get help.@code{map-y-or-n-p} returns the number of objects acted on.@itemYou can now ``set'' environment variables with the @code{setenv}command. This works by setting the variable @code{process-environment},which @code{getenv} now examines in preference to the environment Emacsreceived from its parent.@end itemize@section New Features for Loading LibrariesYou can now arrange to run a hook if a particular Lisp library isloaded.The variable @code{after-load-alist} is an alist of expressions to beevalled when particular files are loaded. Each element looks like@code{(@var{filename} @var{forms}@dots{})}.When @code{load} is run and the file name argument equals@var{filename}, the @var{forms} in the corresponding element areexecuted at the end of loading. @var{filename} must match exactly!Normally @var{filename} is the name of a library, with no directoryspecified, since that is how @code{load} is normally called.An error in @var{forms} does not undo the load, but does preventexecution of the rest of the @var{forms}.The function @code{eval-after-load} provides a convenient way to addentries to the alist. Call it with two arguments, @var{file} and aform to execute.The function @code{autoload} now supports autoloading a keymap.Use @code{keymap} as the fourth argument if the autoloaded functionwill become a keymap when loaded.There is a new feature for specifying which functions in a library shouldbe autoloaded by writing special ``magic'' comments in that library itself. Write @samp{;;;###autoload} on a line by itself before a functiondefinition before the real definition of the function, in itsautoloadable source file; then the command @kbd{M-xupdate-file-autoloads} automatically puts the @code{autoload} call into@file{loaddefs.el}. You can also put other kinds of forms into @file{loaddefs.el}, bywriting @samp{;;;###autoload} followed on the same line by the form.@kbd{M-x update-file-autoloads} copies the form from that line.@section Compilation Features@itemize @bullet@itemInline functions.You can define an @dfn{inline function} with @code{defsubst}. Use@code{defsubst} just like @code{defun}, and it defines a function whichyou can call in all the usual ways. Whenever the function thus definedis used in compiled code, the compiler will open code it.You can get somewhat the same effects with a macro, but a macro has thelimitation that you can use it only explicitly; a macro cannot be calledwith @code{apply}, @code{mapcar} and so on. Also, it takes some work toconvert an ordinary function into a macro. To convert it into an inlinefunction, simply replace @code{defun} with @code{defsubst}.Making a function inline makes explicit calls run faster. But it alsohas disadvantages. For one thing, it reduces flexibility; if you changethe definition of the function, calls already inlined still use the olddefinition until you recompile them.Another disadvantage is that making a large function inline can increasethe size of compiled code both in files and in memory. Since theadvantages of inline functions are greatest for small functions, yougenerally should not make large functions inline.Inline functions can be used and open coded later on in the same file,following the definition, just like macros.@itemThe command @code{byte-compile-file} now offers to save any buffervisiting the file you are compiling.@itemThe new command @code{compile-defun} reads, compiles and executes thedefun containing point. If you use this on a defun that is actually afunction definition, the effect is to install a compiled version ofthat function.@itemWhenever you load a Lisp file or library, you now receive a warning ifthe directory contains both a @samp{.el} file and a @samp{.elc} file,and the @samp{.el} file is newer. This typically indicates that someonehas updated the Lisp code but forgotten to recompile it, so the changesdo not take effect. The warning is a reminder to recompile.@itemThe special form @code{eval-when-compile} marks the forms it contains tobe evaluated at compile time @emph{only}. At top-level, this isanalogous to the Common Lisp idiom @code{(eval-when (compile)@dots{})}. Elsewhere, it is similar to the Common Lisp @samp{#.} readermacro (but not when interpreting).If you're thinking of using this feature, we recommend you consider whether@code{provide} and @code{require} might do the job as well.@itemThe special form @code{eval-and-compile} is similar to@code{eval-when-compile}, but the whole form is evaluated both atcompile time and at run time.If you're thinking of using this feature, we recommend you considerwhether @code{provide} and @code{require} might do the job as well.@itemEmacs Lisp has a new data type for byte-code functions. This makesthem faster to call, and also saves space. Internally, a byte-codefunction object is much like a vector; however, the evaluator handlesthis data type specially when it appears as a function to be called.The printed representation for a byte-code function object is like thatfor a vector, except that it starts with @samp{#} before the opening@samp{[}. A byte-code function object must have at least four elements;there is no maximum number, but only the first six elements are actuallyused. They are:@table @var@item arglistThe list of argument symbols.@item byte-codeThe string containing the byte-code instructions.@item constantsThe vector of constants referenced by the byte code.@item stacksizeThe maximum stack size this function needs.@item docstringThe documentation string (if any); otherwise, @code{nil}.@item interactiveThe interactive spec (if any). This can be a string or a Lispexpression. It is @code{nil} for a function that isn't interactive.@end tableThe predicate @code{byte-code-function-p} tests whether a given objectis a byte-code function.You can create a byte-code function object in a Lisp programwith the function @code{make-byte-code}. Its arguments are the elementsto put in the byte-code function object.You should not try to come up with the elements for a byte-code functionyourself, because if they are inconsistent, Emacs may crash when youcall the function. Always leave it to the byte compiler to create theseobjects; it, we hope, always makes the elements consistent.@end itemize@section Floating Point NumbersYou can now use floating point numbers in Emacs, if you define the macro@code{LISP_FLOAT_TYPE} when you compile Emacs.The printed representation for floating point numbers requires either adecimal point surrounded by digits, or an exponent, or both. Forexample, @samp{1500.0}, @samp{15e2}, @samp{15.0e2} and @samp{1.5e3} arefour ways of writing a floating point number whose value is 1500.The existing predicate @code{numberp} now returns @code{t} if theargument is any kind of number---either integer or floating. The newpredicates @code{integerp} and @code{floatp} check for specific types ofnumbers.You can do arithmetic on floating point numbers with the ordinaryarithmetic functions, @code{+}, @code{-}, @code{*} and @code{/}. If youcall one of these functions with both integers and floating pointnumbers among the arguments, the arithmetic is done in floating point.The same applies to the numeric comparison functions such as @code{=}and @code{<}. The remainder function @code{%} does not accept floatingpoint arguments, and neither do the bitwise boolean operations such as@code{logand} or the shift functions such as @code{ash}.There is a new arithmetic function, @code{abs}, which returns the absolutevalue of its argument. It handles both integers and floating pointnumbers.To convert an integer to floating point, use the function @code{float}.There are four functions to convert floating point numbers to integers;they differ in how they round. @code{truncate} rounds toward 0,@code{floor} rounds down, @code{ceil} rounds up, and @code{round}produces the nearest integer.You can use @code{logb} to extract the binary exponent of a floatingpoint number. More precisely, it is the logarithm base 2, rounded downto an integer.Emacs has several new mathematical functions that accept any kind ofnumber as argument, but always return floating point numbers.@table @code@item cos@findex cos@itemx sin@findex sin@itemx tan@findex tanTrigonometric functions.@item acos@findex acos@itemx asin@findex asin@itemx atan@findex atanInverse trigonometric functions.@item exp@findex expThe exponential function (power of @var{e}).@item log@findex logLogarithm base @var{e}.@item expm1@findex expm1Power of @var{e}, minus 1.@item log1p@findex log1pAdd 1, then take the logarithm.@item log10@findex log10Logarithm base 10@item expt@findex exptRaise @var{x} to power @var{y}.@item sqrt@findex sqrtThe square root function.@end tableThe new function @code{string-to-number} now parses a string containingeither an integer or a floating point number, returning the number.The @code{format} function now handles the specifications @samp{%e},@samp{%f} and @samp{%g} for printing floating point numbers; likewise@code{message}.The new variable @code{float-output-format} controls how Lisp printsfloating point numbers. Its value should be @code{nil} or a string.If it is a string, it should contain a @samp{%}-spec like those acceptedby @code{printf} in C, but with some restrictions. It must start withthe two characters @samp{%.}. After that comes an integer which is theprecision specification, and then a letter which controls the format.The letters allowed are @samp{e}, @samp{f} and @samp{g}. Use @samp{e}for exponential notation (@samp{@var{dig}.@var{digits}e@var{expt}}).Use @samp{f} for decimal point notation(@samp{@var{digits}.@var{digits}}). Use @samp{g} to choose the shorterof those two formats for the number at hand.The precision in any of these cases is the number of digits followingthe decimal point. With @samp{f}, a precision of 0 means to omit thedecimal point. 0 is not allowed with @samp{f} or @samp{g}.A value of @code{nil} means to use the format @samp{%.20g}.No matter what the value of @code{float-output-format}, printing ensuresthat the result fits the syntax rules for a floating point number. Ifit doesn't fit (for example, if it looks like an integer), it ismodified to fit. By contrast, the @code{format} function formatsfloating point numbers without requiring the output to fit thesyntax rules for floating point number.@section New Features for Printing And Formatting Output@itemize @bullet@itemThe @code{format} function has a new feature: @samp{%S}. This printspec prints any kind of Lisp object, even a string, using its Lispprinted representation.By contrast, @samp{%s} prints everything without quotation.@item@code{prin1-to-string} now takes an optional second argument which saysnot to print the Lisp quotation characters. (In other words, to use@code{princ} instead of @code{prin1}.)@itemThe new variable @code{print-level} specifies the maximum depth of listnesting to print before cutting off all deeper structure. A value of@code{nil} means no limit.@end itemize@section Changes in Basic Editing Functions@itemize @bullet@itemThere are two new primitives for putting text in the kill ring:@code{kill-new} and @code{kill-append}.The function @code{kill-new} adds a string to the front of the kill ring.Use @code{kill-append} to add a string to a previous kill. The secondargument @var{before-p}, if non-@code{nil}, says to add the string atthe beginning; otherwise, it goes at the end.Both of these functions apply @code{interprogram-cut-function} to theentire string of killed text that ends up at the beginning of the killring.@itemThe new function @code{current-kill} rotates the yanking pointer in thekill ring by @var{n} places, and returns the text at that place in thering. If the optional second argument @var{do-not-move} isnon-@code{nil}, it doesn't actually move the yanking point; it justreturns the @var{n}th kill forward. If @var{n} is zero, indicating arequest for the latest kill, @code{current-kill} calls@code{interprogram-paste-function} (documented below) before consultingthe kill ring.All Emacs Lisp programs should either use @code{current-kill},@code{kill-new}, and @code{kill-append} to manipulate the kill ring, orbe sure to call @code{interprogram-paste-function} and@code{interprogram-cut-function} as appropriate.@itemThe variables @code{interprogram-paste-function} and@code{interprogram-cut-function} exist so that you can provide functionsto transfer killed text to and from other programs.@itemThe @code{kill-region} function can now be used in read-only buffers.It beeps, but adds the region to the kill ring without deleting it.@itemThe new function @code{compare-buffer-substrings} lets you compare twosubstrings of the same buffer or two different buffers. Its argumentslook like this:@example(compare-buffer-substrings @var{buf1} @var{beg1} @var{end1} @var{buf2} @var{beg2} @var{end2})@end exampleThe first three arguments specify one substring, giving a buffer and twopositions within the buffer. The last three arguments specify the othersubstring in the same way.The value is negative if the first substring is less, positive if thefirst is greater, and zero if they are equal. The absolute value ofthe result is one plus the index of the first different characters.@itemOverwrite mode treats tab and newline characters specially. You can nowturn off this special treatment by setting @code{overwrite-binary-mode}to @code{t}.@itemOnce the mark ``exists'' in a buffer, it normally never ceases toexist. However, it may become @dfn{inactive}. The variable@code{mark-active}, which is always local in all buffers, indicateswhether the mark is active: non-@code{nil} means yes.A command can request deactivation of the mark upon return to the editorcommand loop by setting @code{deactivate-mark} to a non-@code{nil}value. Transient Mark mode works by causing the buffer modificationprimitives to set @code{deactivate-mark}.The variables @code{activate-mark-hook} and @code{deactivate-mark-hook}are normal hooks run, respectively, when the mark becomes active andwhenit becomes inactive. The hook @code{activate-mark-hook} is also run atthe end of a command if the mark is active and the region may havechanged.@itemThe function @code{move-to-column} now accepts a second optionalargument @var{force}, in addition to @var{column}; if the requestedcolumn @var{column} is in the middle of a tab character and @var{force}is non-@code{nil}, @code{move-to-column} replaces the tab with theappropriate sequence of spaces so that it can place point exactly at@var{column}.@itemThe search functions when successful now return the value of pointrather than just @code{t}. This affects the functions@code{search-forward}, @code{search-backward},@code{word-search-forward}, @code{word-search-backward},@code{re-search-forward}, and @code{re-search-backward}.@itemWhen you do regular expression searching or matching, there is no longera limit to how many @samp{\(@dots{}\)} pairs you can get informationabout with @code{match-beginning} and @code{match-end}. Also, theseparenthetical groupings may now be nested to any degree.@itemThe new special form @code{save-match-data} preserves the regularexpression match status. Usage: @code{(save-match-data@var{body}@dots{})}.@itemThe function @code{translate-region} applies a translation table to thecharacters in a part of the buffer. Invoke it as@code{(translate-region @var{start} @var{end} @var{table})}; @var{start}and @var{end} bound the region to translate.The translation table @var{table} is a string; @code{(aref @var{table}@var{ochar})} gives the translated character corresponding to@var{ochar}. If the length of @var{table} is less than 256, anycharacters with codes larger than the length of @var{table} are notaltered by the translation.@code{translate-region} returns the number of characters which wereactually changed by the translation. This does not count characterswhich were mapped into themselves in the translation table.@itemThere are two new hook variables that let you notice all changes in allbuffers (or in a particular buffer, if you make them buffer-local):@code{before-change-function} and @code{after-change-function}.If @code{before-change-function} is non-@code{nil}, then it is calledbefore any buffer modification. Its arguments are the beginning and endof the region that is going to change, represented as integers. Thebuffer that's about to change is always the current buffer.If @code{after-change-function} is non-@code{nil}, then it is calledafter any buffer modification. It takes three arguments: the beginningand end of the region just changed, and the length of the text thatexisted before the change. (To get the current length, subtract therrgion beginning from the region end.) All three arguments areintegers. The buffer that's about to change is always the currentbuffer.Both of these variables are temporarily bound to @code{nil} during thetime that either of these hooks is running. This means that if one ofthese functions changes the buffer, that change won't run thesefunctions. If you do want hooks to be run recursively, write your hookfunctions to bind these variables back to their usual values.@itemThe hook @code{first-change-hook} is run using @code{run-hooks} whenevera buffer is changed that was previously in the unmodified state.@itemThe second argument to @code{insert-abbrev-table-description} isnow optional.@end itemize@section Text Properties Each character in a buffer or a string can have a @dfn{text propertylist}, much like the property list of a symbol. The properties belongto a particular character at a particular place, such as, the letter@samp{T} at the beginning of this sentence. Each property has a name,which is usually a symbol, and an associated value, which can be anyLisp object---just as for properties of symbols (@pxref{Property Lists}). You can use the property @code{face-code} to control the font andcolor of text. That is the only property name which currently has aspecial meaning, but you can create properties of any name and examinethem later for your own purposes. Copying text between strings and buffers preserves the propertiesalong with the characters; this includes such diverse functions as@code{substring}, @code{insert}, and @code{buffer-substring}. Since text properties are considered part of the buffer contents,changing properties in a buffer ``modifies'' the buffer, and you canalso undo such changes. Strings with text properties have a special printed representationwhich describes all the properties. This representation is also theread syntax for such a string. It looks like this:@example#("@var{characters}" @var{property-data}...)@end example@noindentwhere @var{property-data} is zero or more elements in groups of three asfollows:@example@var{beg} @var{end} @var{plist}@end example@noindentThe elements @var{beg} and @var{end} are integers, and together specifya portion of the string; @var{plist} is the property list for thatportion.@subsection Examining Text Properties The simplest way to examine text properties is to ask for the value ofa particular property of a particular character. For that, use@code{get-text-property}. Use @code{text-properties-at} to get theentire property list of a character. @xref{Property Search}, forfunctions to examine the properties of a number of characters at once.@code{(get-text-property @var{pos} @var{prop} @var{object})} returns the@var{prop} property of the character after @var{pos} in @var{object} (abuffer or string). The argument @var{object} is optional and defaultsto the current buffer.@code{(text-properties-at @var{pos} @var{object})} returns the entireproperty list of the character after @var{pos} in the string or buffer@var{object} (which defaults to the current buffer).@subsection Changing Text Properties There are three primitives for changing properties of a specifiedrange of text:@table @code@item add-text-propertiesThis function puts on specified properties, leaving other existingproperties unaltered.@item put-text-propertyThis function puts on a single specified property, leaving othersunaltered.@item remove-text-propertiesThis function removes specified properties, leaving otherproperties unaltered.@item set-text-propertiesThis function replaces the entire property list, leaving no vessage ofthe properties that that text used to have.@end tableAll these functions take four arguments: @var{start}, @var{end},@var{props}, and @var{object}. The last argument is optional anddefaults to the current buffer. The argument @var{props} has the formof a property list.@subsection Property Search FunctionsIn typical use of text properties, most of the time several or manyconsecutive characters have the same value for a property. Rather thanwriting your programs to examine characters one by one, it is muchfaster to process chunks of text that have the same property value.The functions @code{next-property-change} and@code{previous-property-change} scan forward or backward from position@var{pos} in @var{object}, looking for a change in any property betweentwo characters scanned. They returns the position between those twocharacters, or @code{nil} if no change is found.The functions @code{next-single-property-change} and@code{previous-single-property-change} are similar except that youspecify a particular property and they look for changes in the value ofthat property only. The property is the second argument, and@var{object} is third.@subsection Special Properties If a character has a @code{category} property, we call it the@dfn{category} of the character. It should be a symbol. The propertiesof the symbol serve as defaults for the properties of the character. You can use the property @code{face-code} to control the font andcolor of text. That is the only property name which currently has aspecial meaning, but you can create properties of any name and examinethem later for your own purposes.about face codes. You can specify a different keymap for a portion of the text by meansof a @code{local-map} property. The property's value, for the characterafter point, replaces the buffer's local map. If a character has the property @code{read-only}, then modifying thatcharacter is not allowed. Any command that would do so gets an error. If a character has the property @code{modification-hooks}, then itsvalue should be a list of functions; modifying that character calls allof those functions. Each function receives two arguments: the beginningand end of the part of the buffer being modified. Note that if aparticular modification hook function appears on several charactersbeing modified by a single primitive, you can't predict how many timesthe function will be called. Insertion of text does not, strictly speaking, change any existingcharacter, so there is a special rule for insertion. It compares the@code{read-only} properties of the two surrounding characters; if theyare @code{eq}, then the insertion is not allowed. Assuming insertion isallowed, it then gets the @code{modification-hooks} properties of thosecharacters and calls all the functions in each of them. (If a functionappears on both characters, it may be called once or twice.) The special properties @code{point-entered} and @code{point-left}record hook functions that report motion of point. Each time pointmoves, Emacs compares these two property values:@itemize @bullet@itemthe @code{point-left} property of the character after the old location,and@itemthe @code{point-entered} property of the character after the newlocation.@end itemize@noindentIf these two values differ, each of them is called (if not @code{nil})with two arguments: the old value of point, and the new one. The same comparison is made for the characters before the old and newlocations. The result may be to execute two @code{point-left} functions(which may be the same function) and/or two @code{point-entered}functions (which may be the same function). The @code{point-left}functions are always called before the @code{point-entered} functions. A primitive function may examine characters at various positionswithout moving point to those positions. Only an actual change in thevalue of point runs these hook functions.@section New Features for Files@itemize @bullet@itemThe new function @code{file-accessible-directory-p} tells you whetheryou can open files in a particular directory. Specify as an argumenteither a directory name or a file name which names a directory file.The function returns @code{t} if you can open existing files in thatdirectory.@itemThe new function @code{file-executable-p} returns @code{t} if itsargument is the name of a file you have permission to execute.@itemThe function @code{file-truename} returns the ``true name'' of aspecified file. This is the name that you get by following symboliclinks until none remain. The argument must be an absolute file name.@itemNew functions @code{make-directory} and @code{delete-directory} create anddelete directories. They both take one argument, which is the name ofthe directory as a file.@itemThe function @code{read-file-name} now takes an additional argumentwhich specifies an initial file name. If you specify this argument,@code{read-file-name} inserts it along with the directory name. It putsthe cursor between the directory and the initial file name.The user can then use the initial file name unchanged, modify it, orsimply kill it with @kbd{C-k}.If the variable @code{insert-default-directory} is @code{nil}, then thedefault directory is not inserted, and the new argument is ignored.@itemThe function @code{file-relative-name} does the inverse ofexpansion---it tries to return a relative name which is equivalent to@var{filename} when interpreted relative to @var{directory}. (If such arelative name would be longer than the absolute name, it returns theabsolute name instead.)@itemThe function @code{file-newest-backup} returns the name of the mostrecent backup file for @var{filename}, or @code{nil} that file has nobackup files.@itemThe list returned by @code{file-attributes} now has 12 elements. The12th element is the file system number of the file system that the fileis in. This element together with the file's inode number, which is the11th element, give enough information to distinguish any two files onthe system---no two files can have the same values for both of thesenumbers.@itemThe new function @code{set-visited-file-modtime} updates the currentbuffer's recorded modification time from the visited file's time.This is useful if the buffer was not read from the file normally, orif the file itself has been changed for some known benign reason.If you give the function an argument, that argument specifies the newvalue for the recorded modification time. The argument should be a listof the form @code{(@var{high} . @var{low})} or @code{(@var{high}@var{low})} containing two integers, each of which holds 16 bits of thetime. (This is the same format that @code[file-attributes} uses toreturn time values.)The new function @code{visited-file-modtime} returns the recorded lastmodification time, in that same format.@itemThe function @code{directory-files} now takes an optional fourthargument which, if non-@code{nil}, inhibits sorting the file names.Use this if you want the utmost possible speed and don't care what orderthe files are processed in.If the order of processing is at all visible to the user, then the userwill probably be happier if you do sort the names.@itemThe variable @code{directory-abbrev-alist} contains an alist ofabbreviations to use for file directories. Each element has the form@code{(@var{from} . @var{to})}, and says to replace @var{from} with@var{to} when it appears in a directory name. This replacement is donewhen setting up the default directory of a newly visited file. The@var{from} string is actually a regular expression; it should alwaysstart with @samp{^}.You can set this variable in @file{site-init.el} to describe theabbreviations appropriate for your site.@itemThe function @code{abbreviate-file-name} applies abbreviations from@code{directory-abbrev-alist} to its argument, and substitutes @samp{~}for the user's home directory.Abbreviated directory names are useful for directories that are normallyaccessed through symbolic links. If you think of the link's name as``the name'' of the directory, you can define it as an abbreviation forthe directory's official name; then ordinarily Emacs will call thatdirectory by the link name you normally use.@item@code{write-region} can write a given string instead of text from thebuffer. Use the string as the first argument (in place of thestarting character position).You can supply a second file name as the fifth argument (@var{visit}).Use this to write the data to one file (the first argument,@var{filename}) while nominally visiting a different file (the fifthargument, @var{visit}). The argument @var{visit} is used in the echoarea message and also for file locking; @var{visit} is stored in@code{buffer-file-name}.@itemThe value of @code{write-file-hooks} does not change when you switch toa new major mode. The intention is that these hooks have to do withwhere the file came from, and not with what it contains.@itemThere is a new hook variable for saving files:@code{write-contents-hooks}. It works just like @code{write-file-hooks}except that switching to a new major mode clears it back to @code{nil}.Major modes should use this hook variable rather than@code{write-file-hooks}.@itemThe hook @code{after-save-hook} runs just after a buffer has been savedin its visited file.@itemThe new function @code{set-default-file-modes} sets the file protectionfor new files created with Emacs. The argument must be an integer. (Itwould be better to permit symbolic arguments like the @code{chmod}program, but that would take more work than this function merits.)Use the new function @code{default-file-modes} to read the currentdefault file mode.@itemCall the new function @code{unix-sync} to force all pending disk outputto happen as soon as possible.@end itemize@section Making Certain File Names ``Magic''You can implement special handling for a class of file names. You mustsupply a regular expression to define the class of names (all thosewhich match the regular expression), plus a handler that implements allthe primitive Emacs file operations for file names that do match.The value of @code{file-name-handler-alist} is a list of handlers,together with regular expressions that decide when to apply eachhandler. Each element has the form @code{(@var{regexp}. @var{handler})}. If a file name matches @var{regexp}, then all workon that file is done by calling @var{handler}.All the Emacs primitives for file access and file name transformationcheck the given file name against @code{file-name-handler-alist}, andcall @var{handler} to do the work if appropriate. The first argumentgiven to @var{handler} is the name of the primitive; the remainingarguments are the arguments that were passed to that primitive. (Thefirst of these arguments is typically the file name itself.) Forexample, if you do this:@example(file-exists-p @var{filename})@end example@noindentand @var{filename} has handler @var{handler}, then @var{handler} iscalled like this:@example(funcall @var{handler} 'file-exists-p @var{filename})@end exampleHere are the primitives that you can handle in this way:@quotation@code{add-name-to-file}, @code{copy-file}, @code{delete-directory},@code{delete-file}, @code{directory-file-name}, @code{directory-files},@code{dired-compress-file}, @code{dired-uncache},@code{expand-file-name}, @code{file-accessible-directory-p},@code{file-attributes}, @code{file-directory-p},@code{file-executable-p}, @code{file-exists-p}, @code{file-local-copy},@code{file-modes}, @code{file-name-all-completions},@code{file-name-as-directory}, @code{file-name-completion},@code{file-name-directory}, @code{file-name-nondirectory},@code{file-name-sans-versions}, @code{file-newer-than-file-p},@code{file-readable-p}, @code{file-symlink-p}, @code{file-writable-p},@code{insert-directory}, @code{insert-file-contents},@code{make-directory}, @code{make-symbolic-link}, @code{rename-file},@code{set-file-modes}, @code{verify-visited-file-modtime},@code{write-region}.@end quotationThe handler function must handle all of the above operations, andpossibly others to be added in the future. Therefore, it should alwaysreinvoke the ordinary Lisp primitive when it receives an operation itdoes not recognize. Here's one way to do this:@smallexample(defun my-file-handler (primitive &rest args) ;; @r{First check for the specific operations} ;; @r{that we have special handling for.} (cond ((eq operation 'insert-file-contents) @dots{}) ((eq operation 'write-region) @dots{}) @dots{} ;; @r{Handle any operation we don't know about.} (t (let (file-name-handler-alist) (apply operation args)))))@end smallexampleThe function @code{file-local-copy} copies file @var{filename} to thelocal site, if it isn't there already. If @var{filename} specifies a``magic'' file name which programs outside Emacs cannot directly read orwrite, this copies the contents to an ordinary file and returns thatfile's name.If @var{filename} is an ordinary file name, not magic, then this functiondoes nothing and returns @code{nil}.The function @code{unhandled-file-name-directory} is used to get anon-magic directory name from an arbitrary file name. It uses thedirectory part of the specified file name if that is not magic.Otherwise, it asks the file name's handler what to do.@section Frames@cindex frameEmacs now supports multiple X windows via a new data type known as a@dfn{frame}.A frame is a rectangle on the screen that contains one or more Emacswindows. Subdividing a frame works just like subdividing the screen inearlier versions of Emacs.@cindex terminal frameThere are two kinds of frames: terminal frames and X window frames.Emacs creates one terminal frame when it starts up with no X display; ituses Termcap or Terminfo to display using characters. There is no wayto create another terminal frame after startup. If Emacs has an Xdisplay, it does not make a terminal frame, and there is none.@cindex X window frameWhen you are using X windows, Emacs starts out with a single X windowframe. You can create any number of X window frames using@code{make-frame}.Use the predicate @code{framep} to determine whether a given Lisp objectis a frame.The function @code{redraw-frame} redisplays the entire contents of agiven frame.@subsection Creating and Deleting FramesUse @code{make-frame} to create a new frame (supported under X Windowsonly). This is the only primitive for creating frames.@code{make-frame} takes just one argument, which is an alistspecifying frame parameters. Any parameters not mentioned in theargument alist default based on the value of @code{default-frame-alist};parameters not specified there default from the standard X defaults fileand X resources.When you invoke Emacs, if you specify arguments for window appearanceand so forth, these go into @code{default-frame-alist} and that is howthey have their effect.You can specify the parameters for the initial startup X window frame bysetting @code{initial-frame-alist} in your @file{.emacs} file. If theseparameters specify a separate minibuffer-only frame, and you have notcreated one, Emacs creates one for you, using the parameter valuesspecified in @code{minibuffer-frame-alist}.You can specify the size and position of a frame using the frameparameters @code{left}, @code{top}, @code{height} and @code{width}. Youmust specify either both size parameters or neither. You must specifyeither both position parameters or neither. The geometry parametersthat you don't specify are chosen by the window manager in its usualfashion.The function @code{x-parse-geometry} converts a standard X windowsgeometry string to an alist which you can use as part of the argument to@code{make-frame}.Use the function @code{delete-frame} to eliminate a frame. Frames arelike buffers where deletion is concerned; a frame actually continues toexist as a Lisp object until it is deleted @emph{and} there are noreferences to it, but once it is deleted, it has no further effect onthe screen.The function @code{frame-live-p} returns non-@code{nil} if the argument(a frame) has not been deleted.@subsection Finding All FramesThe function @code{frame-list} returns a list of all the frames that havenot been deleted. It is analogous to @code{buffer-list}. The list thatyou get is newly created, so modifying the list doesn't have any effecton the internals of Emacs. The function @code{visible-frame-list} returnsthe list of just the frames that are visible.@code{next-frame} lets you cycle conveniently through all the frames from anarbitrary starting point. Its first argument is a frame. Its secondargument @var{minibuf} says what to do about minibuffers:@table @asis@item @code{nil}Exclude minibuffer-only frames.@item a windowConsider only the frames using that particular window as theirminibuffer.@item anything elseConsider all frames.@end table@subsection Frames and WindowsAll the non-minibuffer windows in a frame are arranged in a tree ofsubdivisions; the root of this tree is available via the function@code{frame-root-window}. Each window is part of one and only oneframe; you can get the frame with @code{window-frame}.At any time, exactly one window on any frame is @dfn{selected within theframe}. You can get the frame's current selected window with@code{frame-selected-window}. The significance of this designation isthat selecting the frame selects for Emacs as a whole the windowcurrently selected within that frame.Conversely, selecting a window for Emacs with @code{select-window} alsomakes that window selected within its frame.@subsection Frame VisibilityA frame may be @dfn{visible}, @dfn{invisible}, or @dfn{iconified}. Ifit is invisible, it doesn't show in the screen, not even as an icon.You can set the visibility status of a frame with@code{make-frame-visible}, @code{make-frame-invisible}, and@code{iconify-frame}. You can examine the visibility status with@code{frame-visible-p}---it returns @code{t} for a visible frame,@code{nil} for an invisible frame, and @code{icon} for an iconifiedframe.@subsection Selected FrameAt any time, one frame in Emacs is the @dfn{selected frame}. The selectedwindow always resides on the selected frame.@defun selected-frameThis function returns the selected frame.@end defunThe X server normally directs keyboard input to the X window that themouse is in. Some window managers use mouse clicks or keyboard eventsto @dfn{shift the focus} to various X windows, overriding the normalbehavior of the server.Lisp programs can switch frames ``temporarily'' by calling the function@code{select-frame}. This does not override the window manager; rather,it escapes from the window manager's control until that control issomehow reasserted. The function takes one argument, a frame, andselects that frame. The selection lasts until the next time the userdoes something to select a different frame, or until the next time thisfunction is called.Emacs cooperates with the X server and the window managers by arrangingto select frames according to what the server and window manager askfor. It does so by generating a special kind of input event, called a@dfn{focus} event. The command loop handles a focus event by calling@code{internal-select-frame}. @xref{Focus Events}.@subsection Frame Size and PositionThe new functions @code{frame-height} and @code{frame-width} return theheight and width of a specified frame (or of the selected frame),measured in characters.The new functions @code{frame-pixel-height} and @code{frame-pixel-width}return the height and width of a specified frame (or of the selectedframe), measured in pixels.The new functions @code{frame-char-height} and @code{frame-char-width}return the height and width of a character in a specified frame (or inthe selected frame), measured in pixels.@code{set-frame-size} sets the size of a frame, measured in characters;its arguments are @var{frame}, @var{cols} and @var{rows}. To set thesize with values measured in pixels, you can use@code{modify-frame-parameters}.The function @code{set-frame-position} sets the position of the top leftcorner of a frame. Its arguments are @var{frame}, @var{left} and@var{top}.@ignoreNew functions @code{set-frame-height} and @code{set-frame-width} set thesize of a specified frame. The frame is the first argument; the size isthe second.@end ignore@subsection Frame ParametersA frame has many parameters that affect how it displays. Use thefunction @code{frame-parameters} to get an alist of all the parametersof a given frame. To alter parameters, use@code{modify-frame-parameters}, which takes two arguments: the frame tomodify, and an alist of parameters to change and their new values. Eachelement of @var{alist} has the form @code{(@var{parm} . @var{value})},where @var{parm} is a symbol. Parameters that aren't meaningful areignored. If you don't mention a parameter in @var{alist}, its valuedoesn't change.Just what parameters a frame has depends on what display mechanism ituses. Here is a table of the parameters of an Xwindow frame:@table @code@item nameThe name of the frame.@item leftThe screen position of the left edge.@item topThe screen position of the top edge.@item heightThe height of the frame contents, in pixels.@item widthThe width of the frame contents, in pixels.@item window-idThe number of the X window for the frame.@item minibufferWhether this frame has its own minibuffer.@code{t} means yes, @code{none} means no, @code{only} means this frame is just a minibuffer,a minibuffer window (in some other frame)means the new frame uses that minibuffer.@item fontThe name of the font for the text.@item foreground-colorThe color to use for the inside of a character.Use strings to designate colors;X windows defines the meaningful color names.@item background-colorThe color to use for the background of text.@item mouse-colorThe color for the mouse cursor.@item cursor-colorThe color for the cursor that shows point.@item border-colorThe color for the border of the frame.@item cursor-typeThe way to display the cursor. There are two legitimate values:@code{bar} and @code{box}. The value @code{bar} specifies a verticalbar between characters as the cursor. The value @code{box} specifies anordinary black box overlaying the character after point; that is thedefault.@item icon-typeNon-@code{nil} for a bitmap icon, @code{nil} for a text icon.@item border-widthThe width in pixels of the window border.@item internal-border-widthThe distance in pixels between text and border.@item auto-raiseNon-@code{nil} means selecting the frame raises it.@item auto-lowerNon-@code{nil} means deselecting the frame lowers it.@item vertical-scrollbarNon-@code{nil} gives the frame a scroll barfor vertical scrolling.@item horizontal-scrollbarNon-@code{nil} gives the frame a scroll barfor horizontal scrolling.@end table@subsection Minibufferless FramesNormally, each frame has its own minibuffer window at the bottom, whichis used whenever that frame is selected. However, you can also createframes with no minibuffers. These frames must use the minibuffer windowof some other frame.The variable @code{default-minibuffer-frame} specifies where to find aminibuffer for frames created without minibuffers of their own. Itsvalue should be a frame which does have a minibuffer.You can also specify a minibuffer window explicitly when you create aframe; then @code{default-minibuffer-frame} is not used.@section X Windows Features@itemize @bullet@itemThe new functions @code{mouse-position} and @code{set-mouse-position} giveaccess to the current position of the mouse.@code{mouse-position} returns a description of the position of the mouse.The value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x}and @var{y} are measured in pixels relative to the top left corner ofthe inside of @var{frame}.@code{set-mouse-position} takes three arguments, @var{frame}, @var{x}and @var{y}, and warps the mouse cursor to that location on the screen.@item@code{track-mouse} is a new special form for tracking mouse motion.Use it in definitions of mouse clicks that want pay to attention tothe motion of the mouse, not just where the buttons are pressed andreleased. Here is how to use it:@example(track-mouse @var{body}@dots{})@end exampleWhile @var{body} executes, mouse motion generates input events just as mouseclicks do. @var{body} can read them with @code{read-event} or@code{read-key-sequence}.@code{track-mouse} returns the value of the last form in @var{body}.The format of these events is described under ``New features for keybindings and input.''@c ???@item@code{x-set-selection} sets a ``selection'' in the X Windows server.It takes two arguments: a selection type @var{type}, and the value toassign to it, @var{data}. If @var{data} is @code{nil}, it means toclear out the selection. Otherwise, @var{data} may be a string, asymbol, an integer (or a cons of two integers or list of two integers),or a cons of two markers pointing to the same buffer. In the last case,the selection is considered to be the text between the markers. Thedata may also be a vector of valid non-vector selection values.Each possible @var{type} has its own selection value, which changesindependently. The usual values of @var{type} are @code{PRIMARY} and@code{SECONDARY}; these are symbols with upper-case names, in accordwith X Windows conventions. The default is @code{PRIMARY}.To get the value of the selection, call @code{x-get-selection}. Thisfunction accesses selections set up by Emacs and those set up by other Xclients. It takes two optional arguments, @var{type} and@var{data-type}. The default for @var{type} is @code{PRIMARY}.The @var{data-type} argument specifies the form of data conversion touse; meaningful values include @code{TEXT}, @code{STRING},@code{TARGETS}, @code{LENGTH}, @code{DELETE}, @code{FILE_NAME},@code{CHARACTER_POSITION}, @code{LINE_NUMBER}, @code{COLUMN_NUMBER},@code{OWNER_OS}, @code{HOST_NAME}, @code{USER}, @code{CLASS},@code{NAME}, @code{ATOM}, and @code{INTEGER}. (These are symbols withupper-case names in accord with X Windows conventions.)The default for @var{data-type} is @code{STRING}.@itemX Windows has a set of numbered @dfn{cut buffers} which can store textor other data being moved between applications. Use@code{x-get-cut-buffer} to get the contents of a cut buffer; specify thecut buffer number as argument. Use @code{x-set-cut-buffer} withargument @var{string} to store a new string into the first cut buffer(moving the other values down through the series of cut buffers,kill-ring-style).Cut buffers are considered obsolete in X Windows, but Emacs supportsthem for the sake of X clients that still use them.@itemYou can close the connection with the X Windows server withthe function @code{x-close-current-connection}. This takes no arguments.Then you can connect to a different X Windows server with@code{x-open-connection}. The first argument, @var{display}, is thename of the display to connect to.The optional second argument @var{xrm-string} is a string of resourcenames and values, in the same format used in the @file{.Xresources}file. The values you specify override the resource values recorded inthe X Windows server itself. Here's an example of what this stringmight look like:@example"*BorderWidth: 3\n*InternalBorder: 2\n"@end example@itemA series of new functions give you information about the X server andthe screen you are using.@table @code@item x-display-screensThe number of screens associated with the current display.@item x-server-versionThe version numbers of the X server in use.@item x-server-vendorThe vendor supporting the X server in use.@item x-display-pixel-heightThe height of this X screen in pixels.@item x-display-mm-heightThe height of this X screen in millimeters.@item x-display-pixel-widthThe width of this X screen in pixels.@item x-display-mm-widthThe width of this X screen in millimeters.@item x-display-backing-storeThe backing store capability of this screen. Values can be the symbols@code{always}, @code{when-mapped}, or @code{not-useful}.@item x-display-save-underNon-@code{nil} if this X screen supports the SaveUnder feature.@item x-display-planesThe number of planes this display supports.@item x-display-visual-classThe visual class for this X screen. The value is one of the symbols@code{static-gray}, @code{gray-scale}, @code{static-color},@code{pseudo-color}, @code{true-color}, and @code{direct-color}.@item x-display-color-p@code{t} if the X screen in use is a color screen.@item x-display-color-cellsThe number of color cells this X screen supports.@end tableThere is also a variable @code{x-no-window-manager}, whose value is@code{t} if no X window manager is in use.@itemThe function @code{x-synchronize} enables or disables an X Windowsdebugging mode: synchronous communication. It takes one argument,non-@code{nil} to enable the mode and @code{nil} to disable.In synchronous mode, Emacs waits for a response to each X protocolcommand before doing anything else. This means that errors are reportedright away, and you can directly find the erroneous command.Synchronous mode is not the default because it is much slower.@itemThe function @code{x-get-resource} retrieves a resource value from the XWindows defaults database. Its three arguments are @var{attribute},@var{name} and @var{class}. It searches using a key of the form@samp{@var{instance}.@var{attribute}}, with class @samp{Emacs}, where@var{instance} is the name under which Emacs was invoked.The optional arguments @var{component} and @var{subclass} add to the keyand the class, respectively. You must specify both of them or neither.If you specify them, the key is@samp{@var{instance}.@var{component}.@var{attribute}}, and the class is@samp{Emacs.@var{subclass}}.@item@code{x-color-display-p} returns @code{t} if you are using an X Windowserver with a color display, and @code{nil} otherwise.@c ??? Name being changed from x-defined-color.@code{x-color-defined-p} takes as argument a string describing a color; itreturns @code{t} if the display supports that color. (If the color is@code{"black"} or @code{"white"} then even black-and-white displayssupport it.)@item@code{x-popup-menu} has been generalized. It now accepts a keymap asthe @var{menu} argument. Then the menu items are the prompt strings ofindividual key bindings, and the item values are the keys which havethose bindings.You can also supply a list of keymaps as the first argument; then eachkeymap makes one menu pane (but keymaps that don't provide any menuitems don't appear in the menu at all).@code{x-popup-menu} also accepts a mouse button event as the@var{position} argument. Then it displays the menu at the location atwhich the event took place. This is convenient for mouse-invokedcommands that pop up menus.@ignore@itemx-pointer-shape, x-nontext-pointer-shape, x-mode-pointer-shape.@end ignore@itemYou can use the function @code{x-rebind-key} to change the sequenceof characters generated by one of the keyboard keys. This worksonly with X Windows.The first two arguments, @var{keycode} and @var{shift-mask}, should benumbers representing the keyboard code and shift mask respectively.They specify what key to change.The third argument, @var{newstring}, is the new definition of the key.It is a sequence of characters that the key should produce as input.The shift mask value is a combination of bits according to this table:@table @asis@item 8Control@item 4Meta@item 2Shift@item 1Shift Lock@end tableIf you specify @code{nil} for @var{shift-mask}, then the key specifiedby @var{keycode} is redefined for all possible shift combinations.For the possible values of @var{keycode} and their meanings, see thefile @file{/usr/lib/Xkeymap.txt}. Keep in mind that the codes in thatfile are in octal!@ignore @c Presumably this is already fixedNOTE: due to an X bug, this function will not take effect unless theuser has a @file{~/.Xkeymap} file. (See the documentation for the@code{keycomp} program.) This problem will be fixed in X version 11.@end ignoreThe related function @code{x-rebind-keys} redefines a single keyboardkey, specifying the behavior for each of the 16 shift masksindependently. The first argument is @var{keycode}, as in@code{x-rebind-key}. The second argument @var{strings} is a list of 16elements, one for each possible shift mask value; each element says howto redefine the key @var{keycode} with the corresponding shift maskvalue. If an element is a string, it is the new definition. If anelement is @code{nil}, the definition does not change for that shiftmask.@itemThe function @code{x-geometry} parses a string specifying window sizeand position in the usual fashion for X windows. It returns an alistdescribing which parameters were specified, and the values that weregiven for them.The elements of the alist look like @code{(@var{parameter} .@var{value})}. The possible @var{parameter} values are @code{left},@code{top}, @code{width}, and @code{height}.@end itemize@section New Window Features@itemize @bullet@itemThe new function @code{window-at} tells you which window contains agiven horizontal and vertical position on a specified frame. Call itwith three arguments, like this:@example(window-at @var{x} @var{column} @var{frame})@end exampleThe function returns the window which contains that cursor position inthe frame @var{frame}. If you omit @var{frame}, the selected frame isused.@itemThe function @code{coordinates-in-window-p} takes two arguments andchecks whether a particular frame position falls within a particularwindow.@example(coordinates-in-window-p @var{coordinates} @var{window})@end exampleThe argument @var{coordinates} is a cons cell of this form:@example(@var{x} . @var{y})@end example@noindentThe two coordinates are measured in characters, and count from the topleft corner of the screen or frame.The value of the function tells you what part of the window the positionis in. The possible values are:@table @code@item (@var{relx} . @var{rely})The coordinates are inside @var{window}. The numbers @var{relx} and@var{rely} are equivalent window-relative coordinates, counting from 0at the top left corner of the window.@item mode-lineThe coordinates are in the mode line of @var{window}.@item vertical-splitThe coordinates are in the vertical line between @var{window} and itsneighbor to the right.@item nilThe coordinates are not in any sense within @var{window}.@end tableYou need not specify a frame when you call@code{coordinates-in-window-p}, because it assumes you mean the framewhich window @var{window} is on.@itemThe function @code{minibuffer-window} now accepts a frame as argumentand returns the minibuffer window used for that frame. If you don'tspecify a frame, the currently selected frame is used. The minibufferwindow may be on the frame in question, but if that frame has nominibuffer of its own, it uses the minibuffer window of some otherframe, and @code{minibuffer-window} returns that window.@itemUse @code{window-live-p} to test whether a window is still alive (thatis, not deleted).@itemUse @code{window-minibuffer-p} to determine whether a given window is aminibuffer or not. It no longer works to do this by comparing thewindow with the result of @code{(minibuffer-window)}, because there canbe more than one minibuffer window at a time (if you have multipleframes).@itemIf you set the variable @code{pop-up-frames} non-@code{nil}, then thefunctions to show something ``in another window'' actually create a newframe for the new window. Thus, you will tend to have a frame for eachwindow, and you can easily have a frame for each buffer.The value of the variable @code{pop-up-frame-function} controls how newframes are made. The value should be a function which takes noarguments and returns a frame. The default value is a function whichcreates a frame using parameters from @code{pop-up-frame-alist}.@item@code{display-buffer} is the basic primitive for finding a way to show abuffer on the screen. You can customize its behavior by storing afunction in the variable @code{display-buffer-function}. If thisvariable is non-@code{nil}, then @code{display-buffer} calls it to dothe work. Your function should accept two arguments, as follows:@table @var@item bufferThe buffer to be displayed.@item flagA flag which, if non-@code{nil}, means you should find another window todisplay @var{buffer} in, even if it is already visible in the selectedwindow.@end tableThe function you supply will be used by commands such as@code{switch-to-buffer-other-window} and @code{find-file-other-window}as well as for your own calls to @code{display-buffer}.@item@code{delete-window} now gives all of the deleted window's screen spaceto a single neighboring window. Likewise, @code{enlarge-window} takesspace from only one neighboring window until that window disappears;only then does it take from another window.@item@code{next-window} and @code{previous-window} accept another argument,@var{all-frames}.These functions now take three optional arguments: @var{window},@var{minibuf} and @var{all-frames}. @var{window} is the window to startfrom (@code{nil} means use the selected window). @var{minibuf} sayswhether to include the minibuffer in the windows to cycle through:@code{t} means yes, @code{nil} means yes if it is active, and anythingelse means no.Normally, these functions cycle through all the windows in theselected frame, plus the minibuffer used by the selected frame even ifit lies in some other frame.If @var{all-frames} is @code{t}, then these functions cycle throughall the windows in all the frames that currently exist. If@var{all-frames} is neither @code{t} nor @code{nil}, then they limitthemselves strictly to the windows in the selected frame, excluding theminibuffer in use if it lies in some other frame.@itemThe functions @code{get-lru-window} and @code{get-largest-window} nowtake an optional argument @var{all-frames}. If it is non-@code{nil},the functions consider all windows on all frames. Otherwise, theyconsider just the windows on the selected frame.Likewise, @code{get-buffer-window} takes an optional second argument@var{all-frames}.@itemThe variable @code{other-window-scroll-buffer} specifies which buffer@code{scroll-other-window} should scroll.@itemYou can now mark a window as ``dedicated'' to its buffer.Then Emacs will not try to use that window for any other bufferunless you explicitly request it.Use the new function @code{set-window-dedicated-p} to set the dedicationflag of a window @var{window} to the value @var{flag}. If @var{flag} is@code{t}, this makes the window dedicated. If @var{flag} is@code{nil}, this makes the window non-dedicated.Use @code{window-dedicated-p} to examine the dedication flag of aspecified window.@itemThe new function @code{walk-windows} cycles through all visiblewindows, calling @code{proc} once for each window with the window asits sole argument.The optional second argument @var{minibuf} says whether to include minibufferwindows. A value of @code{t} means count the minibuffer window even ifnot active. A value of @code{nil} means count it only if active. Anyother value means not to count the minibuffer even if it is active.If the optional third argument @var{all-frames} is @code{t}, that meansinclude all windows in all frames. If @var{all-frames} is @code{nil},it means to cycle within the selected frame, but include the minibufferwindow (if @var{minibuf} says so) that that frame uses, even if it is onanother frame. If @var{all-frames} is neither @code{nil} nor @code{t},@code{walk-windows} sticks strictly to the selected frame.@itemThe function @code{window-end} is a counterpart to @code{window-start}:it returns the buffer position of the end of the display in a givenwindow (or the selected window).@itemThe function @code{window-configuration-p} returns non-@code{nil} whengiven an object that is a window configuration (such as is returned by@code{current-window-configuration}).@end itemize@section Display Features@itemize @bullet@item@samp{%l} as a mode line item displays the current line number.If the buffer is longer than @code{line-number-display-limit}characters, or if lines are too long in the viscinity of the currentdisplayed text, then line number display is inhibited to save time.The default contents of the mode line include the line number if@code{line-number-mode} is non-@code{nil}.@item@code{baud-rate} is now a variable rather than a function. This is soyou can set it to reflect the effective speed of your terminal, when thesystem doesn't accurately know the speed.@itemYou can now remove any echo area message and make the minibuffervisible. To do this, call @code{message} with @code{nil} as the onlyargument. This clears any existing message, and lets the currentminibuffer contents show through. Previously, there was no reliable wayto make sure that the minibuffer contents were visible.@itemThe variable @code{temp-buffer-show-hook} has been renamed@code{temp-buffer-show-function}, because its value is a single function(of one argument), not a normal hook.@itemThe new function @code{force-mode-line-update} causes redisplayof the current buffer's mode line.@end itemize@section Display Tables@cindex display tableYou can use the @dfn{display table} feature to control how all 256possible character codes display on the screen. This is useful fordisplaying European languages that have letters not in the ASCIIcharacter set.The display table maps each character code into a sequence of@dfn{glyphs}, each glyph being an image that takes up one characterposition on the screen. You can also define how to display each glyphon your terminal, using the @dfn{glyph table}.@subsection Display TablesUse @code{make-display-table} to create a display table. The tableinitially has @code{nil} in all elements.A display table is actually an array of 261 elements. The first 256elements of a display table control how to display each possible textcharacter. The value should be @code{nil} or a vector (which is asequence of glyphs; see below). @code{nil} as an element means todisplay that character following the usual display conventions.The remaining five elements of a display table serve special purposes(@code{nil} means use the default stated below):@table @asis@item 256The glyph for the end of a truncated screen line (the default for thisis @samp{\}).@item 257The glyph for the end of a continued line (the default is @samp{$}).@item 258The glyph for the indicating an octal character code (the default is@samp{\}).@item 259The glyph for indicating a control characters (the default is @samp{^}).@item 260The vector of glyphs for indicating the presence of invisible lines (thedefault is @samp{...}).@end tableEach buffer typically has its own display table. The display table forthe current buffer is stored in @code{buffer-display-table}. (Thisvariable automatically becomes local if you set it.) If this variableis @code{nil}, the value of @code{standard-display-table} is used inthat buffer.Each window can have its own display table, which overrides the displaytable of the buffer it is showing.If neither the selected window nor the current buffer has a displaytable, and if @code{standard-display-table} is @code{nil}, then Emacsuses the usual display conventions:@itemize @bullet@itemCharacter codes 32 through 127 map to glyph codes 32 through 127.@itemCodes 0 through 31 map to sequences of two glyphs, where the first glyphis the ASCII code for @samp{^}.@itemCharacter codes 128 through 255 map to sequences of four glyphs, wherethe first glyph is the ASCII code for @samp{\}, and the others representdigits.@end itemizeThe usual display conventions are also used for any character whoseentry in the active display table is @code{nil}. This means that whenyou set up a display table, you need not specify explicitly what to dowith each character, only the characters for which you want unusualbehavior.@subsection Glyphs@cindex glyphA glyph stands for an image that takes up a single character position onthe screen. A glyph is represented in Lisp as an integer.@cindex glyph tableThe meaning of each integer, as a glyph, is defined by the glyph table,which is the value of the variable @code{glyph-table}. It should be avector; the @var{g}th element defines glyph code @var{g}. The possibledefinitions of a glyph code are:@table @var@item integerDefine this glyph code as an alias for code @var{integer}.This is used with X windows to specify a face code.@item stringSend the characters in @var{string} to the terminal to outputthis glyph. This alternative is not available with X Windows.@item @code{nil}This glyph is simple. On an ordinary terminal, the glyph code mod 256is the character to output. With X, the glyph code mod 256 is characterto output, and the glyph code divided by 256 specifies the @dfn{facecode} to use while outputting it.@end tableAny glyph code beyond the length of the glyph table is automatically simple.A face code for X windows is the combination of a font and a color.Emacs uses integers to identify face codes. You can define a new facecode with @code{(x-set-face @var{face-code} @var{font} @var{foreground}@var{background})}. @var{face-code} is an integer from 0 to 255; itspecifies which face to define. The other three arguments are strings:@var{font} is the name of the font to use, and @var{foreground} and@var{background} specify the colors to use.If @code{glyph-table} is @code{nil}, then all possible glyph codes aresimple.@subsection ISO Latin 1If you have a terminal that can handle the entire ISO Latin 1 characterset, you can arrange to use that character set as follows:@example(require 'disp-table)(standard-display-8bit 0 255)@end exampleIf you are editing buffers written in the ISO Latin 1 character set andyour terminal doesn't handle anything but ASCII, you can load the file@code{iso-ascii} to set up a display table which makes the other ISOcharacters display as sequences of ASCII characters. For example, thecharacter ``o with umlaut'' displays as @samp{@{"o@}}.Some European countries have terminals that don't support ISO Latin 1but do support the special characters for that country's language. Youcan define a display table to work one language using such terminals.For an example, see @file{lisp/iso-swed.el}, which handles certainSwedish terminals.You can load the appropriate display table for your terminalautomatically by writing a terminal-specific Lisp file for the terminaltype.@section New Input Event FormatsMouse clicks, mouse movements and function keys no longer appear in theinput stream as characters; instead, other kinds of Lisp objectsrepresent them as input.@itemize @bullet@itemAn ordinary input character event consists of a @dfn{basic code} between0 and 255, plus any or all of these @dfn{modifier bits}:@table @asis@item metaThe 2**23 bit in the character code indicates a charactertyped with the meta key held down.@item controlThe 2**22 bit in the character code indicates a non-@sc{ASCII}control character.@sc{ASCII} control characters such as @kbd{C-a} have special basiccodes of their own, so Emacs needs no special bit to indicate them.Thus, the code for @kbd{C-a} is just 1.But if you type a control combination not in @sc{ASCII}, such as@kbd{%} with the control key, the numeric value you get is the codefor @kbd{%} plus 2**22 (assuming the terminal supports non-@sc{ASCII}control characters).@item shiftThe 2**21 bit in the character code indicates an @sc{ASCII} controlcharacter typed with the shift key held down.For letters, the basic code indicates upper versus lower case; fordigits and punctuation, the shift key selects an entirely differentcharacter with a different basic code. In order to keep withinthe @sc{ASCII} character set whenever possible, Emacs avoids usingthe 2**21 bit for those characters.However, @sc{ASCII} provides no way to distinguish @kbd{C-A} from@kbd{C-A}, so Emacs uses the 2**21 bit in @kbd{C-A} and not in@kbd{C-a}.@item hyperThe 2**20 bit in the character code indicates a charactertyped with the hyper key held down.@item superThe 2**19 bit in the character code indicates a charactertyped with the super key held down.@item altThe 2**18 bit in the character code indicates a character typed withthe alt key held down. (On some terminals, the key labeled @key{ALT}is actually the meta key.)@end tableIn the future, Emacs may support a larger range of basic codes. We mayalso move the modifier bits to larger bit numbers. Therefore, youshould avoid mentioning specific bit numbers in your program. Instead,the way to test the modifier bits of a character is with the function@code{event-modifiers} (see below).@itemFunction keys are represented as symbols. The symbol's name isthe function key's label. For example, pressing a key labeled @key{F1}places the symbol @code{f1} in the input stream.There are a few exceptions to the symbol naming convention:@table @asis@item @code{kp-add}, @code{kp-decimal}, @code{kp-divide}, @dots{}Keypad keys (to the right of the regular keyboard).@item @code{kp-0}, @code{kp-1}, @dots{}Keypad keys with digits.@item @code{kp-f1}, @code{kp-f2}, @code{kp-f3}, @code{kp-f4}Keypad PF keys.@item @code{left}, @code{up}, @code{right}, @code{down}Cursor arrow keys@end tableYou can use the modifier keys @key{CTRL}, @key{META}, @key{HYPER},@key{SUPER}, @key{ALT} and @key{SHIFT} with function keys. The wayto represent them is with prefixes in the symbol name:@table @samp@item A-The alt modifier.@item C-The control modifier.@item H-The hyper modifier.@item M-The meta modifier.@item s-The super modifier.@item S-The shift modifier.@end tableThus, the symbol for the key @key{F3} with @key{META} held down iskbd{M-@key{F3}}. When you use more than one prefix, we recommend youwrite them in alphabetical order (though the order does not matter inarguments to the key-binding lookup and modification functions).@itemMouse events are represented as lists.If you press a mouse button and release it at the same location, thisgenerates a ``click'' event. Mouse click events have this form:@example(@var{button-symbol} (@var{window} (@var{column} . @var{row}) @var{buffer-pos} @var{timestamp}))@end exampleHere is what the elements normally mean:@table @var@item button-symbolindicates which mouse button was used. It is one of the symbols@code{mouse-1}, @code{mouse-2}, @dots{}, where the buttons are numberednumbered left to right.You can also use prefixes @samp{A-}, @samp{C-}, @samp{H-}, @samp{M-},@samp{S-} and @samp{s-} for modifiers alt, control, hyper, meta, shiftand super, just as you would with function keys.@item windowis the window in which the click occurred.@item column@itemx roware the column and row of the click, relative to the top left corner of@var{window}, which is @code{(0 . 0)}.@item buffer-posis the buffer position of the character clicked on.@item timestampis the time at which the event occurred, in milliseconds. (Since thisvalue wraps around the entire range of Emacs Lisp integers in about fivehours, it is useful only for relating the times of nearby events.)@end tableThe meanings of @var{buffer-pos}, @var{row} and @var{column} aresomewhat different when the event location is in a special part of thescreen, such as the mode line or a scroll bar.If the position is in the window's scroll bar, then @var{buffer-pos} isthe symbol @code{vertical-scrollbar} or @code{horizontal-scrollbar}, andthe pair @code{(@var{column} . @var{row})} is instead a pair@code{(@var{portion} . @var{whole})}, where @var{portion} is thedistance of the click from the top or left end of the scroll bar, and@var{whole} is the length of the entire scroll bar.If the position is on a mode line or the vertical line separating@var{window} from its neighbor to the right, then @var{buffer-pos} isthe symbol @code{mode-line} or @code{vertical-line}. In this case@var{row} and @var{column} do not have meaningful data.@itemReleasing a mouse button above a different character positiongenerates a ``drag'' event, which looks like this:@example(@var{button-symbol} (@var{window1} (@var{column1} . @var{row1}) @var{buffer-pos1} @var{timestamp1}) (@var{window2} (@var{column2} . @var{row2}) @var{buffer-pos2} @var{timestamp2}))@end exampleThe name of @var{button-symbol} contains the prefix @samp{drag-}. Thesecond and third elements of the event give the starting and endingposition of the drag.The @samp{drag-} prefix follows the modifier key prefixes such as@samp{C-} and @samp{M-}.If @code{read-key-sequence} receives a drag event which has no keybinding, and the corresponding click event does have a binding, itchanges the drag event into a click event at the drag's startingposition. This means that you don't have to distinguish between clickand drag events unless you want to.@itemClick and drag events happen when you release a mouse button. Anotherkind of event happens when you press a button. It looks just like aclick event, except that the name of @var{button-symbol} contains theprefix @samp{down-}. The @samp{down-} prefix follows the modifier keyprefixes such as @samp{C-} and @samp{M-}.The function @code{read-key-sequence}, and the Emacs command loop,ignore any down events that don't have command bindings. This meansthat you need not worry about defining down events unless you want themto do something. The usual reason to define a down event is so that youcan track mouse motion until the button is released.@itemFor example, if the user presses and releases the left mouse button overthe same location, Emacs generates a sequence of events like this:@smallexample(down-mouse-1 (#<window 18 on NEWS> 2613 (0 . 38) -864320))(mouse-1 (#<window 18 on NEWS> 2613 (0 . 38) -864180))@end smallexampleOr, while holding the control key down, the user might hold down thesecond mouse button, and drag the mouse from one line to the next.That produces two events, as shown here:@smallexample(C-down-mouse-2 (#<window 18 on NEWS> 3440 (0 . 27) -731219))(C-drag-mouse-2 (#<window 18 on NEWS> 3440 (0 . 27) -731219) (#<window 18 on NEWS> 3510 (0 . 28) -729648))@end smallexampleOr, while holding down the meta and shift keys, the user might pressthe second mouse button on the window's mode line, and then drag themouse into another window. That produces an event like this:@smallexample(M-S-down-mouse-2 (#<window 18 on NEWS> mode-line (33 . 31) -457844))(M-S-drag-mouse-2 (#<window 18 on NEWS> mode-line (33 . 31) -457844) (#<window 20 on carlton-sanskrit.tex> 161 (33 . 3) -453816))@end smallexample@itemA key sequence that starts with a mouse click is read using the keymapsof the buffer in the window clicked on, not the current buffer.This does not imply that clicking in a window selects that window or itsbuffer. The execution of the command begins with no change in theselected window or current buffer. However, the command can switchwindows or buffers if programmed to do so.@itemMouse motion events are represented by lists. During the execution ofthe body of a @code{track-mouse} form, moving the mouse generates eventsthat look like this:@example(mouse-movement (@var{window} (@var{column} . @var{row}) @var{buffer-pos} @var{timestamp}))@end exampleThe second element of the list describes the current position of themouse, just as in a mouse click event.Outside of @code{track-mouse} forms, Emacs does not generate events formere motion of the mouse, and these events do not appear.@itemFocus shifts between frames are represented by lists.When the mouse shifts temporary input focus from one frame to another,Emacs generates an event like this:@example(switch-frame @var{new-frame})@end example@noindentwhere @var{new-frame} is the frame switched to.In X windows, most window managers are set up so that just moving themouse into a window is enough to set the focus there. As far as theuser concern, Emacs behaves consistently with this. However, there isno need for the Lisp program to know about the focus change until someother kind of input arrives. So Emacs generates the focus event onlywhen the user actually types a keyboard key or presses a mouse button inthe new frame; just moving the mouse between frames does not generate afocus event.The global key map usually binds this event to the@code{internal-select-frame} function, so that characters typed at aframe apply to that frame's selected window.If the user switches frames in the middle of a key sequence, then Emacsdelays the @code{switch-frame} event until the key sequence is over.For example, suppose @kbd{C-c C-a} is a key sequence in the currentbuffer's keymaps. If the user types @kbd{C-c}, moves the mouse toanother frame, and then types @kbd{C-a}, @code{read-key-sequence}returns the sequence @code{"\C-c\C-a"}, and the next call to@code{read-event} or @code{read-key-sequence} will return the@code{switch-frame} event.@end itemize@section Working with Input Events@itemize @bullet@itemFunctions which work with key sequences now handle non-characterevents. Functions like @code{define-key}, @code{global-set-key}, and@code{local-set-key} used to accept strings representing key sequences;now, since events may be arbitrary lisp objects, they also acceptvectors. The function @code{read-key-sequence} may return a string or avector, depending on whether or not the sequence read contains onlycharacters.List events may be represented by the symbols at their head; to bindclicks of the left mouse button, you need only present the symbol@code{mouse-1}, not an entire mouse click event. If you do put an eventwhich is a list in a key sequence, only the event's head symbol is usedin key lookups.For example, to globally bind the left mouse button to the function@code{mouse-set-point}, you could evaluate this:@example(global-set-key [mouse-1] 'mouse-set-point)@end exampleTo bind the sequence @kbd{C-c @key{F1}} to the command @code{tex-view}in @code{tex-mode-map}, you could evaluate this:@example(define-key tex-mode-map [?\C-c f1] 'tex-view)@end exampleTo find the binding for the function key labeled @key{NEXT} in@code{minibuffer-local-map}, you could evaluate this:@example(lookup-key minibuffer-local-map [next]) @result{} next-history-element@end exampleIf you call the function @code{read-key-sequence} and then press@kbd{C-x C-@key{F5}}, here is how it behaves:@example(read-key-sequence "Press `C-x C-F5': ") @result{} [24 C-f5]@end exampleNote that @samp{24} is the character @kbd{C-x}.@itemThe documentation functions (@code{single-key-description},@code{key-description}, etc.) now handle the new event types. Wherevera string of keyboard input characters was acceptable in previousversions of Emacs, a vector of events should now work.@itemSpecial parts of a window can have their own bindings for mouse events.When mouse events occur in special parts of a window, such as a modeline or a scroll bar, the event itself shows nothing special---only thesymbol that would normally represent that mouse button and modifierkeys. The information about the screen region is kept in other partsof the event list. But @code{read-key-sequence} translates thisinformation into imaginary prefix keys, all of which are symbols:@code{mode-line}, @code{vertical-line}, @code{horizontal-scrollbar} and@code{vertical-scrollbar}.For example, if you call @code{read-key-sequence} and then click themouse on the window's mode line, this is what happens:@smallexample(read-key-sequence "Click on the mode line: ") @result{} [mode-line (mouse-1 (#<window 6 on NEWS> mode-line (40 . 63) 5959987))]@end smallexampleYou can define meanings for mouse clicks in special window regions bydefining key sequences using these imaginary prefix keys. For example,here is how to bind the third mouse button on a window's mode linedelete the window:@example(global-set-key [mode-line mouse-3] 'mouse-delete-window)@end exampleHere's how to bind the middle button (modified by @key{META}) on thevertical line at the right of a window to scroll the window to theleft.@example(global-set-key [vertical-line M-mouse-2] 'scroll-left)@end example@itemDecomposing an event symbol.Each symbol used to identify a function key or mouse button has aproperty named @code{event-symbol-elements}, which is a list containingan unmodified version of the symbol, followed by modifiers the symbolname contains. The modifiers are symbols; they include @code{shift},@code{control}, and @code{meta}. In addition, a mouse event symbol hasone of @code{click}, @code{drag}, and @code{down}. For example:@example(get 'f5 'event-symbol-elements) @result{} (f5)(get 'C-f5 'event-symbol-elements) @result{} (f5 control)(get 'M-S-f5 'event-symbol-elements) @result{} (f5 meta shift)(get 'mouse-1 'event-symbol-elements) @result{} (mouse-1 click)(get 'down-mouse-1 'event-symbol-elements) @result{} (mouse-1 down)@end exampleNote that the @code{event-symbol-elements} property for a mouse clickexplicitly contains @code{click}, but the event symbol name itself doesnot contain @samp{click}.@itemUse @code{read-event} to read input if you want to accept any kind ofevent. The old function @code{read-char} now discards events other thankeyboard characters.@item@code{last-command-char} and @code{last-input-char} can now hold anykind of event.@itemThe new variable @code{unread-command-events} is much like@code{unread-command-char}. Its value is a list of events of any type,to be processed as command input in order of appearance in the list.@itemThe function @code{this-command-keys} may return a string or a vector,depending on whether or not the sequence read contains only characters.You may need to upgrade code which uses this function.The function @code{recent-keys} now returns a vector of events.You may need to upgrade code which uses this function.@itemA keyboard macro's definition can now be either a string or a vector.All that really matters is what elements it has. If the elements areall characters, then the macro can be a string; otherwise, it has to bea vector.@itemThe variable @code{last-event-frame} records which frame the last inputevent was directed to. Usually this is the frame that was selected whenthe event was generated, but if that frame has redirected input focus toanother frame, @code{last-event-frame} is the frame to which the eventwas redirected.@itemThe interactive specification now allows a new code letter @samp{e} tosimplify commands bound to events which are lists. This code suppliesas an argument the complete event object.You can use @samp{e} more than once in a single command's interactivespecification. If the key sequence which invoked the command has@var{n} events with parameters, the @var{n}th @samp{e} provides the@var{n}th parameterized event. Events which are not lists, such asfunction keys and ASCII keystrokes, do not count where @samp{e} isconcerned.@itemYou can extract the starting and ending position values from a mousebutton or motion event using the two functions @code{event-start} and@code{event-end}. These two functions return different values for dragand motion events; for click and button-down events, they both returnthe position of the event.@itemThe position, a returned by @code{event-start} and @code{event-end}, isa list of this form:@example(@var{window} @var{buffer-position} (@var{col} . @var{row}) @var{timestamp})@end exampleYou can extract parts of this list with the functions@code{posn-window}, @code{posn-point}, @code{posn-col-row}, and@code{posn-timestamp}.@itemThe function @code{scroll-bar-scale} is useful for computing where toscroll to in response to a mouse button event from a scroll bar. Ittakes two arguments, @var{ratio} and @var{total}, and in effectmultiplies them. We say ``in effect'' because @var{ratio} is not anumber; rather a pair @code{(@var{num} . @var{denom}).Here's the usual way to use @code{scroll-bar-scale}:@example(scroll-bar-scale (posn-col-row (event-start event)) (buffer-size))@end example@end itemize@section Putting Keyboard Events in Strings In most of the places where strings are used, we conceptualize thestring as containing text characters---the same kind of characters foundin buffers or files. Occasionally Lisp programs use strings whichconceptually contain keyboard characters; for example, they may be keysequences or keyboard macro definitions. There are special rules forhow to put keyboard characters into a string, because they are notlimited to the range of 0 to 255 as text characters are. A keyboard character typed using the @key{META} key is called a@dfn{meta character}. The numeric code for such an event includes the2**23 bit; it does not even come close to fitting in a string. However,earlier Emacs versions used a different representation for thesecharacters, which gave them codes in the range of 128 to 255. That didfit in a string, and many Lisp programs contain string constants thatuse @samp{\M-} to express meta characters, especially as the argument to@code{define-key} and similar functions. We provide backward compatibility to run those programs with specialrules for how to put a keyboard character event in a string. Here arethe rules:@itemize @bullet@itemIf the keyboard event value is in the range of 0 to 127, it can go in thestring unchanged.@itemThe meta variants of those events, with codes in the range of 2**23 to2**23+127, can also go in the string, but you must change their numericvalues. You must set the 2**7 bit instead of the 2**23 bit, resultingin a value between 128 and 255.@itemOther keyboard character events cannot fit in a string. This includeskeyboard events in the range of 128 to 255.@end itemize Functions such as @code{read-key-sequence} that can construct stringscontaining events follow these rules. When you use the read syntax @samp{\M-} in a string, it produces acode in the range of 128 to 255---the same code that you get if youmodify the corresponding keyboard event to put it in the string. Thus,meta events in strings work consistently regardless of how they get intothe strings. New programs can avoid dealing with these rules by using vectorsinstead of strings for key sequences when there is any possibility thatthese issues might arise. The reason we changed the representation of meta characters askeyboard events is to make room for basic character codes beyond 127,and support meta variants of such larger character codes.@section MenusYou can now define menus conveniently as keymaps. Menus are normallyused with the mouse, but they can work with the keyboard also.@subsection Defining MenusA keymap is suitable for menu use if it has an @dfn{overall promptstring}, which is a string that appears as an element of the keymap. Itshould describes the purpose of the menu. The easiest way to constructa keymap with a prompt string is to specify the string as an argumentwhen you run @code{make-keymap} or @code{make-sparse-keymap}.The individual bindings in the menu keymap should also have promptstrings; these strings are the items in the menu. A binding with aprompt string looks like this:@example(@var{char} @var{string} . @var{real-binding})@end exampleAs far as @code{define-key} is concerned, the string is part of thecharacter's binding---the binding looks like this:@example(@var{string} . @var{real-binding}).@end exampleHowever, only @var{real-binding} is used for executing the key.You can also supply a second string, called the help string, as follows:@example(@var{char} @var{string} @var{help-string} . @var{real-binding})@end exampleCurrently Emacs does not actually use @var{help-string}; it knows onlyhow to ignore @var{help-string} in order to extract @var{real-binding}.In the future we hope to make @var{help-string} serve as longerdocumentation for the menu item, available on request.The prompt string for a binding should be short---one or two words. Itsmeaning should describe the command it corresponds to.If @var{real-binding} is @code{nil}, then @var{string} appears in themenu but cannot be selected.If @var{real-binding} is a symbol, and has a non-@code{nil}@code{menu-enable} property, that property is an expression whichcontrols whether the menu item is enabled. Every time the keymap isused to display a menu, Emacs evaluates the expression, and it enablesthe menu item only if the expression's value is non-@code{nil}. When amenu item is disabled, it is displayed in a ``fuzzy'' fashion, andcannot be selected with the mouse.@subsection Menus and the MouseThe way to make a menu keymap produce a menu is to make it thedefinition of a prefix key.When the prefix key ends with a mouse event, Emacs handles the menukeymap by popping up a visible menu that you can select from with themouse. When you click on a menu item, the event generated is whatevercharacter or symbol has the binding which brought about that menu item.A single keymap can appear as multiple panes, if you explicitlyarrange for this. The way to do this is to make a keymap for eachpane, then create a binding for each of those maps in the main keymapof the menu. Give each of these bindings a prompt string that startswith @samp{@@}. The rest of the prompt string becomes the name of thepane. See the file @file{lisp/mouse.el} for an example of this. Anyordinary bindings with prompt strings are grouped into one pane, whichappears along with the other panes explicitly created for thesubmaps.You can also get multiple panes from separate keymaps. The fulldefinition of a prefix key always comes from merging the definitionssupplied by the various active keymaps (minor modes, local, andglobal). When more than one of these keymaps is a menu, each of themmakes a separate pane or panes.@subsection Menus and the KeyboardWhen a prefix key ending with a keyboard event (a character or functionkey) has a definition that is a menu keymap, you can use the keyboardto choose a menu item.Emacs displays the menu alternatives in the echo area. If they don'tall fit at once, type @key{SPC} to see the next line of alternatives.If you keep typing @key{SPC}, you eventually get to the end of the menuand then cycle around to the beginning again.When you have found the alternative you want, type the correspondingcharacter---the one whose binding is that alternative.In a menu intended for keyboard use, each menu item must clearlyindicate what character to type. The best convention to use is to makethe character the first letter of the menu item prompt string. That issomething users will understand without being told.@subsection The Menu Bar Under X Windows, each frame can have a @dfn{menu bar}---a permanentlydisplayed menu stretching horizontally across the top of the frame. Theitems of the menu bar are the subcommands of the fake ``function key''@code{menu-bar}, as defined by all the active keymaps. To add an item to the menu bar, invent a fake ``function key'' of yourown (let's call it @var{key}), and make a binding for the key sequence@code{[menu-bar @var{key}]}. Most often, the binding is a menu keymap,so that pressing a button on the menu bar item leads to another menu. In order for a frame to display a menu bar, its @code{menu-bar-lines}property must be greater than zero. Emacs uses just one line for themenu bar itself; if you specify more than one line, the other linesserve to separate the menu bar from the windows in the frame. Werecommend you try one or two as the @code{menu-bar-lines} value.@section Keymaps@itemize @bullet@itemThe representation of keymaps has changed to support the new eventtypes. All keymaps now have the form @code{(keymap @var{element}@var{element} @dots{})}. Each @var{element} takes one of the followingforms:@table @asis@item @var{prompt-string}A string as an element of the keymap marks the keymap as a menu, andserves as the overal prompt string for it.@item @code{(@var{key} . @var{binding})}A cons cell binds @var{key} to @var{definition}. Here @var{key} may beany sort of event head---a character, a function key symbol, or a mousebutton symbol.@item @var{vector}A vector of 128 elements binds all the ASCII characters; the @var{n}thelement holds the binding for character number @var{n}.@item @code{(t . @var{binding})}A cons cell whose @sc{car} is @code{t} is a default binding; anythingnot bound by previous keymap elements is given @var{binding} as itsbinding.Default bindings are important because they allow a keymap to bind allpossible events without having to enumerate all the possible functionkeys and mouse clicks, with all possible modifier prefixes.The function @code{lookup-key} (and likewise other functions forexamining a key binding) normally report only explicit bindings of thespecified key sequence; if there is none, they return @code{nil}, evenif there is a default binding that would apply to that key sequence ifit were actually typed in. However, these functions now take anoptional argument @var{accept-defaults} which, if non-@code{nil}, saysto consider default bindings.Note that if a vector in the keymap binds an ASCII character to@code{nil} (thus making it ``unbound''), the default binding does notapply to the character. Think of the vector element as an explicitbinding of @code{nil}.Note also that if the keymap for a minor or major mode contains adefault binding, it completely masks out any lower-priority keymaps.@end table@itemA keymap can now inherit from another keymap. Do do this, make thelatter keymap the ``tail'' of the new one. Such a keymap looks likethis:@example(keymap @var{bindings}@dots{} . @var{other-keymap})@end exampleThe effect is that this keymap inherits all the bindings of@var{other-keymap}, but can add to them or override them with@var{bindings}. Subsequent changes in the bindings of@var{other-keymap} @emph{do} affect this keymap.For example, @example(setq my-mode-map (cons 'keymap text-mode-map))@end example@noindentmakes a keymap that by default inherits all the bindings of Textmode---whatever they may be at the time a key is looked up. Anybindings made explicitly in @code{my-mode-map} override the bindingsinherited from Text mode, however.@itemMinor modes can now have local keymaps. Thus, a key can act a specialway when a minor mode is in effect, and then revert to the major mode orglobal definition when the minor mode is no longer in effect. Theprecedence of keymaps is now: minor modes (in no particular order), thenmajor mode, and lastly the global map.The new @code{current-minor-mode-maps} function returns a list of allthe keymaps of currently enabled minor modes, in the other that theyapply.To set up a keymap for a minor mode, add an element to the alist@code{minor-mode-map-alist}. Its elements look like this:@example(@var{symbol} . @var{keymap})@end exampleThe keymap @var{keymap} is active whenever @var{symbol} has anon-@code{nil} value. Use for @var{symbol} the variable which indicateswhether the minor mode is enabled.When more than one minor mode keymap is active, their order ofprecedence is the order of @code{minor-mode-map-alist}. But you shoulddesign minor modes so that they don't interfere with each other, and ifyou do this properly, the order will not matter.The function @code{minor-mode-key-binding} returns a list of all theactive minor mode bindings of @var{key}. More precisely, it returns analist of pairs @code{(@var{modename} . @var{binding})}, where@var{modename} is the the variable which enables the minor mode, and@var{binding} is @var{key}'s definition in that mode. If @var{key} hasno minor-mode bindings, the value is @code{nil}.If the first binding is a non-prefix, all subsequent bindings from otherminor modes are omitted, since they would be completely shadowed.Similarly, the list omits non-prefix bindings that follow prefixbindings.@itemThe new function @code{copy-keymap} copies a keymap, producing a newkeymap with the same key bindings in it. If the keymap contains otherkeymaps directly, these subkeymaps are copied recursively.If you want to, you can define a prefix key with a binding that is asymbol whose function definition is another keymap. In this case,@code{copy-keymap} does not look past the symbol; it doesn't copy thekeymap inside the symbol.@item@code{substitute-key-definition} now accepts an optional fourthargument, which is a keymap to use as a template.@example(substitute-key-definition olddef newdef keymap oldmap)@end example@noindentfinds all characters defined in @var{oldmap} as @var{olddef},and defines them in @var{keymap} as @var{newdef}.In addition, this function now operates recursively on the keymaps thatdefine prefix keys within @var{keymap} and @var{oldmap}.@end itemize@section Minibuffer FeaturesThe minibuffer input functions @code{read-from-minibuffer} and@code{completing-read} have new features.@subsection Minibuffer HistoryA new optional argument @var{hist} specifies which history list to use.If you specify a variable (a symbol), that variable is the historylist. If you specify a cons cell @code{(@var{variable}. @var{startpos})}, then @var{variable} is the history list variable,and @var{startpos} specifies the initial history position (an integer,counting from zero which specifies the most recent element of thehistory).If you specify @var{startpos}, then you should also specify that elementof the history as @var{initial-input}, for consistency.If you don't specify @var{hist}, then the default history list@code{minibuffer-history} is used. Other standard history lists thatyou can use when appropriate include @code{query-replace-history},@code{command-history}, and @code{file-name-history}.The value of the history list variable is a list of strings, most recentfirst. You should set a history list variable to @code{nil} beforeusing it for the first time.@code{read-from-minibuffer} and @code{completing-read} add new elementsto the history list automatically, and provide commands to allow theuser to reuse items on the list. The only thing your program needs todo to use a history list is to initialize it and to pass its name to theinput functions when you wish. But it is safe to modify the list byhand when the minibuffer input functions are not using it.@subsection Other Minibuffer FeaturesThe @var{initial} argument to @code{read-from-minibufer} and otherminibuffer input functions can now be a cons cell @code{(@var{string}. @var{position})}. This means to start off with @var{string} in theminibuffer, but put the cursor @var{position} characters from thebeginning, rather than at the end.In @code{read-no-blanks-input}, the @var{initial} argument is nowoptional; if it is omitted, the initial input string is the emptystring.@section New Features for Defining Commands@itemize @bullet@itemIf the interactive specification begins with @samp{@@}, this means toselect the window under the mouse. This selection takes place beforedoing anything else with the command.You can use both @samp{@@} and @samp{*} together in one command; theyare processed in order of appearance.@itemPrompts in an interactive specification can incorporate the values ofthe preceding arguments. Emacs replaces @samp{%}-sequences (as usedwith the @code{format} function) in the prompt with the interactivearguments that have been read so far. For example, a command with thisinteractive specification@example(interactive "sReplace: \nsReplace %s with: ")@end example@noindentprompts for the first argument with @samp{Replace: }, and then promptsfor the second argument with @samp{Replace @var{foo} with: }, where@var{foo} is the string read as the first argument.@itemIf a command name has a property @code{enable-recursive-minibuffers}which is non-@code{nil}, then the command can use the minibuffer to readarguments even if it is invoked from the minibuffer. The minibuffercommand @code{next-matching-history-element} (normally bound to@kbd{M-s} in the minibuffer) uses this feature.@end itemize@section New Features for Reading Input@itemize @bullet@itemThe function @code{set-input-mode} now takes four arguments. The lastargument is optional. Their names are @var{interrupt}, @var{flow},@var{meta} and @var{quit}.The argument @var{interrupt} says whether to use interrupt-driveninput. Non-@code{nil} means yes, and @code{nil} means no (use CBREAKmode).The argument @var{flow} says whether to enable terminal flow control.Non-@code{nil} means yes.The argument @var{meta} says whether to enable the use of a Meta key.Non-@code{nil} means yes.If @var{quit} non-@code{nil}, it is the character to use for quitting.(Normally this is @kbd{C-g}.)@itemThe variable @code{meta-flag} has been deleted; use@code{set-input-mode} to enable or disable support for a @key{META}key. This change was made because @code{set-input-mode} can send theterminal the appropriate commands to enable or disable operation of the@key{META} key.@itemThe new variable @code{extra-keyboard-modifiers} lets Lisp programs``press'' the modifier keys on the keyboard.The value is a bit mask:@table @asis@item 1The @key{SHIFT} key.@item 2The @key{LOCK} key.@item 4The @key{CTL} key.@item 8The @key{META} key.@end tableWhen you use X windows, the program can press any of the modifier keysin this way. Otherwise, only the @key{CTL} and @key{META} keys can bevirtually pressed.@itemYou can use the new function @code{keyboard-translate} to set up @code{keyboard-translate-table} conveniently.@itemY-or-n questions using the @code{y-or-n-p} function now accept @kbd{C-]}(usually mapped to @code{abort-recursive-edit}) as well as @kbd{C-g} toquit.@itemThe variable @code{num-input-keys} is the total number of key sequences that the user has typed during this Emacs session.@itemA new Lisp variable, @code{function-key-map}, holds a keymap whichdescribes the character sequences sent by function keys on an ordinarycharacter terminal. This uses the same keymap data structure that isused to hold bindings of key sequences, but it has a different meaning:it specifies translations to make while reading a key sequence.If @code{function-key-map} ``binds'' a key sequence @var{k} to a vector@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in akey sequence, it is replaced with @var{v}.For example, VT100 terminals send @kbd{@key{ESC} O P} when the ``keypad''PF1 key is pressed. Thus, on a VT100, @code{function-key-map} should``bind'' that sequence to @code{[pf1]}. This specifies translation of@kbd{@key{ESC} O P} into @key{PF1} anywhere in a key sequence.Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c@key{ESC} O P}, but @code{read-key-sequence} translates this back into@kbd{C-c @key{PF1}}, which it returns as the vector @code{[?\C-c PF1]}.Entries in @code{function-key-map} are ignored if they conflict withbindings made in the minor mode, local, or global keymaps.The value of @code{function-key-map} is usually set up automaticallyaccording to the terminal's Terminfo or Termcap entry, and theterminal-specific Lisp files. Emacs comes with a number ofterminal-specific files for many common terminals; their main purpose isto make entries in @code{function-key-map} beyond those that can bededuced from Termcap and Terminfo.@itemThe variable @code{key-translation-map} works like @code{function-key-map}except for two things:@itemize @bullet@item@code{key-translation-map} goes to work after @code{function-key-map} isfinished; it receives the results of translation by@code{function-key-map}.@item@code{key-translation-map} overrides actual key bindings.@end itemizeThe intent of @code{key-translation-map} is for users to map onecharacter set to another, including ordinary characters normally boundto @code{self-insert-command}.@end itemize@section New Syntax Table Features@itemize @bullet@itemYou can use two new functions to move across characters in certainsyntax classes.@code{skip-syntax-forward} moves point forward across characters whosesyntax classes are mentioned in its first argument, a string. It stopswhen it encounters the end of the buffer, or position @var{lim} (theoptional second argument), or a character it is not supposed to skip.The function @code{skip-syntax-backward} is similar but moves backward.@itemThe new function @code{forward-comment} moves point by comments. Ittakes one argument, @var{count}; it moves point forward across@var{count} comments (backward, if @var{count} is negative). If itfinds anything other than a comment or whitespace, it stops, leavingpoint at the far side of the last comment found. It also stops aftersatisfying @var{count}.@itemThe new variable @code{words-include-escapes} affects the behavior of@code{forward-word} and everything that uses it. If it isnon-@code{nil}, then characters in the ``escape'' and ``characterquote'' syntax classes count as part of words.@itemThere are two new syntax flags for use in syntax tables.@itemize -@itemThe prefix flag.The @samp{p} flag identifies additional ``prefix characters'' in Lispsyntax. You can set this flag with @code{modify-syntax-entry} byincluding the letter @samp{p} in the syntax specification.These characters are treated as whitespace when they appear betweenexpressions. When they appear withing an expression, they are handledaccording to their usual syntax codes.The function @code{backward-prefix-chars} moves back over thesecharacters, as well as over characters whose primary syntax class isprefix (@samp{'}).@itemThe @samp{b} comment style flag.Emacs can now supports two comment styles simultaneously. (This is forthe sake of C++.) More specifically, it can recognize two differentcomment-start sequences. Both must share the same first character; onlythe second character may differ. Mark the second character of the@samp{b}-style comment start sequence with the @samp{b} flag. You canset this flag with @code{modify-syntax-entry} by including the letter@samp{b} in the syntax specification.The two styles of comment can have different comment-end sequences. Acomment-end sequence (one or two characters) applies to the @samp{b}style if its first character has the @samp{b} flag set; otherwise, itapplies to the @samp{a} style.The appropriate comment syntax settings for C++ are as follows:@table @asis@item @samp{/}@samp{124b}@item @samp{*}@samp{23}@item newline@samp{>b}@end tableThus @samp{/*} is a comment-start sequence for @samp{a} style, @samp{//}is a comment-start sequence for @samp{b} style, @samp{*/} is acomment-end sequence for @samp{a} style, and newline is a comment-endsequence for @samp{b} style.@end itemize@end itemize@section The Case TableYou can customize case conversion using the new case table feature. Acase table is a collection of strings that specifies the mapping betweenupper case and lower case letters. Each buffer has its own case table.You need a case table if you are using a language which has letters thatare not standard ASCII letters.A case table is a list of this form:@example(@var{downcase} @var{upcase} @var{canonicalize} @var{equivalences})@end example@noindentwhere each element is either @code{nil} or a string of length 256. Theelement @var{downcase} says how to map each character to its lower-caseequivalent. The element @var{upcase} maps each character to itsupper-case equivalent. If lower and upper case characters are in 1-1correspondence, use @code{nil} for @var{upcase}; then Emacs deduces theupcase table from @var{downcase}.For some languages, upper and lower case letters are not in 1-1correspondence. There may be two different lower case letters with thesame upper case equivalent. In these cases, you need to specify themaps for both directions.The element @var{canonicalize} maps each character to a canonicalequivalent; any two characters that are related by case-conversion havethe same canonical equivalent character.The element @var{equivalences} is a map that cyclicly permutes eachequivalence class (of characters with the same canonical equivalent).You can provide @code{nil} for both @var{canonicalize} and@var{equivalences}, in which case both are deduced from @var{downcase}and @var{upcase}.Here are the functions for working with case tables:@code{case-table-p} is a predicate that says whether a Lisp object is avalid case table.@code{set-standard-case-table} takes one argument and makes thatargument the case table for new buffers created subsequently.@code{standard-case-table} returns the current value of the new buffercase table.@code{current-case-table} returns the case table of the current buffer.@code{set-case-table} sets the current buffer's case table to theargument.@code{set-case-syntax-pair} is a convenient function for specifying apair of letters, upper case and lower case. Call it with two arguments,the upper case letter and the lower case letter. It modifies thestandard case table and a few syntax tables that are predefined inEmacs. This function is intended as a subroutine for packages thatdefine non-ASCII character sets.Load the library @file{iso-syntax} to set up the syntax and case table forthe 256 bit ISO Latin 1 character set.@section New Features for Dealing with Buffers@itemize @bullet@itemThe new function @code{buffer-modified-tick} returns a buffer'smodification-count that ticks every time the buffer is modified. Ittakes one optional argument, which is the buffer you want to examine.If the argument is @code{nil} (or omitted), the current buffer is used.@item@code{buffer-disable-undo} is a new name for the functionformerly known as @code{buffer-flush-undo}. This turns off recordingof undo information in the buffer given as argument.@itemThe new function @code{generate-new-buffer-name} chooses a name thatwould be unique for a new buffer---but does not create the buffer. Giveit one argument, a starting name. It produces a name not in use for abuffer by appending a number inside of @samp{<@dots{}>}.@itemThe function @code{rename-buffer} now takes an option second argumentwhich tells it that if the specified new name corresponds to an existingbuffer, it should use @code{generate-new-buffer-name} to modify the nameto be unique, rather than signaling an error.@code{rename-buffer} now returns the name to which the buffer wasrenamed.@itemThe function @code{list-buffers} now looks at the local variable@code{list-buffers-directory} in each non-file-visiting buffer, andshows its value where the file would normally go. Dired sets thisvariable in each Dired buffer, so the buffer list now shows whichdirectory each Dired buffer is editing.@itemThe function @code{other-buffer} now takes an optional second argument@var{visible-ok} which, if non-@code{nil}, indicates that bufferscurrently being displayed in windows may be returned even if there areother buffers not visible. Normally, @code{other-buffer} returns acurrently visible buffer only as a last resort, if there are no suitablenonvisible buffers.@itemThe hook @code{kill-buffer-hook} now runs whenever a buffer is killed.@end itemize@section Local Variables Features@itemize @bullet@itemIf a local variable name has a non-@code{nil} @code{permanent-local}property, then @code{kill-all-local-variables} does not kill it. Suchlocal variables are ``permanent''---they remain unchanged even if youselect a different major mode.Permanent locals are useful when they have to do with where the filecame from or how to save it, rather than with how to edit the contents.@itemThe function @code{make-local-variable} now never changes the value of the variablethat it makes local. If the variable had no value before, it still hasno value after becoming local.@itemThe new function @code{default-boundp} tells you whether a variable hasa default value (as opposed to being unbound in its default value). If@code{(default-boundp 'foo)} returns @code{nil}, then@code{(default-value 'foo)} would get an error.@code{default-boundp} is to @code{default-value} as @code{boundp} is to@code{symbol-value}.@itemThe special forms @code{defconst} and @code{defvar}, when the variableis local in the current buffer, now set the variable's default valuerather than its local value.@end itemize@section New Features for Subprocesses@itemize @bullet@item@code{call-process} and @code{call-process-region} now return a valuethat indicates how the synchronous subprocess terminated. It is eithera number, which is the exit status of a process, or a signal namerepresented as a string.@item@code{process-status} now returns @code{open} and @code{closed} as thestatus values for network connections.@itemThe standard asynchronous subprocess features work on VMS now,and the special VMS asynchronous subprocess functions have been deleted.@itemYou can use the transaction queue feature for more convenientcommunication with subprocesses using transactions.Call @code{tq-create} to create a transaction queue communicating with aspecified process. Then you can call @code{tq-enqueue} to send atransaction. @code{tq-enqueue} takes these five arguments:@example(tq-enqueue @var{tq} @var{question} @var{regexp} @var{closure} @var{fn})@end example@var{tq} is the queue to use. (Specifying the queue has the effect ofspecifying the process to talk to.) The argument @var{question} is theoutgoing message which starts the transaction. The argument @var{fn} isthe function to call when the corresponding answer comes back; it iscalled with two arguments: @var{closure}, and the answer received.The argument @var{regexp} is a regular expression to match the entireanswer; that's how @code{tq-enqueue} tells where the answer ends.Call @code{tq-close} to shut down a transaction queue and terminate itssubprocess.@item The function @code{signal-process} sends a signal to process @var{pid},which need not be a child of Emacs. The second argument @var{signal}specifies which signal to send; it should be an integer.@end itemize@section New Features for Dealing with Times And Time Delays@itemize @bullet@itemThe new function @code{current-time} returns the system's time value asa list of three integers: @code{(@var{high} @var{low} @var{microsec})}.The integers @var{high} and @var{low} combine to give the number ofseconds since 0:00 January 1, 1970, which is @var{high} * 2**16 +@var{low}.@var{microsec} gives the microseconds since the start of the currentsecond (or 0 for systems that return time only on the resolution of asecond).@itemThe function @code{current-time-string} accepts an optional argument@var{time-value}. If given, this specifies a time to format instead ofthe current time. The argument should be a cons cell containing twointegers, or a list whose first two elements are integers. Thus, youcan use times obtained from @code{current-time} (see above) and from@code{file-attributes}.@itemYou can now find out the user's time zone using @code{current-time-zone}.It takes no arguments, and returns a list of this form:@example(@var{offset} @var{savings-flag} @var{standard} @var{savings})@end example@var{offset} is an integer specifying how many minutes east of Greenwichthe current time zone is located. A negative value means west ofGreenwich. Note that this describes the standard time; if daylightsavings time is in effect, it does not affect this value.@var{savings-flag} is non-@code{nil} iff daylight savings time or some othersort of seasonal time adjustment is in effect.@var{standard} is a string giving the name of the time zone when noseasonal time adjustment is in effect.@var{savings} is a string giving the name of the time zone when there is aseasonal time adjustment in effect.If the user has specified a region that does not use a seasonal timeadjustment, @var{savings-flag} is always @code{nil}, and @var{standard}and @var{savings} are equal.@item@code{sit-for}, @code{sleep-for} now let you specify the time period inmilliseconds as well as in seconds. The first argument gives the numberof seconds, as before, and the optional second argument gives additionalmilliseconds. The time periods specified by these two arguments areadded together.Not all systems support this; you get an error if you specify nonzeromilliseconds and it isn't supported.@code{sit-for} also accepts an optional third argument @var{nodisp}. Ifthis is non-@code{nil}, @code{sit-for} does not redisplay. It stillwaits for the specified time or until input is available.@item@code{accept-process-output} now accepts a timeout specified by optionalsecond and third arguments. The second argument specifies the number ofseconds, while the third specifies the number of milliseconds. The timeperiods specified by these two arguments are added together.Not all systems support this; you get an error if you specify nonzeromilliseconds and it isn't supported.The function returns @code{nil} if the timeout expired before outputarrived, or non-@code{nil} if it did get some output.@itemYou can set up a timer to call a function at a specified future time.To do so, call @code{run-at-time}, like this:@example(run-at-time @var{time} @var{repeat} @var{function} @var{args}@dots{})@end exampleHere, @var{time} is a string saying when to call the function. Theargument @var{function} is the function to call later, and @var{args}are the arguments to give it when it is called.The argument @var{repeat} specifies how often to repeat the call. If@var{repeat} is @code{nil}, there are no repetitions; @var{function} iscalled just once, at @var{time}. If @var{repeat} is an integer, itspecifies a repetition period measured in seconds.Absolute times may be specified in a wide variety of formats; The form@samp{@var{hour}:@var{min}:@var{sec} @var{timezone}@var{month}/@var{day}/@var{year}}, where all fields are numbers, works;the format that @code{current-time-string} returns is also allowed.To specify a relative time, use numbers followed by units.For example:@table @samp@item 1 mindenotes 1 minute from now.@item 1 min 5 secdenotes 65 seconds from now.@item 1 min 2 sec 3 hour 4 day 5 week 6 fortnight 7 month 8 yeardenotes exactly 103 months, 123 days, and 10862 seconds from now.@end tableIf @var{time} is an integer, that specifies a relative time measured inseconds.@end itemizeTo cancel the requested future action, pass the value that @code{run-at-time}returned to the function @code{cancel-timer}.@section Profiling Lisp ProgramsYou can now make execution-time profiles of Emacs Lisp programs usingthe @file{profile} library. See the file @file{profile.el} forinstructions; if you have written a Lisp program big enough to be worthprofiling, you can surely understand them.@section New Features for Lisp Debuggers@itemize @bullet@itemYou can now specify which kinds of errors should invoke the Lispdebugger by setting the variable @code{debug-on-error} to a list of errorconditions. For example, if you set it to the list @code{(void-variable)},then only errors about a variable that has no value invoke thedebugger.@itemThe variable @code{command-debug-status} is used by Lisp debuggers. Itrecords the debugging status of current interactive command. Each timea command is called interactively, this variable is bound to@code{nil}. The debugger can set this variable to leave information forfuture debugger invocations during the same command.The advantage of this variable over some other variable in the debuggeritself is that the data will not be visible for any other commandinvocation.@itemThe function @code{backtrace-frame} is intended for use in Lispdebuggers. It returns information about what a frame on the Lisp callstack is doing. You specify one argument, which is the number of stackframes to count up from the current execution point.If that stack frame has not evaluated the arguments yet (or is a specialform), the value is @code{(nil @var{function} @var{arg-forms}@dots{})}.If that stack frame has evaluated its arguments and called its functionalready, the value is @code{(t @var{function}@var{arg-values}@dots{})}.In the return value, @var{function} is whatever was supplied as @sc{car}of evaluated list, or a @code{lambda} expression in the case of a macrocall. If the function has a @code{&rest} argument, that is representedas the tail of the list @var{arg-values}.If the argument is out of range, @code{backtrace-frame} returns@code{nil}.@end itemize@ignore@item@code{kill-ring-save} now gives visual feedback to indicate the regionof text being added to the kill ring. If the opposite end of theregion is visible in the current window, the cursor blinks there.Otherwise, some text from the other end of the region is displayed inthe message area.@end ignore@section Memory Allocation ChangesThe list that @code{garbage-collect} returns now has one additionalelement. This is a cons cell containing two numbers. It givesinformation about the number of used and free floating point numbers,much as the first element gives such information about the number ofused and free cons cells.The new function @code{memory-limit} returns an indication of the lastaddress allocated by Emacs. More precisely, it returns that addressdivided by 1024. You can use this to get a general idea of how youractions affect the memory usage.@section Hook Changes@itemize @bullet@itemExpanding an abbrev first runs the new hook@code{pre-abbrev-expand-hook}.@itemThe editor command loop runs the normal hook @code{pre-command-hook}before each command, and runs @code{post-command-hook} after eachcommand.@itemAuto-saving runs the new hook @code{auto-save-hook} before actuallystarting to save any files.@itemThe new variable @code{revert-buffer-insert-file-contents-function}holds a function that @code{revert-buffer} now uses to read in thecontents of the reverted buffer---instead of calling@code{insert-file-contents}.@itemThe variable @code{lisp-indent-hook} has been renamed to@code{lisp-indent-function}.@itemThe variable @code{auto-fill-hook} has been renamed to@code{auto-fill-function}.@itemThe variable @code{blink-paren-hook} has been renamed to@code{blink-paren-function}.@itemThe variable @code{temp-buffer-show-hook} has been renamed to@code{temp-buffer-show-function}.@itemThe variable @code{suspend-hook} has been renamed to@code{suspend-hooks}, because it is a list of functions but is not anormal hook.@itemThe new function @code{add-hook} provides a handy way to add a functionto a hook variable. For example,@example(add-hook 'text-mode-hook 'my-text-hook-function)@end example@noindentarranges to call @code{my-text-hook-function}when entering Text mode or related modes.@end itemize@bye