annotate etc/LNEWS @ 75:a4e0195b387b

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