Mercurial > emacs
annotate lispref/display.texi @ 22140:26e470569368
(uniquify-ignore-buffers-re): New variable.
(uniquify-rationalize-file-buffer-names): Implement it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 19 May 1998 05:07:48 +0000 |
parents | d4ac295a98b3 |
children | 40089afa2b1d |
rev | line source |
---|---|
6598 | 1 @c -*-texinfo-*- |
2 @c This is part of the GNU Emacs Lisp Reference Manual. | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc. |
6598 | 4 @c See the file elisp.texi for copying conditions. |
5 @setfilename ../info/display | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
6 @node Display, Calendar, Processes, Top |
6598 | 7 @chapter Emacs Display |
8 | |
9 This chapter describes a number of features related to the display | |
10 that Emacs presents to the user. | |
11 | |
12 @menu | |
13 * Refresh Screen:: Clearing the screen and redrawing everything on it. | |
14 * Screen Size:: How big is the Emacs screen. | |
15 * Truncation:: Folding or wrapping long text lines. | |
16 * The Echo Area:: Where messages are displayed. | |
12067 | 17 * Invisible Text:: Hiding part of the buffer text. |
18 * Selective Display:: Hiding part of the buffer text (the old way). | |
6598 | 19 * Overlay Arrow:: Display of an arrow to indicate position. |
20 * Temporary Displays:: Displays that go away automatically. | |
21 * Overlays:: Use overlays to highlight parts of the buffer. | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
22 * Width:: How wide is a character or string. |
6598 | 23 * Faces:: A face defines a graphics appearance: font, color, etc. |
24 * Blinking:: How Emacs shows the matching open parenthesis. | |
25 * Inverse Video:: Specifying how the screen looks. | |
26 * Usual Display:: The usual conventions for displaying nonprinting chars. | |
27 * Display Tables:: How to specify other conventions. | |
28 * Beeping:: Audible signal to the user. | |
29 * Window Systems:: Which window system is being used. | |
30 @end menu | |
31 | |
32 @node Refresh Screen | |
33 @section Refreshing the Screen | |
34 | |
35 The function @code{redraw-frame} redisplays the entire contents of a | |
36 given frame. @xref{Frames}. | |
37 | |
38 @c Emacs 19 feature | |
39 @defun redraw-frame frame | |
40 This function clears and redisplays frame @var{frame}. | |
41 @end defun | |
42 | |
43 Even more powerful is @code{redraw-display}: | |
44 | |
45 @deffn Command redraw-display | |
46 This function clears and redisplays all visible frames. | |
47 @end deffn | |
48 | |
12098 | 49 Processing user input takes absolute priority over redisplay. If you |
50 call these functions when input is available, they do nothing | |
51 immediately, but a full redisplay does happen eventually---after all the | |
52 input has been processed. | |
53 | |
6598 | 54 Normally, suspending and resuming Emacs also refreshes the screen. |
55 Some terminal emulators record separate contents for display-oriented | |
56 programs such as Emacs and for ordinary sequential display. If you are | |
57 using such a terminal, you might want to inhibit the redisplay on | |
9009 | 58 resumption. |
6598 | 59 |
60 @defvar no-redraw-on-reenter | |
61 @cindex suspend (cf. @code{no-redraw-on-reenter}) | |
62 @cindex resume (cf. @code{no-redraw-on-reenter}) | |
63 This variable controls whether Emacs redraws the entire screen after it | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
64 has been suspended and resumed. Non-@code{nil} means there is no need |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
65 to redraw, @code{nil} means redrawing is needed. The default is @code{nil}. |
6598 | 66 @end defvar |
67 | |
68 @node Screen Size | |
69 @section Screen Size | |
70 @cindex size of screen | |
71 @cindex screen size | |
72 @cindex display lines | |
73 @cindex display columns | |
74 @cindex resize redisplay | |
75 | |
9009 | 76 The screen size functions access or specify the height or width of |
6598 | 77 the terminal. When you are using multiple frames, they apply to the |
78 selected frame (@pxref{Frames}). | |
79 | |
80 @defun screen-height | |
81 This function returns the number of lines on the screen that are | |
82 available for display. | |
83 | |
84 @example | |
85 @group | |
86 (screen-height) | |
87 @result{} 50 | |
88 @end group | |
89 @end example | |
90 @end defun | |
91 | |
92 @defun screen-width | |
93 This function returns the number of columns on the screen that are | |
94 available for display. | |
95 | |
96 @example | |
97 @group | |
98 (screen-width) | |
99 @result{} 80 | |
100 @end group | |
101 @end example | |
102 @end defun | |
103 | |
104 @defun set-screen-height lines &optional not-actual-size | |
105 This function declares that the terminal can display @var{lines} lines. | |
106 The sizes of existing windows are altered proportionally to fit. | |
107 | |
108 If @var{not-actual-size} is non-@code{nil}, then Emacs displays | |
109 @var{lines} lines of output, but does not change its value for the | |
110 actual height of the screen. (Knowing the correct actual size may be | |
111 necessary for correct cursor positioning.) Using a smaller height than | |
112 the terminal actually implements may be useful to reproduce behavior | |
113 observed on a smaller screen, or if the terminal malfunctions when using | |
114 its whole screen. | |
115 | |
116 If @var{lines} is different from what it was previously, then the | |
117 entire screen is cleared and redisplayed using the new size. | |
118 | |
119 This function returns @code{nil}. | |
120 @end defun | |
121 | |
122 @defun set-screen-width columns &optional not-actual-size | |
123 This function declares that the terminal can display @var{columns} | |
124 columns. The details are as in @code{set-screen-height}. | |
125 @end defun | |
126 | |
127 @node Truncation | |
128 @section Truncation | |
129 @cindex line wrapping | |
130 @cindex continuation lines | |
131 @cindex @samp{$} in display | |
132 @cindex @samp{\} in display | |
133 | |
134 When a line of text extends beyond the right edge of a window, the | |
135 line can either be continued on the next screen line, or truncated to | |
136 one screen line. The additional screen lines used to display a long | |
137 text line are called @dfn{continuation} lines. Normally, a @samp{$} in | |
138 the rightmost column of the window indicates truncation; a @samp{\} on | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
139 the rightmost column indicates a line that ``wraps'' onto the next line, |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
140 which is also called @dfn{continuing} the line. (The display table can |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
141 specify alternative indicators; see @ref{Display Tables}.) |
6598 | 142 |
143 Note that continuation is different from filling; continuation happens | |
144 on the screen only, not in the buffer contents, and it breaks a line | |
145 precisely at the right margin, not at a word boundary. @xref{Filling}. | |
146 | |
147 @defopt truncate-lines | |
148 This buffer-local variable controls how Emacs displays lines that extend | |
149 beyond the right edge of the window. The default is @code{nil}, which | |
150 specifies continuation. If the value is non-@code{nil}, then these | |
151 lines are truncated. | |
152 | |
153 If the variable @code{truncate-partial-width-windows} is non-@code{nil}, | |
154 then truncation is always used for side-by-side windows (within one | |
155 frame) regardless of the value of @code{truncate-lines}. | |
156 @end defopt | |
157 | |
12098 | 158 @defopt default-truncate-lines |
6598 | 159 This variable is the default value for @code{truncate-lines}, for |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
160 buffers that do not have buffer-local values for it. |
12098 | 161 @end defopt |
6598 | 162 |
163 @defopt truncate-partial-width-windows | |
164 This variable controls display of lines that extend beyond the right | |
165 edge of the window, in side-by-side windows (@pxref{Splitting Windows}). | |
166 If it is non-@code{nil}, these lines are truncated; otherwise, | |
167 @code{truncate-lines} says what to do with them. | |
168 @end defopt | |
169 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
170 When horizontal scrolling (@pxref{Horizontal Scrolling}) is in use in |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
171 a window, that forces truncation. |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
172 |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
173 You can override the glyphs that indicate continuation or truncation |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
174 using the display table; see @ref{Display Tables}. |
6598 | 175 |
12067 | 176 If your buffer contains @strong{very} long lines, and you use |
177 continuation to display them, just thinking about them can make Emacs | |
12098 | 178 redisplay slow. The column computation and indentation functions also |
179 become slow. Then you might find it advisable to set | |
180 @code{cache-long-line-scans} to @code{t}. | |
12067 | 181 |
182 @defvar cache-long-line-scans | |
183 If this variable is non-@code{nil}, various indentation and motion | |
12098 | 184 functions, and Emacs redisplay, cache the results of scanning the |
185 buffer, and consult the cache to avoid rescanning regions of the buffer | |
186 unless they are modified. | |
12067 | 187 |
12098 | 188 Turning on the cache slows down processing of short lines somewhat. |
12067 | 189 |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
190 This variable is automatically buffer-local in every buffer. |
12067 | 191 @end defvar |
192 | |
6598 | 193 @node The Echo Area |
194 @section The Echo Area | |
195 @cindex error display | |
196 @cindex echo area | |
197 | |
12067 | 198 The @dfn{echo area} is used for displaying messages made with the |
6598 | 199 @code{message} primitive, and for echoing keystrokes. It is not the |
200 same as the minibuffer, despite the fact that the minibuffer appears | |
201 (when active) in the same place on the screen as the echo area. The | |
202 @cite{GNU Emacs Manual} specifies the rules for resolving conflicts | |
203 between the echo area and the minibuffer for use of that screen space | |
204 (@pxref{Minibuffer,, The Minibuffer, emacs, The GNU Emacs Manual}). | |
205 Error messages appear in the echo area; see @ref{Errors}. | |
206 | |
207 You can write output in the echo area by using the Lisp printing | |
208 functions with @code{t} as the stream (@pxref{Output Functions}), or as | |
209 follows: | |
210 | |
211 @defun message string &rest arguments | |
12067 | 212 This function displays a one-line message in the echo area. The |
6598 | 213 argument @var{string} is similar to a C language @code{printf} control |
214 string. See @code{format} in @ref{String Conversion}, for the details | |
215 on the conversion specifications. @code{message} returns the | |
216 constructed string. | |
217 | |
7735
7db892210924
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7086
diff
changeset
|
218 In batch mode, @code{message} prints the message text on the standard |
7db892210924
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7086
diff
changeset
|
219 error stream, followed by a newline. |
7db892210924
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7086
diff
changeset
|
220 |
6598 | 221 @c Emacs 19 feature |
222 If @var{string} is @code{nil}, @code{message} clears the echo area. If | |
223 the minibuffer is active, this brings the minibuffer contents back onto | |
224 the screen immediately. | |
7735
7db892210924
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
7086
diff
changeset
|
225 |
6598 | 226 @example |
227 @group | |
228 (message "Minibuffer depth is %d." | |
229 (minibuffer-depth)) | |
230 @print{} Minibuffer depth is 0. | |
231 @result{} "Minibuffer depth is 0." | |
232 @end group | |
233 | |
234 @group | |
235 ---------- Echo Area ---------- | |
236 Minibuffer depth is 0. | |
237 ---------- Echo Area ---------- | |
238 @end group | |
239 @end example | |
240 @end defun | |
241 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
242 @defun current-message |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
243 @tindex current-message |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
244 This function returns the message currently being displayed in the |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
245 echo area, or @code{nil} if there is none. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
246 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
247 |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
248 @defvar cursor-in-echo-area |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
249 This variable controls where the cursor appears when a message is |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
250 displayed in the echo area. If it is non-@code{nil}, then the cursor |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
251 appears at the end of the message. Otherwise, the cursor appears at |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
252 point---not in the echo area at all. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
253 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
254 The value is normally @code{nil}; Lisp programs bind it to @code{t} |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
255 for brief periods of time. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
256 @end defvar |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
257 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
258 @defvar echo-area-clear-hook |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
259 @tindex echo-area-clear-hook |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
260 This normal hook is run whenever the echo area is cleared---either by |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
261 @code{(message nil)} or for any other reason. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
262 @end defvar |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
263 |
12067 | 264 Almost all the messages displayed in the echo area are also recorded |
265 in the @samp{*Messages*} buffer. | |
266 | |
267 @defopt message-log-max | |
268 This variable specifies how many lines to keep in the @samp{*Messages*} | |
269 buffer. The value @code{t} means there is no limit on how many lines to | |
270 keep. The value @code{nil} disables message logging entirely. Here's | |
271 how to display a message and prevent it from being logged: | |
272 | |
273 @example | |
274 (let (message-log-max) | |
275 (message @dots{})) | |
276 @end example | |
277 @end defopt | |
278 | |
12098 | 279 @defvar echo-keystrokes |
280 This variable determines how much time should elapse before command | |
281 characters echo. Its value must be an integer, which specifies the | |
282 number of seconds to wait before echoing. If the user types a prefix | |
283 key (such as @kbd{C-x}) and then delays this many seconds before | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
284 continuing, the prefix key is echoed in the echo area. (Once echoing |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
285 begins in a key sequence, all subsequent characters in the same key |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
286 sequence are echoed immediately.) |
12098 | 287 |
288 If the value is zero, then command input is not echoed. | |
289 @end defvar | |
290 | |
12067 | 291 @node Invisible Text |
292 @section Invisible Text | |
293 | |
294 @cindex invisible text | |
295 You can make characters @dfn{invisible}, so that they do not appear on | |
296 the screen, with the @code{invisible} property. This can be either a | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
297 text property (@pxref{Text Properties}) or a property of an overlay |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
298 (@pxref{Overlays}). |
12067 | 299 |
300 In the simplest case, any non-@code{nil} @code{invisible} property makes | |
301 a character invisible. This is the default case---if you don't alter | |
302 the default value of @code{buffer-invisibility-spec}, this is how the | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
303 @code{invisible} property works. |
12067 | 304 |
305 More generally, you can use the variable @code{buffer-invisibility-spec} | |
306 to control which values of the @code{invisible} property make text | |
307 invisible. This permits you to classify the text into different subsets | |
308 in advance, by giving them different @code{invisible} values, and | |
309 subsequently make various subsets visible or invisible by changing the | |
310 value of @code{buffer-invisibility-spec}. | |
311 | |
312 Controlling visibility with @code{buffer-invisibility-spec} is | |
313 especially useful in a program to display the list of entries in a data | |
314 base. It permits the implementation of convenient filtering commands to | |
315 view just a part of the entries in the data base. Setting this variable | |
316 is very fast, much faster than scanning all the text in the buffer | |
12098 | 317 looking for properties to change. |
12067 | 318 |
319 @defvar buffer-invisibility-spec | |
320 This variable specifies which kinds of @code{invisible} properties | |
321 actually make a character invisible. | |
322 | |
323 @table @asis | |
324 @item @code{t} | |
325 A character is invisible if its @code{invisible} property is | |
326 non-@code{nil}. This is the default. | |
327 | |
328 @item a list | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
329 Each element of the list specifies a criterion for invisibility; if a |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
330 character's @code{invisible} property fits any one of these criteria, |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
331 the character is invisible. The list can have two kinds of elements: |
12067 | 332 |
333 @table @code | |
334 @item @var{atom} | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
335 A character is invisible if its @code{invisible} property value |
12067 | 336 is @var{atom} or if it is a list with @var{atom} as a member. |
337 | |
338 @item (@var{atom} . t) | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
339 A character is invisible if its @code{invisible} property value |
12067 | 340 is @var{atom} or if it is a list with @var{atom} as a member. |
341 Moreover, if this character is at the end of a line and is followed | |
342 by a visible newline, it displays an ellipsis. | |
343 @end table | |
344 @end table | |
345 @end defvar | |
346 | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
347 Two functions are specifically provided for adding elements to |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
348 @code{buffer-invisibility-spec} and removing elements from it. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
349 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
350 @defun add-to-invisibility-spec element |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
351 @tindex add-to-invisibility-spec |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
352 Add the element @var{element} to @code{buffer-invisibility-spec} |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
353 (if it is not already present in that list). |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
354 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
355 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
356 @defun remove-from-invisibility-spec element |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
357 @tindex remove-from-invisibility-spec |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
358 Remove the element @var{element} from @code{buffer-invisibility-spec}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
359 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
360 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
361 One convention about the use of @code{buffer-invisibility-spec} is |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
362 that a major mode should use the mode's own name as an element of |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
363 @code{buffer-invisibility-spec} and as the value of the @code{invisible} |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
364 property: |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
365 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
366 @example |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
367 ;; @r{If you want to display an ellipsis:} |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
368 (add-to-invisibility-spec '(my-symbol . t)) |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
369 ;; @r{If you don't want ellipsis:} |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
370 (add-to-invisibility-spec 'my-symbol) |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
371 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
372 (overlay-put (make-overlay beginning end) |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
373 'invisible 'my-symbol) |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
374 |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
375 ;; @r{When done with the overlays:} |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
376 (remove-from-invisibility-spec '(my-symbol . t)) |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
377 ;; @r{Or respectively:} |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
378 (remove-from-invisibility-spec 'my-symbol) |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
379 @end example |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
380 |
15761
77d451c08a30
Document line-move-ignore-invisible.
Richard M. Stallman <rms@gnu.org>
parents:
15074
diff
changeset
|
381 @vindex line-move-ignore-invisible |
12098 | 382 Ordinarily, commands that operate on text or move point do not care |
15761
77d451c08a30
Document line-move-ignore-invisible.
Richard M. Stallman <rms@gnu.org>
parents:
15074
diff
changeset
|
383 whether the text is invisible. The user-level line motion commands |
77d451c08a30
Document line-move-ignore-invisible.
Richard M. Stallman <rms@gnu.org>
parents:
15074
diff
changeset
|
384 explicitly ignore invisible newlines if |
77d451c08a30
Document line-move-ignore-invisible.
Richard M. Stallman <rms@gnu.org>
parents:
15074
diff
changeset
|
385 @code{line-move-ignore-invisible} is non-@code{nil}, but only because |
77d451c08a30
Document line-move-ignore-invisible.
Richard M. Stallman <rms@gnu.org>
parents:
15074
diff
changeset
|
386 they are explicitly programmed to do so. |
12098 | 387 |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
388 Incremental search can make invisible overlays visible temporarily |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
389 and/or permanently when a match includes invisible text. To enable |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
390 this, the overlay should have a non-@code{nil} |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
391 @code{isearch-open-invisible} property. The property value should be a |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
392 function to be called with the overlay as an argument. This function |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
393 should make the overlay visible permanently; it is used when the match |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
394 overlaps the overlay on exit from the search. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
395 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
396 During the search, such overlays are made temporarily visible by |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
397 temporarily modifying their invisible and intangible properties. If you |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
398 want this to be done differently for a certain overlays, give it a |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
399 @code{isearch-open-invisible-temporary} property which is a function. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
400 The function is called with two arguments: the first is the overlay, and |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
401 the second is @code{t} to make the overlay visible, or @code{nil} to |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
402 make it invisible again. |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
403 |
6598 | 404 @node Selective Display |
405 @section Selective Display | |
406 @cindex selective display | |
407 | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
408 @dfn{Selective display} refers to a pair of related features for |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
409 hiding certain lines on the screen. |
6598 | 410 |
411 The first variant, explicit selective display, is designed for use in | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
412 a Lisp program: it controls which lines are hidden by altering the text. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
413 The invisible text feature (@pxref{Invisible Text}) has partially |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
414 replaced this feature. |
12067 | 415 |
416 In the second variant, the choice of lines to hide is made | |
12098 | 417 automatically based on indentation. This variant is designed to be a |
12067 | 418 user-level feature. |
6598 | 419 |
420 The way you control explicit selective display is by replacing a | |
9009 | 421 newline (control-j) with a carriage return (control-m). The text that |
6598 | 422 was formerly a line following that newline is now invisible. Strictly |
423 speaking, it is temporarily no longer a line at all, since only newlines | |
424 can separate lines; it is now part of the previous line. | |
425 | |
426 Selective display does not directly affect editing commands. For | |
427 example, @kbd{C-f} (@code{forward-char}) moves point unhesitatingly into | |
428 invisible text. However, the replacement of newline characters with | |
429 carriage return characters affects some editing commands. For example, | |
430 @code{next-line} skips invisible lines, since it searches only for | |
431 newlines. Modes that use selective display can also define commands | |
432 that take account of the newlines, or that make parts of the text | |
433 visible or invisible. | |
434 | |
435 When you write a selectively displayed buffer into a file, all the | |
436 control-m's are output as newlines. This means that when you next read | |
437 in the file, it looks OK, with nothing invisible. The selective display | |
438 effect is seen only within Emacs. | |
439 | |
440 @defvar selective-display | |
441 This buffer-local variable enables selective display. This means that | |
442 lines, or portions of lines, may be made invisible. | |
443 | |
444 @itemize @bullet | |
445 @item | |
446 If the value of @code{selective-display} is @code{t}, then any portion | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
447 of a line that follows a control-m is not displayed. This is explicit |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
448 selective display. |
6598 | 449 |
450 @item | |
451 If the value of @code{selective-display} is a positive integer, then | |
452 lines that start with more than that many columns of indentation are not | |
453 displayed. | |
454 @end itemize | |
455 | |
456 When some portion of a buffer is invisible, the vertical movement | |
457 commands operate as if that portion did not exist, allowing a single | |
458 @code{next-line} command to skip any number of invisible lines. | |
459 However, character movement commands (such as @code{forward-char}) do | |
460 not skip the invisible portion, and it is possible (if tricky) to insert | |
461 or delete text in an invisible portion. | |
462 | |
463 In the examples below, we show the @emph{display appearance} of the | |
464 buffer @code{foo}, which changes with the value of | |
465 @code{selective-display}. The @emph{contents} of the buffer do not | |
466 change. | |
467 | |
468 @example | |
469 @group | |
470 (setq selective-display nil) | |
471 @result{} nil | |
472 | |
473 ---------- Buffer: foo ---------- | |
474 1 on this column | |
475 2on this column | |
476 3n this column | |
477 3n this column | |
478 2on this column | |
479 1 on this column | |
480 ---------- Buffer: foo ---------- | |
481 @end group | |
482 | |
483 @group | |
484 (setq selective-display 2) | |
485 @result{} 2 | |
486 | |
487 ---------- Buffer: foo ---------- | |
488 1 on this column | |
489 2on this column | |
490 2on this column | |
491 1 on this column | |
492 ---------- Buffer: foo ---------- | |
493 @end group | |
494 @end example | |
495 @end defvar | |
496 | |
497 @defvar selective-display-ellipses | |
498 If this buffer-local variable is non-@code{nil}, then Emacs displays | |
499 @samp{@dots{}} at the end of a line that is followed by invisible text. | |
500 This example is a continuation of the previous one. | |
501 | |
502 @example | |
503 @group | |
504 (setq selective-display-ellipses t) | |
505 @result{} t | |
506 | |
507 ---------- Buffer: foo ---------- | |
508 1 on this column | |
509 2on this column ... | |
510 2on this column | |
511 1 on this column | |
512 ---------- Buffer: foo ---------- | |
513 @end group | |
514 @end example | |
515 | |
516 You can use a display table to substitute other text for the ellipsis | |
517 (@samp{@dots{}}). @xref{Display Tables}. | |
518 @end defvar | |
519 | |
520 @node Overlay Arrow | |
521 @section The Overlay Arrow | |
522 @cindex overlay arrow | |
523 | |
524 The @dfn{overlay arrow} is useful for directing the user's attention | |
525 to a particular line in a buffer. For example, in the modes used for | |
526 interface to debuggers, the overlay arrow indicates the line of code | |
527 about to be executed. | |
528 | |
529 @defvar overlay-arrow-string | |
9009 | 530 This variable holds the string to display to call attention to a |
531 particular line, or @code{nil} if the arrow feature is not in use. | |
6598 | 532 @end defvar |
533 | |
534 @defvar overlay-arrow-position | |
9009 | 535 This variable holds a marker that indicates where to display the overlay |
536 arrow. It should point at the beginning of a line. The arrow text | |
537 appears at the beginning of that line, overlaying any text that would | |
538 otherwise appear. Since the arrow is usually short, and the line | |
539 usually begins with indentation, normally nothing significant is | |
540 overwritten. | |
6598 | 541 |
9009 | 542 The overlay string is displayed only in the buffer that this marker |
6598 | 543 points into. Thus, only one buffer can have an overlay arrow at any |
544 given time. | |
545 @c !!! overlay-arrow-position: but the overlay string may remain in the display | |
546 @c of some other buffer until an update is required. This should be fixed | |
547 @c now. Is it? | |
548 @end defvar | |
549 | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
550 You can do a similar job by creating an overlay with a |
12067 | 551 @code{before-string} property. @xref{Overlay Properties}. |
552 | |
6598 | 553 @node Temporary Displays |
554 @section Temporary Displays | |
555 | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
556 Temporary displays are used by Lisp programs to put output into a |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
557 buffer and then present it to the user for perusal rather than for |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
558 editing. Many help commands use this feature. |
6598 | 559 |
560 @defspec with-output-to-temp-buffer buffer-name forms@dots{} | |
561 This function executes @var{forms} while arranging to insert any | |
562 output they print into the buffer named @var{buffer-name}. The buffer | |
563 is then shown in some window for viewing, displayed but not selected. | |
564 | |
565 The string @var{buffer-name} specifies the temporary buffer, which | |
566 need not already exist. The argument must be a string, not a buffer. | |
567 The buffer is erased initially (with no questions asked), and it is | |
568 marked as unmodified after @code{with-output-to-temp-buffer} exits. | |
569 | |
570 @code{with-output-to-temp-buffer} binds @code{standard-output} to the | |
571 temporary buffer, then it evaluates the forms in @var{forms}. Output | |
572 using the Lisp output functions within @var{forms} goes by default to | |
573 that buffer (but screen display and messages in the echo area, although | |
574 they are ``output'' in the general sense of the word, are not affected). | |
575 @xref{Output Functions}. | |
576 | |
577 The value of the last form in @var{forms} is returned. | |
578 | |
579 @example | |
580 @group | |
581 ---------- Buffer: foo ---------- | |
582 This is the contents of foo. | |
583 ---------- Buffer: foo ---------- | |
584 @end group | |
585 | |
586 @group | |
587 (with-output-to-temp-buffer "foo" | |
588 (print 20) | |
589 (print standard-output)) | |
590 @result{} #<buffer foo> | |
591 | |
592 ---------- Buffer: foo ---------- | |
593 20 | |
594 | |
595 #<buffer foo> | |
596 | |
597 ---------- Buffer: foo ---------- | |
598 @end group | |
599 @end example | |
600 @end defspec | |
601 | |
602 @defvar temp-buffer-show-function | |
9009 | 603 If this variable is non-@code{nil}, @code{with-output-to-temp-buffer} |
6598 | 604 calls it as a function to do the job of displaying a help buffer. The |
605 function gets one argument, which is the buffer it should display. | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
606 |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
607 It is a good idea for this function to run @code{temp-buffer-show-hook} |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
608 just as @code{with-output-to-temp-buffer} normally would, inside of |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
609 @code{save-window-excursion} and with the chosen window and buffer |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
610 selected. |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
611 @end defvar |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
612 |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
613 @defvar temp-buffer-show-hook |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
614 This normal hook is run by @code{with-output-to-temp-buffer} after |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
615 displaying the help buffer. When the hook runs, the help buffer is |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
616 current, and the window it was displayed in is selected. |
6598 | 617 @end defvar |
618 | |
619 @defun momentary-string-display string position &optional char message | |
620 This function momentarily displays @var{string} in the current buffer at | |
621 @var{position}. It has no effect on the undo list or on the buffer's | |
622 modification status. | |
623 | |
624 The momentary display remains until the next input event. If the next | |
625 input event is @var{char}, @code{momentary-string-display} ignores it | |
626 and returns. Otherwise, that event remains buffered for subsequent use | |
627 as input. Thus, typing @var{char} will simply remove the string from | |
628 the display, while typing (say) @kbd{C-f} will remove the string from | |
629 the display and later (presumably) move point forward. The argument | |
630 @var{char} is a space by default. | |
631 | |
632 The return value of @code{momentary-string-display} is not meaningful. | |
633 | |
12098 | 634 If the string @var{string} does not contain control characters, you can |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
635 do the same job in a more general way by creating (and then subsequently |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
636 deleting) an overlay with a @code{before-string} property. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
637 @xref{Overlay Properties}. |
12098 | 638 |
6598 | 639 If @var{message} is non-@code{nil}, it is displayed in the echo area |
640 while @var{string} is displayed in the buffer. If it is @code{nil}, a | |
641 default message says to type @var{char} to continue. | |
642 | |
643 In this example, point is initially located at the beginning of the | |
644 second line: | |
645 | |
646 @example | |
647 @group | |
648 ---------- Buffer: foo ---------- | |
649 This is the contents of foo. | |
650 @point{}Second line. | |
651 ---------- Buffer: foo ---------- | |
652 @end group | |
653 | |
654 @group | |
655 (momentary-string-display | |
656 "**** Important Message! ****" | |
657 (point) ?\r | |
658 "Type RET when done reading") | |
659 @result{} t | |
660 @end group | |
661 | |
662 @group | |
663 ---------- Buffer: foo ---------- | |
664 This is the contents of foo. | |
665 **** Important Message! ****Second line. | |
666 ---------- Buffer: foo ---------- | |
667 | |
668 ---------- Echo Area ---------- | |
669 Type RET when done reading | |
670 ---------- Echo Area ---------- | |
671 @end group | |
672 @end example | |
673 @end defun | |
674 | |
675 @node Overlays | |
676 @section Overlays | |
677 @cindex overlays | |
678 | |
679 You can use @dfn{overlays} to alter the appearance of a buffer's text on | |
12098 | 680 the screen, for the sake of presentation features. An overlay is an |
681 object that belongs to a particular buffer, and has a specified | |
682 beginning and end. It also has properties that you can examine and set; | |
683 these affect the display of the text within the overlay. | |
6598 | 684 |
685 @menu | |
686 * Overlay Properties:: How to read and set properties. | |
687 What properties do to the screen display. | |
688 * Managing Overlays:: Creating, moving, finding overlays. | |
689 @end menu | |
690 | |
691 @node Overlay Properties | |
692 @subsection Overlay Properties | |
693 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
694 Overlay properties are like text properties in that the properties that |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
695 alter how a character is displayed can come from either source. But in |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
696 most respects they are different. Text properties are considered a part |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
697 of the text; overlays are specifically considered not to be part of the |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
698 text. Thus, copying text between various buffers and strings preserves |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
699 text properties, but does not try to preserve overlays. Changing a |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
700 buffer's text properties marks the buffer as modified, while moving an |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
701 overlay or changing its properties does not. Unlike text property |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
702 changes, overlay changes are not recorded in the buffer's undo list. |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
703 @xref{Text Properties}, for comparison. |
6598 | 704 |
705 @table @code | |
706 @item priority | |
707 @kindex priority @r{(overlay property)} | |
708 This property's value (which should be a nonnegative number) determines | |
709 the priority of the overlay. The priority matters when two or more | |
710 overlays cover the same character and both specify a face for display; | |
711 the one whose @code{priority} value is larger takes priority over the | |
712 other, and its face attributes override the face attributes of the lower | |
713 priority overlay. | |
714 | |
715 Currently, all overlays take priority over text properties. Please | |
716 avoid using negative priority values, as we have not yet decided just | |
717 what they should mean. | |
718 | |
719 @item window | |
720 @kindex window @r{(overlay property)} | |
721 If the @code{window} property is non-@code{nil}, then the overlay | |
722 applies only on that window. | |
723 | |
12067 | 724 @item category |
725 @kindex category @r{(overlay property)} | |
726 If an overlay has a @code{category} property, we call it the | |
12098 | 727 @dfn{category} of the overlay. It should be a symbol. The properties |
12067 | 728 of the symbol serve as defaults for the properties of the overlay. |
729 | |
6598 | 730 @item face |
731 @kindex face @r{(overlay property)} | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
732 This property controls the way text is displayed---for example, which |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
733 font and which colors. Its value is a face name or a list of face |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
734 names. @xref{Faces}, for more information. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
735 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
736 If the property value is a list, elements may also have the form |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
737 @code{(foreground-color . @var{color-name})} or @code{(background-color |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
738 . @var{color-name})}. These elements specify just the foreground color |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
739 or just the background color; therefore, there is no need to create a |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
740 face for each color that you want to use. |
6598 | 741 |
742 @item mouse-face | |
743 @kindex mouse-face @r{(overlay property)} | |
744 This property is used instead of @code{face} when the mouse is within | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
745 the range of the overlay. |
6598 | 746 |
747 @item modification-hooks | |
748 @kindex modification-hooks @r{(overlay property)} | |
749 This property's value is a list of functions to be called if any | |
750 character within the overlay is changed or if text is inserted strictly | |
12067 | 751 within the overlay. |
752 | |
753 The hook functions are called both before and after each change. | |
754 If the functions save the information they receive, and compare notes | |
755 between calls, they can determine exactly what change has been made | |
756 in the buffer text. | |
757 | |
758 When called before a change, each function receives four arguments: the | |
759 overlay, @code{nil}, and the beginning and end of the text range to be | |
7086
075343a6b32b
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
6598
diff
changeset
|
760 modified. |
6598 | 761 |
12067 | 762 When called after a change, each function receives five arguments: the |
763 overlay, @code{t}, the beginning and end of the text range just | |
764 modified, and the length of the pre-change text replaced by that range. | |
765 (For an insertion, the pre-change length is zero; for a deletion, that | |
766 length is the number of characters deleted, and the post-change | |
12098 | 767 beginning and end are equal.) |
12067 | 768 |
6598 | 769 @item insert-in-front-hooks |
770 @kindex insert-in-front-hooks @r{(overlay property)} | |
12067 | 771 This property's value is a list of functions to be called before and |
772 after inserting text right at the beginning of the overlay. The calling | |
773 conventions are the same as for the @code{modification-hooks} functions. | |
6598 | 774 |
775 @item insert-behind-hooks | |
776 @kindex insert-behind-hooks @r{(overlay property)} | |
12067 | 777 This property's value is a list of functions to be called before and |
778 after inserting text right at the end of the overlay. The calling | |
779 conventions are the same as for the @code{modification-hooks} functions. | |
6598 | 780 |
781 @item invisible | |
782 @kindex invisible @r{(overlay property)} | |
12067 | 783 The @code{invisible} property can make the text in the overlay |
784 invisible, which means that it does not appear on the screen. | |
785 @xref{Invisible Text}, for details. | |
786 | |
787 @item intangible | |
788 @kindex intangible @r{(overlay property)} | |
789 The @code{intangible} property on an overlay works just like the | |
12098 | 790 @code{intangible} text property. @xref{Special Properties}, for details. |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
791 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
792 @item isearch-open-invisible |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
793 This property tells incremental search how to make an invisible overlay |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
794 visible, permanently, if the final match overlaps it. @xref{Invisible |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
795 Text}. |
6598 | 796 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
797 @item isearch-open-invisible-temporary |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
798 This property tells incremental search how to make an invisible overlay |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
799 visible, temporarily, during the search. @xref{Invisible Text}. |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
800 |
6598 | 801 @item before-string |
802 @kindex before-string @r{(overlay property)} | |
803 This property's value is a string to add to the display at the beginning | |
804 of the overlay. The string does not appear in the buffer in any | |
12067 | 805 sense---only on the screen. The string should contain only characters |
806 that display as a single column---control characters, including tabs or | |
807 newlines, will give strange results. | |
6598 | 808 |
809 @item after-string | |
810 @kindex after-string @r{(overlay property)} | |
811 This property's value is a string to add to the display at the end of | |
812 the overlay. The string does not appear in the buffer in any | |
12067 | 813 sense---only on the screen. The string should contain only characters |
814 that display as a single column---control characters, including tabs or | |
815 newlines, will give strange results. | |
816 | |
817 @item evaporate | |
818 @kindex evaporate @r{(overlay property)} | |
819 If this property is non-@code{nil}, the overlay is deleted automatically | |
820 if it ever becomes empty (i.e., if it spans no characters). | |
16123
ec5f48fe0320
Mention local-value property on an overlay.
Richard M. Stallman <rms@gnu.org>
parents:
15761
diff
changeset
|
821 |
ec5f48fe0320
Mention local-value property on an overlay.
Richard M. Stallman <rms@gnu.org>
parents:
15761
diff
changeset
|
822 @item local-map |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
823 @cindex keymap of character (and overlays) |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
824 @kindex local-map @r{(overlay property)} |
16123
ec5f48fe0320
Mention local-value property on an overlay.
Richard M. Stallman <rms@gnu.org>
parents:
15761
diff
changeset
|
825 If this property is non-@code{nil}, it specifies a keymap for a portion |
ec5f48fe0320
Mention local-value property on an overlay.
Richard M. Stallman <rms@gnu.org>
parents:
15761
diff
changeset
|
826 of the text. The property's value replaces the buffer's local map, when |
ec5f48fe0320
Mention local-value property on an overlay.
Richard M. Stallman <rms@gnu.org>
parents:
15761
diff
changeset
|
827 the character after point is within the overlay. @xref{Active Keymaps}. |
6598 | 828 @end table |
829 | |
830 These are the functions for reading and writing the properties of an | |
831 overlay. | |
832 | |
833 @defun overlay-get overlay prop | |
834 This function returns the value of property @var{prop} recorded in | |
12067 | 835 @var{overlay}, if any. If @var{overlay} does not record any value for |
836 that property, but it does have a @code{category} property which is a | |
837 symbol, that symbol's @var{prop} property is used. Otherwise, the value | |
838 is @code{nil}. | |
6598 | 839 @end defun |
840 | |
841 @defun overlay-put overlay prop value | |
842 This function sets the value of property @var{prop} recorded in | |
843 @var{overlay} to @var{value}. It returns @var{value}. | |
844 @end defun | |
845 | |
846 See also the function @code{get-char-property} which checks both | |
847 overlay properties and text properties for a given character. | |
848 @xref{Examining Properties}. | |
849 | |
850 @node Managing Overlays | |
851 @subsection Managing Overlays | |
852 | |
853 This section describes the functions to create, delete and move | |
854 overlays, and to examine their contents. | |
855 | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
856 @defun make-overlay start end &optional buffer front-advance rear-advance |
9009 | 857 This function creates and returns an overlay that belongs to |
6598 | 858 @var{buffer} and ranges from @var{start} to @var{end}. Both @var{start} |
859 and @var{end} must specify buffer positions; they may be integers or | |
860 markers. If @var{buffer} is omitted, the overlay is created in the | |
861 current buffer. | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
862 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
863 The arguments @var{front-advance} and @var{rear-advance} specify the |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
864 insertion type for the start of the overlay and for the end of the |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
865 overlay. @xref{Marker Insertion Types}. |
6598 | 866 @end defun |
867 | |
868 @defun overlay-start overlay | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
869 This function returns the position at which @var{overlay} starts, |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
870 as an integer. |
6598 | 871 @end defun |
872 | |
873 @defun overlay-end overlay | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
874 This function returns the position at which @var{overlay} ends, |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
875 as an integer. |
6598 | 876 @end defun |
877 | |
878 @defun overlay-buffer overlay | |
879 This function returns the buffer that @var{overlay} belongs to. | |
880 @end defun | |
881 | |
882 @defun delete-overlay overlay | |
883 This function deletes @var{overlay}. The overlay continues to exist as | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
884 a Lisp object, but ceases to be attached to the buffer it belonged to, |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
885 and ceases to have any effect on display. |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
886 |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
887 A deleted overlay is not permanently useless. You can give it |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
888 a new buffer position by calling @code{move-overlay}. |
6598 | 889 @end defun |
890 | |
891 @defun move-overlay overlay start end &optional buffer | |
892 This function moves @var{overlay} to @var{buffer}, and places its bounds | |
893 at @var{start} and @var{end}. Both arguments @var{start} and @var{end} | |
894 must specify buffer positions; they may be integers or markers. If | |
895 @var{buffer} is omitted, the overlay stays in the same buffer. | |
896 | |
897 The return value is @var{overlay}. | |
898 | |
899 This is the only valid way to change the endpoints of an overlay. Do | |
900 not try modifying the markers in the overlay by hand, as that fails to | |
901 update other vital data structures and can cause some overlays to be | |
902 ``lost''. | |
903 @end defun | |
904 | |
905 @defun overlays-at pos | |
906 This function returns a list of all the overlays that contain position | |
907 @var{pos} in the current buffer. The list is in no particular order. | |
908 An overlay contains position @var{pos} if it begins at or before | |
909 @var{pos}, and ends after @var{pos}. | |
910 @end defun | |
911 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
912 @defun overlays-in beg end |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
913 @tindex overlays-in |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
914 This function returns a list of the overlays that overlap the region |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
915 @var{beg} through @var{end}. ``Overlap'' means that at least one |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
916 character is contained within the overlay and also contained within the |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
917 specified region; however, empty overlays are included in the result if |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
918 they are located at @var{beg} or between @var{beg} and @var{end}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
919 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
920 |
6598 | 921 @defun next-overlay-change pos |
922 This function returns the buffer position of the next beginning or end | |
923 of an overlay, after @var{pos}. | |
924 @end defun | |
925 | |
12067 | 926 @defun previous-overlay-change pos |
927 This function returns the buffer position of the previous beginning or | |
928 end of an overlay, before @var{pos}. | |
929 @end defun | |
930 | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
931 @node Width |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
932 @section Width |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
933 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
934 Since not all characters have the same width, these functions let you |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
935 check the width of a character. @xref{Primitive Indent}, and |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
936 @ref{Screen Lines}, for related functions. |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
937 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
938 @defun char-width char |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
939 @tindex char-width |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
940 This function returns the width in columns of the character @var{char}, |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
941 if it were displayed in the current buffer and the selected window. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
942 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
943 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
944 @defun string-width string |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
945 @tindex string-width |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
946 This function returns the width in columns of the string @var{string}, |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
947 if it were displayed in the current buffer and the selected window. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
948 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
949 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
950 @defun truncate-string-to-width string width &optional start-column padding |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
951 @tindex truncate-string-to-width |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
952 This function returns the part of @var{string} that fits within |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
953 @var{width} columns, as a new string. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
954 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
955 If @var{string} does not reach @var{width}, then the result ends where |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
956 @var{string} ends. If one multi-column character in @var{string} |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
957 extends across the column @var{width}, that character is not included in |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
958 the result. Thus, the result can fall short of @var{width} but cannot |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
959 go beyond it. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
960 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
961 The optional argument @var{start-column} specifies the starting column. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
962 If this is non-@code{nil}, then the first @var{start-column} columns of |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
963 the string are omitted from the value. If one multi-column character in |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
964 @var{string} extends across the column @var{start-column}, that |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
965 character is not included. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
966 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
967 The optional argument @var{padding}, if non-@code{nil}, is a padding |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
968 character added at the beginning and end of the result string, to extend |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
969 it to exactly @var{width} columns. The padding character is used at the |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
970 end of the result if it falls short of @var{width}. It is also used at |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
971 the beginning of the result if one multi-column character in |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
972 @var{string} extends across the column @var{start-column}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
973 |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
974 @example |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
975 (truncate-string-to-width "\tab\t" 12 4) |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
976 @result{} "ab" |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
977 (truncate-string-to-width "\tab\t" 12 4 ?\ ) |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
978 @result{} " ab " |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
979 @end example |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
980 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
981 |
6598 | 982 @node Faces |
983 @section Faces | |
984 @cindex face | |
985 | |
986 A @dfn{face} is a named collection of graphical attributes: font, | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
987 foreground color, background color, and optional underlining. Faces |
6598 | 988 control the display of text on the screen. |
989 | |
990 @cindex face id | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
991 Each face has its own @dfn{face number}, which distinguishes faces at |
6598 | 992 low levels within Emacs. However, for most purposes, you can refer to |
993 faces in Lisp programs by their names. | |
994 | |
12067 | 995 @defun facep object |
996 This function returns @code{t} if @var{object} is a face name symbol (or | |
997 if it is a vector of the kind used internally to record face data). It | |
998 returns @code{nil} otherwise. | |
999 @end defun | |
1000 | |
6598 | 1001 Each face name is meaningful for all frames, and by default it has the |
1002 same meaning in all frames. But you can arrange to give a particular | |
1003 face name a special meaning in one frame if you wish. | |
1004 | |
1005 @menu | |
1006 * Standard Faces:: The faces Emacs normally comes with. | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1007 * Defining Faces:: How to define a face with @code{defface}. |
6598 | 1008 * Merging Faces:: How Emacs decides which face to use for a character. |
1009 * Face Functions:: How to define and examine faces. | |
1010 @end menu | |
1011 | |
1012 @node Standard Faces | |
1013 @subsection Standard Faces | |
1014 | |
1015 This table lists all the standard faces and their uses. | |
1016 | |
1017 @table @code | |
1018 @item default | |
1019 @kindex default @r{(face name)} | |
1020 This face is used for ordinary text. | |
1021 | |
1022 @item modeline | |
1023 @kindex modeline @r{(face name)} | |
1024 This face is used for mode lines and menu bars. | |
1025 | |
1026 @item region | |
1027 @kindex region @r{(face name)} | |
1028 This face is used for highlighting the region in Transient Mark mode. | |
1029 | |
1030 @item secondary-selection | |
1031 @kindex secondary-selection @r{(face name)} | |
1032 This face is used to show any secondary selection you have made. | |
1033 | |
1034 @item highlight | |
1035 @kindex highlight @r{(face name)} | |
1036 This face is meant to be used for highlighting for various purposes. | |
1037 | |
1038 @item underline | |
1039 @kindex underline @r{(face name)} | |
1040 This face underlines text. | |
1041 | |
1042 @item bold | |
1043 @kindex bold @r{(face name)} | |
1044 This face uses a bold font, if possible. It uses the bold variant of | |
1045 the frame's font, if it has one. It's up to you to choose a default | |
1046 font that has a bold variant, if you want to use one. | |
1047 | |
1048 @item italic | |
1049 @kindex italic @r{(face name)} | |
1050 This face uses the italic variant of the frame's font, if it has one. | |
1051 | |
1052 @item bold-italic | |
1053 @kindex bold-italic @r{(face name)} | |
1054 This face uses the bold italic variant of the frame's font, if it has | |
1055 one. | |
1056 @end table | |
1057 | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1058 @node Defining Faces |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1059 @subsection Defining Faces |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1060 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1061 The way to define a new face is with @code{defface}. This creates a |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1062 kind of customization item (@pxref{Customization}) which the user can |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1063 customize using the Customization buffer (@pxref{Easy Customization,,, |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1064 emacs, The GNU Emacs Manual}). |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1065 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1066 @defmac defface face spec doc [keyword value]... |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1067 @tindex defface |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1068 Declare @var{face} as a customizable face that defaults according to |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1069 @var{spec}. Do not quote the symbol @var{face}. The argument @var{doc} |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1070 specifies the face documentation. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1071 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1072 When @code{defface} executes, it defines the face according to |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1073 @var{spec}, then uses any customizations that were read from the |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1074 @file{.emacs} file to override that specification. |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1075 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1076 The purpose of @var{spec} is to specify how the face should appear on |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1077 different kinds of terminals. It should be an alist whose elements have |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1078 the form @code{(@var{display} @var{atts})}. The element's @sc{car}, |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1079 @var{display}, specifies a class of terminals. The @sc{cdr}, |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1080 @var{atts}, is a list of face attributes and their values; it specifies |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1081 what the face should look like on that kind of terminal. The possible |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1082 attributes are defined in the value of @code{custom-face-attributes}. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1083 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1084 The @var{display} part of an element of @var{spec} determines which |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1085 frames the element applies to. If more than one element of @var{spec} |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1086 matches a given frame, the first matching element is the only one used |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1087 for that frame. There are two possibilities for @var{display}: |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1088 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1089 @table @asis |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1090 @item @code{t} |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1091 This element of @var{spec} matches all frames. Therefore, any |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1092 subsequent elements of @var{spec} are never used. Normally |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1093 @code{t} is used in the last (or only) element of @var{spec}. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1094 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1095 @item a list |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1096 If @var{display} is alist, each elements should have the form |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1097 @code{(@var{characteristic} @var{value}@dots{})}. Here |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1098 @var{characteristic} specifies a way of classifying frames, and the |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1099 @var{value}s are possible classifications which @var{display} should |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1100 apply to. Here are the possible values of @var{characteristic}: |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1101 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1102 @table @code |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1103 @item type |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1104 The kind of window system the frame uses---either @code{x}, @code{pc} |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1105 (for the MS-DOS console), @code{w32} (for MS Windows 9X/NT), or |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1106 @code{tty}. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1107 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1108 @item class |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1109 What kinds of colors the frame supports---either @code{color}, |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1110 @code{grayscale}, or @code{mono}. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1111 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1112 @item background |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1113 The kind of background--- either @code{light} or @code{dark}. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1114 @end table |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1115 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1116 If an element of @var{display} specifies more than one @var{value} for a |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1117 given @var{characteristic}, any of those values is acceptable. If |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1118 @var{display} has more than one element, each element should specify a |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1119 different @var{characteristic}; then @emph{each} characteristic of the |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1120 frame must match one of the @var{value}s specified for it in |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1121 @var{display}. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1122 @end table |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1123 @end defmac |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1124 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1125 Here's how the standard face @code{region} could be defined |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1126 with @code{defface}: |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1127 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1128 @example |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1129 (defface region |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1130 ((((class color) (background dark)) |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1131 (:background "blue")) |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1132 (t (:background "gray"))) |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1133 "Used for displaying the region.") |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1134 @end example |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1135 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1136 Internally, @code{defface} uses the symbol property |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1137 @code{face-defface-spec} to record the face attributes specified in |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1138 @code{defface}, @code{saved-face} for the attributes saved by the user |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1139 with the customization buffer, and @code{face-documentation} for the |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1140 documentation string. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1141 |
6598 | 1142 @node Merging Faces |
1143 @subsection Merging Faces for Display | |
1144 | |
1145 Here are all the ways to specify which face to use for display of text: | |
1146 | |
1147 @itemize @bullet | |
1148 @item | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1149 With defaults. Each frame has a @dfn{default face}, which is used for |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1150 all text that doesn't somehow specify another face. (We may change this |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1151 in a forthcoming Emacs version to serve as a default for all text.) |
6598 | 1152 |
1153 @item | |
1154 With text properties. A character may have a @code{face} property; if so, | |
9009 | 1155 it is displayed with that face. @xref{Special Properties}. |
6598 | 1156 |
1157 If the character has a @code{mouse-face} property, that is used instead | |
1158 of the @code{face} property when the mouse is ``near enough'' to the | |
1159 character. | |
1160 | |
1161 @item | |
1162 With overlays. An overlay may have @code{face} and @code{mouse-face} | |
1163 properties too; they apply to all the text covered by the overlay. | |
1164 | |
1165 @item | |
12098 | 1166 With a region that is active. In Transient Mark mode, the region is |
1167 highlighted with a particular face (see @code{region-face}, below). | |
1168 | |
1169 @item | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1170 With special glyphs. Each glyph can specify a particular face |
6598 | 1171 number. @xref{Glyphs}. |
1172 @end itemize | |
1173 | |
1174 If these various sources together specify more than one face for a | |
1175 particular character, Emacs merges the attributes of the various faces | |
1176 specified. The attributes of the faces of special glyphs come first; | |
12098 | 1177 then comes the face for region highlighting, if appropriate; |
6598 | 1178 then come attributes of faces from overlays, followed by those from text |
1179 properties, and last the default face. | |
1180 | |
1181 When multiple overlays cover one character, an overlay with higher | |
1182 priority overrides those with lower priority. @xref{Overlays}. | |
1183 | |
1184 If an attribute such as the font or a color is not specified in any of | |
1185 the above ways, the frame's own font or color is used. | |
1186 | |
1187 @node Face Functions | |
1188 @subsection Functions for Working with Faces | |
1189 | |
1190 The attributes a face can specify include the font, the foreground | |
1191 color, the background color, and underlining. The face can also leave | |
1192 these unspecified by giving the value @code{nil} for them. | |
1193 | |
1194 Here are the primitives for creating and changing faces. | |
1195 | |
1196 @defun make-face name | |
1197 This function defines a new face named @var{name}, initially with all | |
1198 attributes @code{nil}. It does nothing if there is already a face named | |
1199 @var{name}. | |
1200 @end defun | |
1201 | |
1202 @defun face-list | |
1203 This function returns a list of all defined face names. | |
1204 @end defun | |
1205 | |
1206 @defun copy-face old-face new-name &optional frame new-frame | |
1207 This function defines the face @var{new-name} as a copy of the existing | |
1208 face named @var{old-face}. It creates the face @var{new-name} if that | |
1209 doesn't already exist. | |
1210 | |
1211 If the optional argument @var{frame} is given, this function applies | |
1212 only to that frame. Otherwise it applies to each frame individually, | |
1213 copying attributes from @var{old-face} in each frame to @var{new-face} | |
1214 in the same frame. | |
1215 | |
1216 If the optional argument @var{new-frame} is given, then @code{copy-face} | |
1217 copies the attributes of @var{old-face} in @var{frame} to @var{new-name} | |
1218 in @var{new-frame}. | |
1219 @end defun | |
1220 | |
1221 You can modify the attributes of an existing face with the following | |
1222 functions. If you specify @var{frame}, they affect just that frame; | |
1223 otherwise, they affect all frames as well as the defaults that apply to | |
1224 new frames. | |
1225 | |
1226 @defun set-face-foreground face color &optional frame | |
1227 @defunx set-face-background face color &optional frame | |
9009 | 1228 These functions set the foreground (or background, respectively) color |
1229 of face @var{face} to @var{color}. The argument @var{color} should be a | |
6598 | 1230 string, the name of a color. |
12098 | 1231 |
1232 Certain shades of gray are implemented by stipple patterns on | |
1233 black-and-white screens. | |
1234 @end defun | |
1235 | |
1236 @defun set-face-stipple face pattern &optional frame | |
1237 This function sets the background stipple pattern of face @var{face} to | |
1238 @var{pattern}. The argument @var{pattern} should be the name of a | |
1239 stipple pattern defined by the X server, or @code{nil} meaning don't use | |
1240 stipple. | |
1241 | |
1242 Normally there is no need to pay attention to stipple patterns, because | |
1243 they are used automatically to handle certain shades of gray. | |
6598 | 1244 @end defun |
1245 | |
1246 @defun set-face-font face font &optional frame | |
1247 This function sets the font of face @var{face}. The argument @var{font} | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1248 should be a string, either a valid font name for your system or the name |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1249 of an Emacs fontset (@pxref{Fontsets}). Note that if you set the font |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1250 explicitly, the bold and italic attributes cease to have any effect, |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1251 because the precise font that you specified is always used. |
18234
2e66f4ee4ca8
Add make-face-bold/italic and unbold/unitalic.
Richard M. Stallman <rms@gnu.org>
parents:
16123
diff
changeset
|
1252 @end defun |
2e66f4ee4ca8
Add make-face-bold/italic and unbold/unitalic.
Richard M. Stallman <rms@gnu.org>
parents:
16123
diff
changeset
|
1253 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1254 @defun set-face-bold-p face bold-p &optional frame |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1255 @tindex set-face-bold-p |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1256 This function sets the bold attribute of face @var{face}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1257 Non-@code{nil} means bold; @code{nil} means non-bold. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1258 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1259 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1260 @defun set-face-italic-p face italic-p &optional frame |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1261 @tindex set-face-italic-p |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1262 This function sets the italic attribute of face @var{face}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1263 Non-@code{nil} means italic; @code{nil} means non-italic. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1264 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1265 |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1266 @defun set-face-underline-p face underline-p &optional frame |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1267 This function sets the underline attribute of face @var{face}. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1268 Non-@code{nil} means do underline; @code{nil} means don't. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1269 @end defun |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1270 |
6598 | 1271 @defun invert-face face &optional frame |
1272 Swap the foreground and background colors of face @var{face}. If the | |
1273 face doesn't specify both foreground and background, then its foreground | |
9009 | 1274 and background are set to the default background and foreground, |
1275 respectively. | |
6598 | 1276 @end defun |
1277 | |
1278 These functions examine the attributes of a face. If you don't | |
1279 specify @var{frame}, they refer to the default data for new frames. | |
1280 | |
1281 @defun face-foreground face &optional frame | |
1282 @defunx face-background face &optional frame | |
9009 | 1283 These functions return the foreground color (or background color, |
1284 respectively) of face @var{face}, as a string. | |
6598 | 1285 @end defun |
1286 | |
12098 | 1287 @defun face-stipple face &optional frame |
1288 This function returns the name of the background stipple pattern of face | |
1289 @var{face}, or @code{nil} if it doesn't have one. | |
1290 @end defun | |
1291 | |
6598 | 1292 @defun face-font face &optional frame |
1293 This function returns the name of the font of face @var{face}. | |
1294 @end defun | |
1295 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1296 @defun face-bold-p face &optional frame |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1297 @tindex face-bold-p |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1298 This function returns the bold attribute of face @var{face}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1299 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1300 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1301 @defun face-italic-p face &optional frame |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1302 @tindex face-italic-p |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1303 This function returns the italic attribute of face @var{face}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1304 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1305 |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1306 @defun face-underline-p face &optional frame |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1307 This function returns the underline attribute of face @var{face}. |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1308 @end defun |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1309 |
12098 | 1310 @defun face-id face |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1311 This function returns the face number of face @var{face}. |
6598 | 1312 @end defun |
1313 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1314 @defun face-documentation face |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1315 @tindex face-documentation |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1316 This function returns the documentation string of face @var{face}, or |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1317 @code{nil} if none was specified for it. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1318 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1319 |
6598 | 1320 @defun face-equal face1 face2 &optional frame |
1321 This returns @code{t} if the faces @var{face1} and @var{face2} have the | |
1322 same attributes for display. | |
1323 @end defun | |
1324 | |
1325 @defun face-differs-from-default-p face &optional frame | |
1326 This returns @code{t} if the face @var{face} displays differently from | |
1327 the default face. A face is considered to be ``the same'' as the normal | |
1328 face if each attribute is either the same as that of the default face or | |
1329 @code{nil} (meaning to inherit from the default). | |
1330 @end defun | |
1331 | |
1332 @defvar region-face | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1333 This variable's value specifies the face number to use to display characters |
6598 | 1334 in the region when it is active (in Transient Mark mode only). The face |
1335 thus specified takes precedence over all faces that come from text | |
1336 properties and overlays, for characters in the region. @xref{The Mark}, | |
1337 for more information about Transient Mark mode. | |
1338 | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1339 Normally, the value is the face number of the face named @code{region}. |
6598 | 1340 @end defvar |
1341 | |
1342 @node Blinking | |
1343 @section Blinking Parentheses | |
1344 @cindex parenthesis matching | |
1345 @cindex blinking | |
1346 @cindex balancing parentheses | |
1347 @cindex close parenthesis | |
1348 | |
1349 This section describes the mechanism by which Emacs shows a matching | |
1350 open parenthesis when the user inserts a close parenthesis. | |
1351 | |
1352 @defvar blink-paren-function | |
1353 The value of this variable should be a function (of no arguments) to | |
1354 be called whenever a character with close parenthesis syntax is inserted. | |
1355 The value of @code{blink-paren-function} may be @code{nil}, in which | |
1356 case nothing is done. | |
1357 @end defvar | |
1358 | |
1359 @defvar blink-matching-paren | |
1360 If this variable is @code{nil}, then @code{blink-matching-open} does | |
1361 nothing. | |
1362 @end defvar | |
1363 | |
1364 @defvar blink-matching-paren-distance | |
1365 This variable specifies the maximum distance to scan for a matching | |
1366 parenthesis before giving up. | |
1367 @end defvar | |
1368 | |
12098 | 1369 @defvar blink-matching-paren-delay |
1370 This variable specifies the number of seconds for the cursor to remain | |
1371 at the matching parenthesis. A fraction of a second often gives | |
1372 good results, but the default is 1, which works on all systems. | |
1373 @end defvar | |
1374 | |
6598 | 1375 @defun blink-matching-open |
1376 This function is the default value of @code{blink-paren-function}. It | |
1377 assumes that point follows a character with close parenthesis syntax and | |
1378 moves the cursor momentarily to the matching opening character. If that | |
1379 character is not already on the screen, it displays the character's | |
1380 context in the echo area. To avoid long delays, this function does not | |
1381 search farther than @code{blink-matching-paren-distance} characters. | |
1382 | |
1383 Here is an example of calling this function explicitly. | |
1384 | |
1385 @smallexample | |
1386 @group | |
1387 (defun interactive-blink-matching-open () | |
1388 @c Do not break this line! -- rms. | |
1389 @c The first line of a doc string | |
1390 @c must stand alone. | |
1391 "Indicate momentarily the start of sexp before point." | |
1392 (interactive) | |
1393 @end group | |
1394 @group | |
1395 (let ((blink-matching-paren-distance | |
1396 (buffer-size)) | |
1397 (blink-matching-paren t)) | |
1398 (blink-matching-open))) | |
1399 @end group | |
1400 @end smallexample | |
1401 @end defun | |
1402 | |
1403 @node Inverse Video | |
1404 @section Inverse Video | |
1405 @cindex Inverse Video | |
1406 | |
1407 @defopt inverse-video | |
1408 @cindex highlighting | |
1409 This variable controls whether Emacs uses inverse video for all text | |
1410 on the screen. Non-@code{nil} means yes, @code{nil} means no. The | |
1411 default is @code{nil}. | |
1412 @end defopt | |
1413 | |
1414 @defopt mode-line-inverse-video | |
1415 This variable controls the use of inverse video for mode lines. If it | |
12098 | 1416 is non-@code{nil}, then mode lines are displayed in inverse video. |
1417 Otherwise, mode lines are displayed normally, just like text. The | |
1418 default is @code{t}. | |
1419 | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1420 For window frames, this displays mode lines using the face named |
12098 | 1421 @code{modeline}, which is normally the inverse of the default face |
1422 unless you change it. | |
6598 | 1423 @end defopt |
1424 | |
1425 @node Usual Display | |
1426 @section Usual Display Conventions | |
1427 | |
1428 The usual display conventions define how to display each character | |
1429 code. You can override these conventions by setting up a display table | |
1430 (@pxref{Display Tables}). Here are the usual display conventions: | |
1431 | |
1432 @itemize @bullet | |
1433 @item | |
1434 Character codes 32 through 126 map to glyph codes 32 through 126. | |
1435 Normally this means they display as themselves. | |
1436 | |
1437 @item | |
1438 Character code 9 is a horizontal tab. It displays as whitespace | |
1439 up to a position determined by @code{tab-width}. | |
1440 | |
1441 @item | |
1442 Character code 10 is a newline. | |
1443 | |
1444 @item | |
1445 All other codes in the range 0 through 31, and code 127, display in one | |
9009 | 1446 of two ways according to the value of @code{ctl-arrow}. If it is |
6598 | 1447 non-@code{nil}, these codes map to sequences of two glyphs, where the |
1448 first glyph is the @sc{ASCII} code for @samp{^}. (A display table can | |
1449 specify a glyph to use instead of @samp{^}.) Otherwise, these codes map | |
1450 just like the codes in the range 128 to 255. | |
1451 | |
1452 @item | |
1453 Character codes 128 through 255 map to sequences of four glyphs, where | |
1454 the first glyph is the @sc{ASCII} code for @samp{\}, and the others are | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1455 digit characters representing the character code in octal. (A display |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1456 table can specify a glyph to use instead of @samp{\}.) |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1457 |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1458 @item |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1459 Multibyte character codes above 256 are displayed as themselves, or as a |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1460 question mark or empty box if the terminal cannot display that |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1461 character. |
6598 | 1462 @end itemize |
1463 | |
1464 The usual display conventions apply even when there is a display | |
1465 table, for any character whose entry in the active display table is | |
1466 @code{nil}. Thus, when you set up a display table, you need only | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1467 specify the characters for which you want special behavior. |
6598 | 1468 |
1469 These variables affect the way certain characters are displayed on the | |
1470 screen. Since they change the number of columns the characters occupy, | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1471 they also affect the indentation functions. These variables also affect |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1472 how the mode line is displayed; if you want to force redisplay of the |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1473 mode line using the new values, call the function |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1474 @code{force-mode-line-update} (@pxref{Mode Line Format}). |
6598 | 1475 |
1476 @defopt ctl-arrow | |
1477 @cindex control characters in display | |
1478 This buffer-local variable controls how control characters are | |
1479 displayed. If it is non-@code{nil}, they are displayed as a caret | |
1480 followed by the character: @samp{^A}. If it is @code{nil}, they are | |
1481 displayed as a backslash followed by three octal digits: @samp{\001}. | |
1482 @end defopt | |
1483 | |
1484 @c Following may have overfull hbox. | |
1485 @defvar default-ctl-arrow | |
1486 The value of this variable is the default value for @code{ctl-arrow} in | |
1487 buffers that do not override it. @xref{Default Value}. | |
1488 @end defvar | |
1489 | |
1490 @defopt tab-width | |
1491 The value of this variable is the spacing between tab stops used for | |
1492 displaying tab characters in Emacs buffers. The default is 8. Note | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1493 that this feature is completely independent of the user-settable tab |
6598 | 1494 stops used by the command @code{tab-to-tab-stop}. @xref{Indent Tabs}. |
1495 @end defopt | |
1496 | |
1497 @node Display Tables | |
1498 @section Display Tables | |
1499 | |
1500 @cindex display table | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1501 You can use the @dfn{display table} feature to control how all possible |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1502 character codes display on the screen. This is useful for displaying |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1503 European languages that have letters not in the @sc{ASCII} character |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1504 set. |
6598 | 1505 |
1506 The display table maps each character code into a sequence of | |
1507 @dfn{glyphs}, each glyph being an image that takes up one character | |
1508 position on the screen. You can also define how to display each glyph | |
1509 on your terminal, using the @dfn{glyph table}. | |
1510 | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1511 Display tables affect how the mode line is displayed; if you want to |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1512 force redisplay of the mode line using a new display table, call |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1513 @code{force-mode-line-update} (@pxref{Mode Line Format}). |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1514 |
6598 | 1515 @menu |
1516 * Display Table Format:: What a display table consists of. | |
1517 * Active Display Table:: How Emacs selects a display table to use. | |
1518 * Glyphs:: How to define a glyph, and what glyphs mean. | |
1519 @end menu | |
1520 | |
1521 @node Display Table Format | |
1522 @subsection Display Table Format | |
1523 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1524 A display table is actually a char-table (@pxref{Char-Tables}) with |
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1525 @code{display-table} as its subtype. |
6598 | 1526 |
1527 @defun make-display-table | |
1528 This creates and returns a display table. The table initially has | |
1529 @code{nil} in all elements. | |
1530 @end defun | |
1531 | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1532 The ordinary elements of the display table are indexed by character |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1533 codes; the element at index @var{c} says how to display the character |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1534 code @var{c}. The value should be @code{nil} or a vector of glyph |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1535 values (@pxref{Glyphs}). If an element is @code{nil}, it says to |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1536 display that character according to the usual display conventions |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1537 (@pxref{Usual Display}). |
12067 | 1538 |
1539 If you use the display table to change the display of newline | |
1540 characters, the whole buffer will be displayed as one long ``line.'' | |
6598 | 1541 |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1542 The display table also has six ``extra slots'' which serve special |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1543 purposes. Here is a table of their meanings; @code{nil} in any slot |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1544 means to use the default for that slot, as stated below. |
6598 | 1545 |
1546 @table @asis | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1547 @item 0 |
6598 | 1548 The glyph for the end of a truncated screen line (the default for this |
1549 is @samp{$}). @xref{Glyphs}. | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1550 @item 1 |
6598 | 1551 The glyph for the end of a continued line (the default is @samp{\}). |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1552 @item 2 |
6598 | 1553 The glyph for indicating a character displayed as an octal character |
1554 code (the default is @samp{\}). | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1555 @item 3 |
6598 | 1556 The glyph for indicating a control character (the default is @samp{^}). |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1557 @item 4 |
6598 | 1558 A vector of glyphs for indicating the presence of invisible lines (the |
1559 default is @samp{...}). @xref{Selective Display}. | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1560 @item 5 |
8925 | 1561 The glyph used to draw the border between side-by-side windows (the |
1562 default is @samp{|}). @xref{Splitting Windows}. | |
6598 | 1563 @end table |
1564 | |
1565 For example, here is how to construct a display table that mimics the | |
1566 effect of setting @code{ctl-arrow} to a non-@code{nil} value: | |
1567 | |
1568 @example | |
1569 (setq disptab (make-display-table)) | |
1570 (let ((i 0)) | |
1571 (while (< i 32) | |
1572 (or (= i ?\t) (= i ?\n) | |
1573 (aset disptab i (vector ?^ (+ i 64)))) | |
1574 (setq i (1+ i))) | |
1575 (aset disptab 127 (vector ?^ ??))) | |
1576 @end example | |
1577 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1578 @defun display-table-slot display-table slot |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1579 @tindex display-table-slot |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1580 This function returns the value of the extra slot @var{slot} of |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1581 @var{display-table}. The argument @var{slot} may be a number from 0 to |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1582 5 inclusive, or a slot name (symbol). Valid symbols are |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1583 @code{truncation}, @code{wrap}, @code{escape}, @code{control}, |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1584 @code{selective-display}, and @code{vertical-border}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1585 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1586 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1587 @defun set-display-table-slot display-table slot value |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1588 @tindex set-display-table-slot |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1589 This function stores @var{value} in the extra slot @var{slot} of |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1590 @var{display-table}. The argument @var{slot} may be a number from 0 to |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1591 5 inclusive, or a slot name (symbol). Valid symbols are |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1592 @code{truncation}, @code{wrap}, @code{escape}, @code{control}, |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1593 @code{selective-display}, and @code{vertical-border}. |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1594 @end defun |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1595 |
6598 | 1596 @node Active Display Table |
1597 @subsection Active Display Table | |
1598 @cindex active display table | |
1599 | |
1600 Each window can specify a display table, and so can each buffer. When | |
1601 a buffer @var{b} is displayed in window @var{w}, display uses the | |
1602 display table for window @var{w} if it has one; otherwise, the display | |
1603 table for buffer @var{b} if it has one; otherwise, the standard display | |
1604 table if any. The display table chosen is called the @dfn{active} | |
1605 display table. | |
1606 | |
1607 @defun window-display-table window | |
1608 This function returns @var{window}'s display table, or @code{nil} | |
1609 if @var{window} does not have an assigned display table. | |
1610 @end defun | |
1611 | |
1612 @defun set-window-display-table window table | |
1613 This function sets the display table of @var{window} to @var{table}. | |
1614 The argument @var{table} should be either a display table or | |
1615 @code{nil}. | |
1616 @end defun | |
1617 | |
1618 @defvar buffer-display-table | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1619 This variable is automatically buffer-local in all buffers; its value in |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1620 a particular buffer specifies the display table for that buffer. If it |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1621 is @code{nil}, that means the buffer does not have an assigned display |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1622 table. |
6598 | 1623 @end defvar |
1624 | |
1625 @defvar standard-display-table | |
1626 This variable's value is the default display table, used whenever a | |
1627 window has no display table and neither does the buffer displayed in | |
1628 that window. This variable is @code{nil} by default. | |
1629 @end defvar | |
1630 | |
1631 If there is no display table to use for a particular window---that is, | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1632 if the window specifies none, its buffer specifies none, and |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1633 @code{standard-display-table} is @code{nil}---then Emacs uses the usual |
6598 | 1634 display conventions for all character codes in that window. @xref{Usual |
1635 Display}. | |
1636 | |
1637 @node Glyphs | |
1638 @subsection Glyphs | |
1639 | |
1640 @cindex glyph | |
1641 A @dfn{glyph} is a generalization of a character; it stands for an | |
1642 image that takes up a single character position on the screen. Glyphs | |
1643 are represented in Lisp as integers, just as characters are. | |
1644 | |
1645 @cindex glyph table | |
1646 The meaning of each integer, as a glyph, is defined by the glyph | |
1647 table, which is the value of the variable @code{glyph-table}. | |
1648 | |
1649 @defvar glyph-table | |
1650 The value of this variable is the current glyph table. It should be a | |
1651 vector; the @var{g}th element defines glyph code @var{g}. If the value | |
1652 is @code{nil} instead of a vector, then all glyphs are simple (see | |
1653 below). | |
1654 @end defvar | |
1655 | |
1656 Here are the possible types of elements in the glyph table: | |
1657 | |
1658 @table @var | |
1659 @item string | |
1660 Send the characters in @var{string} to the terminal to output | |
1661 this glyph. This alternative is available on character terminals, | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1662 but not under a window system. |
6598 | 1663 |
1664 @item integer | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1665 Define this glyph code as an alias for glyph code @var{integer}. You |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1666 can use an alias to specify a face code for the glyph; see below. |
6598 | 1667 |
1668 @item @code{nil} | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1669 This glyph is simple. On an ordinary terminal, the glyph code mod |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1670 524288 is the character to output. In a window system, the glyph code |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1671 mod 524288 is the character to output, and the glyph code divided by |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1672 524288 specifies the face number (@pxref{Face Functions}) to use while |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1673 outputting it. (524288 is |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1674 @ifinfo |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1675 2**19.) |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1676 @end ifinfo |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1677 @tex |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1678 $2^{19}$.) |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1679 @end tex |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1680 @xref{Faces}. |
6598 | 1681 @end table |
1682 | |
1683 If a glyph code is greater than or equal to the length of the glyph | |
1684 table, that code is automatically simple. | |
1685 | |
1686 @node Beeping | |
1687 @section Beeping | |
1688 @cindex beeping | |
1689 @cindex bell | |
1690 | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1691 This section describes how to make Emacs ring the bell (or blink the |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1692 screen) to attract the user's attention. Be conservative about how |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1693 often you do this; frequent bells can become irritating. Also be |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1694 careful not to use just beeping when signaling an error is more |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1695 appropriate. (@xref{Errors}.) |
6598 | 1696 |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1697 @defun ding &optional do-not-terminate |
6598 | 1698 @cindex keyboard macro termination |
1699 This function beeps, or flashes the screen (see @code{visible-bell} below). | |
1700 It also terminates any keyboard macro currently executing unless | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1701 @var{do-not-terminate} is non-@code{nil}. |
6598 | 1702 @end defun |
1703 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1704 @defun beep &optional do-not-terminate |
6598 | 1705 This is a synonym for @code{ding}. |
1706 @end defun | |
1707 | |
1708 @defvar visible-bell | |
1709 This variable determines whether Emacs should flash the screen to | |
1710 represent a bell. Non-@code{nil} means yes, @code{nil} means no. This | |
21682
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1711 is effective on a window system, and on a character-only terminal |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1712 provided the terminal's Termcap entry defines the visible bell |
90da2489c498
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21007
diff
changeset
|
1713 capability (@samp{vb}). |
6598 | 1714 @end defvar |
1715 | |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1716 @defvar ring-bell-function |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1717 @tindex ring-bell-function |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1718 If this is non-@code{nil}, it specifies how Emacs should ``ring the |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1719 bell.'' Its value should be a function of no arguments. |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1720 @end defvar |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1721 |
6598 | 1722 @node Window Systems |
1723 @section Window Systems | |
1724 | |
1725 Emacs works with several window systems, most notably the X Window | |
1726 System. Both Emacs and X use the term ``window'', but use it | |
1727 differently. An Emacs frame is a single window as far as X is | |
1728 concerned; the individual Emacs windows are not known to X at all. | |
1729 | |
1730 @defvar window-system | |
1731 @cindex X Window System | |
1732 This variable tells Lisp programs what window system Emacs is running | |
1733 under. Its value should be a symbol such as @code{x} (if Emacs is | |
1734 running under X) or @code{nil} (if Emacs is running on an ordinary | |
1735 terminal). | |
1736 @end defvar | |
1737 | |
1738 @defvar window-setup-hook | |
21007
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1739 This variable is a normal hook which Emacs runs after handling the |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1740 initialization files. Emacs runs this hook after it has completed |
66d807bdc5b4
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
18234
diff
changeset
|
1741 loading your @file{.emacs} file, the default initialization file (if |
22138
d4ac295a98b3
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
21682
diff
changeset
|
1742 any), and the terminal-specific Lisp code, and running the hook |
6598 | 1743 @code{term-setup-hook}. |
1744 | |
1745 This hook is used for internal purposes: setting up communication with | |
1746 the window system, and creating the initial window. Users should not | |
1747 interfere with it. | |
1748 @end defvar |