comparison lispref/display.texi @ 21007:66d807bdc5b4

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sat, 28 Feb 1998 01:53:53 +0000
parents 2e66f4ee4ca8
children 90da2489c498
comparison
equal deleted inserted replaced
21006:00022857f529 21007:66d807bdc5b4
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the GNU Emacs Lisp Reference Manual. 2 @c This is part of the GNU Emacs Lisp Reference Manual.
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc.
4 @c See the file elisp.texi for copying conditions. 4 @c See the file elisp.texi for copying conditions.
5 @setfilename ../info/display 5 @setfilename ../info/display
6 @node Display, Calendar, System Interface, Top 6 @node Display, Calendar, System Interface, Top
7 @chapter Emacs Display 7 @chapter Emacs Display
8 8
17 * Invisible Text:: Hiding part of the buffer text. 17 * Invisible Text:: Hiding part of the buffer text.
18 * Selective Display:: Hiding part of the buffer text (the old way). 18 * Selective Display:: Hiding part of the buffer text (the old way).
19 * Overlay Arrow:: Display of an arrow to indicate position. 19 * Overlay Arrow:: Display of an arrow to indicate position.
20 * Temporary Displays:: Displays that go away automatically. 20 * Temporary Displays:: Displays that go away automatically.
21 * Overlays:: Use overlays to highlight parts of the buffer. 21 * Overlays:: Use overlays to highlight parts of the buffer.
22 * Width:: How wide is a character or string.
22 * Faces:: A face defines a graphics appearance: font, color, etc. 23 * Faces:: A face defines a graphics appearance: font, color, etc.
23 * Blinking:: How Emacs shows the matching open parenthesis. 24 * Blinking:: How Emacs shows the matching open parenthesis.
24 * Inverse Video:: Specifying how the screen looks. 25 * Inverse Video:: Specifying how the screen looks.
25 * Usual Display:: The usual conventions for displaying nonprinting chars. 26 * Usual Display:: The usual conventions for displaying nonprinting chars.
26 * Display Tables:: How to specify other conventions. 27 * Display Tables:: How to specify other conventions.
58 59
59 @defvar no-redraw-on-reenter 60 @defvar no-redraw-on-reenter
60 @cindex suspend (cf. @code{no-redraw-on-reenter}) 61 @cindex suspend (cf. @code{no-redraw-on-reenter})
61 @cindex resume (cf. @code{no-redraw-on-reenter}) 62 @cindex resume (cf. @code{no-redraw-on-reenter})
62 This variable controls whether Emacs redraws the entire screen after it 63 This variable controls whether Emacs redraws the entire screen after it
63 has been suspended and resumed. Non-@code{nil} means yes, @code{nil} 64 has been suspended and resumed. Non-@code{nil} means there is no need
64 means no. 65 to redraw, @code{nil} means redrawing is needed.
65 @end defvar 66 @end defvar
66 67
67 @node Screen Size 68 @node Screen Size
68 @section Screen Size 69 @section Screen Size
69 @cindex size of screen 70 @cindex size of screen
164 edge of the window, in side-by-side windows (@pxref{Splitting Windows}). 165 edge of the window, in side-by-side windows (@pxref{Splitting Windows}).
165 If it is non-@code{nil}, these lines are truncated; otherwise, 166 If it is non-@code{nil}, these lines are truncated; otherwise,
166 @code{truncate-lines} says what to do with them. 167 @code{truncate-lines} says what to do with them.
167 @end defopt 168 @end defopt
168 169
169 You can override the images that indicate continuation or truncation 170 You can override the glyphs that indicate continuation or truncation
170 with the display table; see @ref{Display Tables}. 171 using the display table; see @ref{Display Tables}.
171 172
172 If your buffer contains @strong{very} long lines, and you use 173 If your buffer contains @strong{very} long lines, and you use
173 continuation to display them, just thinking about them can make Emacs 174 continuation to display them, just thinking about them can make Emacs
174 redisplay slow. The column computation and indentation functions also 175 redisplay slow. The column computation and indentation functions also
175 become slow. Then you might find it advisable to set 176 become slow. Then you might find it advisable to set
233 ---------- Echo Area ---------- 234 ---------- Echo Area ----------
234 @end group 235 @end group
235 @end example 236 @end example
236 @end defun 237 @end defun
237 238
239 @tindex current-message
240 @defun current-message
241 This function returns the message currently being displayed in the
242 echo area, or @code{nil} if there is none.
243 @end defun
244
245 @tindex echo-area-clear-hook
246 @defvar echo-area-clear-hook
247 This normal hook is run whenever the echo area is cleared---either by
248 @code{(message nil)} or for any other reason.
249 @end defvar
250
238 Almost all the messages displayed in the echo area are also recorded 251 Almost all the messages displayed in the echo area are also recorded
239 in the @samp{*Messages*} buffer. 252 in the @samp{*Messages*} buffer.
240 253
241 @defopt message-log-max 254 @defopt message-log-max
242 This variable specifies how many lines to keep in the @samp{*Messages*} 255 This variable specifies how many lines to keep in the @samp{*Messages*}
325 by a visible newline, it displays an ellipsis. 338 by a visible newline, it displays an ellipsis.
326 @end table 339 @end table
327 @end table 340 @end table
328 @end defvar 341 @end defvar
329 342
343 Two functions are specifically provided for adding elements to
344 @code{buffer-invisibility-spec} and removing elements from it.
345
346 @tindex add-to-invisibility-spec
347 @defun add-to-invisibility-spec element
348 Add the element @var{element} to @code{buffer-invisibility-spec}
349 (if it is not already present in that list).
350 @end defun
351
352 @tindex remove-from-invisibility-spec
353 @defun remove-from-invisibility-spec element
354 Remove the element @var{element} from @code{buffer-invisibility-spec}.
355 @end defun
356
357 One convention about the use of @code{buffer-invisibility-spec} is
358 that a major mode should use the mode's own name as an element of
359 @code{buffer-invisibility-spec} and as the value of the @code{invisible}
360 property:
361
362 @example
363 ;; If we want to display an ellipsis:
364 (add-to-invisibility-spec '(my-symbol . t))
365 ;; If you don't want ellipsis:
366 (add-to-invisibility-spec 'my-symbol)
367
368 (overlay-put (make-overlay beginning end)
369 'invisible 'my-symbol)
370
371 ;; When done with the overlays:
372 (remove-from-invisibility-spec '(my-symbol . t))
373 ;; Or respectively:
374 (remove-from-invisibility-spec 'my-symbol)
375 @end example
376
330 @vindex line-move-ignore-invisible 377 @vindex line-move-ignore-invisible
331 Ordinarily, commands that operate on text or move point do not care 378 Ordinarily, commands that operate on text or move point do not care
332 whether the text is invisible. The user-level line motion commands 379 whether the text is invisible. The user-level line motion commands
333 explicitly ignore invisible newlines if 380 explicitly ignore invisible newlines if
334 @code{line-move-ignore-invisible} is non-@code{nil}, but only because 381 @code{line-move-ignore-invisible} is non-@code{nil}, but only because
335 they are explicitly programmed to do so. 382 they are explicitly programmed to do so.
383
384 Incremental search can make invisible overlays visible temporarily
385 and/or permanently when a match includes invisible text. To enable
386 this, the overlay should have a non-@code{nil}
387 @code{isearch-open-invisible} property. The property value should be a
388 function to be called with the overlay as an argument. This function
389 should make the overlay visible permanently; it is used when the match
390 overlaps the overlay on exit from the search.
391
392 During the search, such overlays are made temporarily visible by
393 temporarily modifying their invisible and intangible properties. If you
394 want this to be done differently for a certain overlays, give it a
395 @code{isearch-open-invisible-temporary} property which is a function.
396 The function is called with two arguments: the first is the overlay, and
397 the second is @code{nil} to make the overlay visible or @code{t} to make
398 it invisible again.
336 399
337 @node Selective Display 400 @node Selective Display
338 @section Selective Display 401 @section Selective Display
339 @cindex selective display 402 @cindex selective display
340 403
650 @dfn{category} of the overlay. It should be a symbol. The properties 713 @dfn{category} of the overlay. It should be a symbol. The properties
651 of the symbol serve as defaults for the properties of the overlay. 714 of the symbol serve as defaults for the properties of the overlay.
652 715
653 @item face 716 @item face
654 @kindex face @r{(overlay property)} 717 @kindex face @r{(overlay property)}
655 This property controls the font and color of text. Its value is a face 718 This property controls the way text is displayed---for example, which
656 name or a list of face names. @xref{Faces}, for more information. This 719 font and which colors. Its value is a face name or a list of face
657 feature may be temporary; in the future, we may replace it with other 720 names. @xref{Faces}, for more information.
658 ways of specifying how to display text. 721
722 If the property value is a list, elements may also have the form
723 @code{(foreground-color . @var{color-name})} or @code{(background-color
724 . @var{color-name})}. These elements specify just the foreground color
725 or just the background color; therefore, there is no need to create a
726 face for each color that you want to use.
659 727
660 @item mouse-face 728 @item mouse-face
661 @kindex mouse-face @r{(overlay property)} 729 @kindex mouse-face @r{(overlay property)}
662 This property is used instead of @code{face} when the mouse is within 730 This property is used instead of @code{face} when the mouse is within
663 the range of the overlay. This feature may be temporary, like 731 the range of the overlay.
664 @code{face}.
665 732
666 @item modification-hooks 733 @item modification-hooks
667 @kindex modification-hooks @r{(overlay property)} 734 @kindex modification-hooks @r{(overlay property)}
668 This property's value is a list of functions to be called if any 735 This property's value is a list of functions to be called if any
669 character within the overlay is changed or if text is inserted strictly 736 character within the overlay is changed or if text is inserted strictly
701 @kindex invisible @r{(overlay property)} 768 @kindex invisible @r{(overlay property)}
702 The @code{invisible} property can make the text in the overlay 769 The @code{invisible} property can make the text in the overlay
703 invisible, which means that it does not appear on the screen. 770 invisible, which means that it does not appear on the screen.
704 @xref{Invisible Text}, for details. 771 @xref{Invisible Text}, for details.
705 772
706 @ignore This isn't implemented yet
707 @item intangible 773 @item intangible
708 @kindex intangible @r{(overlay property)} 774 @kindex intangible @r{(overlay property)}
709 The @code{intangible} property on an overlay works just like the 775 The @code{intangible} property on an overlay works just like the
710 @code{intangible} text property. @xref{Special Properties}, for details. 776 @code{intangible} text property. @xref{Special Properties}, for details.
711 @end ignore 777
778 @item isearch-open-invisible
779 @itemx isearch-open-invisible-temporary
780 These properties control how incremental search should make invisible an
781 overlay visible, either permanently or temporarily. @xref{Invisible
782 Text}.
712 783
713 @item before-string 784 @item before-string
714 @kindex before-string @r{(overlay property)} 785 @kindex before-string @r{(overlay property)}
715 This property's value is a string to add to the display at the beginning 786 This property's value is a string to add to the display at the beginning
716 of the overlay. The string does not appear in the buffer in any 787 of the overlay. The string does not appear in the buffer in any
763 @subsection Managing Overlays 834 @subsection Managing Overlays
764 835
765 This section describes the functions to create, delete and move 836 This section describes the functions to create, delete and move
766 overlays, and to examine their contents. 837 overlays, and to examine their contents.
767 838
768 @defun make-overlay start end &optional buffer 839 @defun make-overlay start end &optional buffer front-advance rear-advance
769 This function creates and returns an overlay that belongs to 840 This function creates and returns an overlay that belongs to
770 @var{buffer} and ranges from @var{start} to @var{end}. Both @var{start} 841 @var{buffer} and ranges from @var{start} to @var{end}. Both @var{start}
771 and @var{end} must specify buffer positions; they may be integers or 842 and @var{end} must specify buffer positions; they may be integers or
772 markers. If @var{buffer} is omitted, the overlay is created in the 843 markers. If @var{buffer} is omitted, the overlay is created in the
773 current buffer. 844 current buffer.
845
846 The arguments @var{front-advance} and @var{rear-advance} specify the
847 insertion type for the start of the overlay and for the end of the
848 overlay. @xref{Marker Insertion Types}.
774 @end defun 849 @end defun
775 850
776 @defun overlay-start overlay 851 @defun overlay-start overlay
777 This function returns the position at which @var{overlay} starts. 852 This function returns the position at which @var{overlay} starts,
853 as an integer.
778 @end defun 854 @end defun
779 855
780 @defun overlay-end overlay 856 @defun overlay-end overlay
781 This function returns the position at which @var{overlay} ends. 857 This function returns the position at which @var{overlay} ends,
858 as an integer.
782 @end defun 859 @end defun
783 860
784 @defun overlay-buffer overlay 861 @defun overlay-buffer overlay
785 This function returns the buffer that @var{overlay} belongs to. 862 This function returns the buffer that @var{overlay} belongs to.
786 @end defun 863 @end defun
810 @var{pos} in the current buffer. The list is in no particular order. 887 @var{pos} in the current buffer. The list is in no particular order.
811 An overlay contains position @var{pos} if it begins at or before 888 An overlay contains position @var{pos} if it begins at or before
812 @var{pos}, and ends after @var{pos}. 889 @var{pos}, and ends after @var{pos}.
813 @end defun 890 @end defun
814 891
892 @tindex overlays-in
893 @defun overlays-in beg end
894 This function returns a list of the overlays that overlap the region
895 @var{beg} through @var{end}. ``Overlap'' means that at least one
896 character is contained within the overlay and also contained within the
897 specified region; however, empty overlays are included in the result if
898 they are located at @var{beg} or between @var{beg} and @var{end}.
899 @end defun
900
815 @defun next-overlay-change pos 901 @defun next-overlay-change pos
816 This function returns the buffer position of the next beginning or end 902 This function returns the buffer position of the next beginning or end
817 of an overlay, after @var{pos}. 903 of an overlay, after @var{pos}.
818 @end defun 904 @end defun
819 905
820 @defun previous-overlay-change pos 906 @defun previous-overlay-change pos
821 This function returns the buffer position of the previous beginning or 907 This function returns the buffer position of the previous beginning or
822 end of an overlay, before @var{pos}. 908 end of an overlay, before @var{pos}.
823 @end defun 909 @end defun
824 910
911 @node Width
912 @section Width
913
914 Since not all characters have the same width, these functions let you
915 check the width of a character. @ref{Primitive Indent}
916
917 @xref{Screen Lines}, for related
918 functions.
919
920 @tindex char-width
921 @defun char-width char
922 This function returns the width in columns of the character @var{char},
923 if it were displayed in the current buffer and the selected window.
924 @end defun
925
926 @tindex string-width
927 @defun string-width string
928 This function returns the width in columns of the string @var{string},
929 if it were displayed in the current buffer and the selected window.
930 @end defun
931
932 @tindex truncate-string-to-width
933 @defun truncate-string-to-width string width &optional start-column padding
934 This function returns the part of @var{string} that fits within
935 @var{width} columns, as a new string.
936
937 If @var{string} does not reach @var{width}, then the result ends where
938 @var{string} ends. If one multi-column character in @var{string}
939 extends across the column @var{width}, that character is not included in
940 the result. Thus, the result can fall short of @var{width} but cannot
941 go beyond it.
942
943 The optional argument @var{start-column} specifies the starting column.
944 If this is non-@code{nil}, then the first @var{start-column} columns of
945 the string are omitted from the value. If one multi-column character in
946 @var{string} extends across the column @var{start-column}, that
947 character is not included.
948
949 The optional argument @var{padding}, if non-@code{nil}, is a padding
950 character added at the beginning and end of the result string, to extend
951 it to exactly @var{width} columns. The padding character is used at the
952 end of the result if it falls short of @var{width}. It is also used at
953 the beginning of the result if one multi-column character in
954 @var{string} extends across the column @var{start-column}.
955
956 @example
957 (truncate-string-to-width "\tab\t" 12 4)
958 @result{} "ab"
959 (truncate-string-to-width "\tab\t" 12 4 ?\ )
960 @result{} " ab "
961 @end example
962 @end defun
963
825 @node Faces 964 @node Faces
826 @section Faces 965 @section Faces
827 @cindex face 966 @cindex face
828 967
829 A @dfn{face} is a named collection of graphical attributes: font, 968 A @dfn{face} is a named collection of graphical attributes: font,
830 foreground color, background color and optional underlining. Faces 969 foreground color, background color, and optional underlining. Faces
831 control the display of text on the screen. 970 control the display of text on the screen.
832 971
833 @cindex face id 972 @cindex face id
834 Each face has its own @dfn{face id number} which distinguishes faces at 973 Each face has its own @dfn{face id number} which distinguishes faces at
835 low levels within Emacs. However, for most purposes, you can refer to 974 low levels within Emacs. However, for most purposes, you can refer to
1001 they are used automatically to handle certain shades of gray. 1140 they are used automatically to handle certain shades of gray.
1002 @end defun 1141 @end defun
1003 1142
1004 @defun set-face-font face font &optional frame 1143 @defun set-face-font face font &optional frame
1005 This function sets the font of face @var{face}. The argument @var{font} 1144 This function sets the font of face @var{face}. The argument @var{font}
1006 should be a string. 1145 should be a string. Note that if you set the font explicitly, the bold
1007 @end defun 1146 and italic attributes cease to have any effect, because the precise font
1008 1147 that you specified is always used.
1009 @defun make-face-bold face &optional frame noerror
1010 Make face @var{face} bold, by setting its font to the bold variant of
1011 the font it is now using. If @var{noerror} is non-@code{nil}, return
1012 @code{nil} on failure; otherwise, that signals an error.
1013 @end defun
1014
1015 @defun make-face-italic face &optional frame noerror
1016 Make face @var{face} italic, by setting its font to the italic variant of
1017 the font it is now using. If @var{noerror} is non-@code{nil}, return
1018 @code{nil} on failure; otherwise, that signals an error.
1019 @end defun
1020
1021 @defun make-face-bold-italic face &optional frame noerror
1022 Make face @var{face} bold and italic, by setting its font to the bold
1023 italic variant of the font it is now using. If @var{noerror} is
1024 non-@code{nil}, return @code{nil} on failure; otherwise, that signals an
1025 error.
1026 @end defun
1027
1028 @defun make-face-unbold face &optional frame noerror
1029 Make face @var{face} not bold, by setting its font to the medium variant
1030 of the font it is now using. If @var{noerror} is non-@code{nil}, return
1031 @code{nil} on failure; otherwise, that signals an error.
1032 @end defun
1033
1034 @defun make-face-unitalic face &optional frame noerror
1035 Make face @var{face} italic, by setting its font to the non-slanted
1036 variant of the font it is now using. If @var{noerror} is
1037 non-@code{nil}, return @code{nil} on failure; otherwise, that signals an
1038 error.
1039 @end defun 1148 @end defun
1040 1149
1041 @defun set-face-underline-p face underline-p &optional frame 1150 @defun set-face-underline-p face underline-p &optional frame
1042 This function sets the underline attribute of face @var{face}. 1151 This function sets the underline attribute of face @var{face}.
1043 Non-@code{nil} means do underline; @code{nil} means don't. 1152 Non-@code{nil} means do underline; @code{nil} means don't.
1153 @end defun
1154
1155 @tindex set-face-bold-p
1156 @defun set-face-bold-p face bold-p &optional frame
1157 This function sets the bold attribute of face @var{face}.
1158 Non-@code{nil} means bold; @code{nil} means non-bold.
1159 @end defun
1160
1161 @tindex set-face-italic-p
1162 @defun set-face-italic-p face italic-p &optional frame
1163 This function sets the italic attribute of face @var{face}.
1164 Non-@code{nil} means italic; @code{nil} means non-italic.
1044 @end defun 1165 @end defun
1045 1166
1046 @defun invert-face face &optional frame 1167 @defun invert-face face &optional frame
1047 Swap the foreground and background colors of face @var{face}. If the 1168 Swap the foreground and background colors of face @var{face}. If the
1048 face doesn't specify both foreground and background, then its foreground 1169 face doesn't specify both foreground and background, then its foreground
1070 1191
1071 @defun face-underline-p face &optional frame 1192 @defun face-underline-p face &optional frame
1072 This function returns the underline attribute of face @var{face}. 1193 This function returns the underline attribute of face @var{face}.
1073 @end defun 1194 @end defun
1074 1195
1196 @tindex face-bold-p
1197 @defun face-bold-p face &optional frame
1198 This function returns the bold attribute of face @var{face}.
1199 @end defun
1200
1201 @tindex face-italic-p
1202 @defun face-italic-p face &optional frame
1203 This function returns the italic attribute of face @var{face}.
1204 @end defun
1205
1075 @defun face-id face 1206 @defun face-id face
1076 This function returns the face id number of face @var{face}. 1207 This function returns the face id number of face @var{face}.
1208 @end defun
1209
1210 @tindex face-documentation
1211 @defun face-documentation face
1212 This function returns the documentation string of face @var{face}, or
1213 @code{nil} if none was specified for it.
1077 @end defun 1214 @end defun
1078 1215
1079 @defun face-equal face1 face2 &optional frame 1216 @defun face-equal face1 face2 &optional frame
1080 This returns @code{t} if the faces @var{face1} and @var{face2} have the 1217 This returns @code{t} if the faces @var{face1} and @var{face2} have the
1081 same attributes for display. 1218 same attributes for display.
1228 @code{nil}. Thus, when you set up a display table, you need only 1365 @code{nil}. Thus, when you set up a display table, you need only
1229 specify the characters for which you want unusual behavior. 1366 specify the characters for which you want unusual behavior.
1230 1367
1231 These variables affect the way certain characters are displayed on the 1368 These variables affect the way certain characters are displayed on the
1232 screen. Since they change the number of columns the characters occupy, 1369 screen. Since they change the number of columns the characters occupy,
1233 they also affect the indentation functions. 1370 they also affect the indentation functions. These variables also affect
1371 how the mode line is displayed; if you want to force redisplay of the
1372 mode line using the new values, call the function
1373 @code{force-mode-line-update} (@pxref{Mode Line Format}).
1234 1374
1235 @defopt ctl-arrow 1375 @defopt ctl-arrow
1236 @cindex control characters in display 1376 @cindex control characters in display
1237 This buffer-local variable controls how control characters are 1377 This buffer-local variable controls how control characters are
1238 displayed. If it is non-@code{nil}, they are displayed as a caret 1378 displayed. If it is non-@code{nil}, they are displayed as a caret
1247 @end defvar 1387 @end defvar
1248 1388
1249 @defopt tab-width 1389 @defopt tab-width
1250 The value of this variable is the spacing between tab stops used for 1390 The value of this variable is the spacing between tab stops used for
1251 displaying tab characters in Emacs buffers. The default is 8. Note 1391 displaying tab characters in Emacs buffers. The default is 8. Note
1252 that this feature is completely independent from the user-settable tab 1392 that this feature is completely independent of the user-settable tab
1253 stops used by the command @code{tab-to-tab-stop}. @xref{Indent Tabs}. 1393 stops used by the command @code{tab-to-tab-stop}. @xref{Indent Tabs}.
1254 @end defopt 1394 @end defopt
1255 1395
1256 @node Display Tables 1396 @node Display Tables
1257 @section Display Tables 1397 @section Display Tables
1265 The display table maps each character code into a sequence of 1405 The display table maps each character code into a sequence of
1266 @dfn{glyphs}, each glyph being an image that takes up one character 1406 @dfn{glyphs}, each glyph being an image that takes up one character
1267 position on the screen. You can also define how to display each glyph 1407 position on the screen. You can also define how to display each glyph
1268 on your terminal, using the @dfn{glyph table}. 1408 on your terminal, using the @dfn{glyph table}.
1269 1409
1410 Display tables affect how the mode line is displayed; if you want to
1411 force redisplay of the mode line using a new display table, call
1412 @code{force-mode-line-update} (@pxref{Mode Line Format}).
1413
1270 @menu 1414 @menu
1271 * Display Table Format:: What a display table consists of. 1415 * Display Table Format:: What a display table consists of.
1272 * Active Display Table:: How Emacs selects a display table to use. 1416 * Active Display Table:: How Emacs selects a display table to use.
1273 * Glyphs:: How to define a glyph, and what glyphs mean. 1417 * Glyphs:: How to define a glyph, and what glyphs mean.
1274 * ISO Latin 1:: How to use display tables
1275 to support the ISO Latin 1 character set.
1276 @end menu 1418 @end menu
1277 1419
1278 @node Display Table Format 1420 @node Display Table Format
1279 @subsection Display Table Format 1421 @subsection Display Table Format
1280 1422
1281 A display table is actually an array of 262 elements. 1423 A display table is actually char-table with subtype @code{display-table}.
1282 1424
1283 @defun make-display-table 1425 @defun make-display-table
1284 This creates and returns a display table. The table initially has 1426 This creates and returns a display table. The table initially has
1285 @code{nil} in all elements. 1427 @code{nil} in all elements.
1286 @end defun 1428 @end defun
1287 1429
1288 The first 256 elements correspond to character codes; the @var{n}th 1430 The ordinary elements of the display table are indexed by character
1289 element says how to display the character code @var{n}. The value 1431 codes; the element at index @var{c} says how to display the character
1290 should be @code{nil} or a vector of glyph values (@pxref{Glyphs}). If 1432 code @var{c}. The value should be @code{nil} or a vector of glyph
1291 an element is @code{nil}, it says to display that character according to 1433 values (@pxref{Glyphs}). If an element is @code{nil}, it says to
1292 the usual display conventions (@pxref{Usual Display}). 1434 display that character according to the usual display conventions
1435 (@pxref{Usual Display}).
1293 1436
1294 If you use the display table to change the display of newline 1437 If you use the display table to change the display of newline
1295 characters, the whole buffer will be displayed as one long ``line.'' 1438 characters, the whole buffer will be displayed as one long ``line.''
1296 1439
1297 The remaining six elements of a display table serve special purposes, 1440 The display table also has six ``extra slots'' which serve special
1298 and @code{nil} means use the default stated below. 1441 purposes. Here is a table of their meanings; @code{nil} means to use
1442 the default stated below.
1299 1443
1300 @table @asis 1444 @table @asis
1301 @item 256 1445 @item 0
1302 The glyph for the end of a truncated screen line (the default for this 1446 The glyph for the end of a truncated screen line (the default for this
1303 is @samp{$}). @xref{Glyphs}. 1447 is @samp{$}). @xref{Glyphs}.
1304 @item 257 1448 @item 1
1305 The glyph for the end of a continued line (the default is @samp{\}). 1449 The glyph for the end of a continued line (the default is @samp{\}).
1306 @item 258 1450 @item 2
1307 The glyph for indicating a character displayed as an octal character 1451 The glyph for indicating a character displayed as an octal character
1308 code (the default is @samp{\}). 1452 code (the default is @samp{\}).
1309 @item 259 1453 @item 3
1310 The glyph for indicating a control character (the default is @samp{^}). 1454 The glyph for indicating a control character (the default is @samp{^}).
1311 @item 260 1455 @item 4
1312 A vector of glyphs for indicating the presence of invisible lines (the 1456 A vector of glyphs for indicating the presence of invisible lines (the
1313 default is @samp{...}). @xref{Selective Display}. 1457 default is @samp{...}). @xref{Selective Display}.
1314 @item 261 1458 @item 5
1315 The glyph used to draw the border between side-by-side windows (the 1459 The glyph used to draw the border between side-by-side windows (the
1316 default is @samp{|}). @xref{Splitting Windows}. 1460 default is @samp{|}). @xref{Splitting Windows}.
1317 @end table 1461 @end table
1318 1462
1319 For example, here is how to construct a display table that mimics the 1463 For example, here is how to construct a display table that mimics the
1327 (aset disptab i (vector ?^ (+ i 64)))) 1471 (aset disptab i (vector ?^ (+ i 64))))
1328 (setq i (1+ i))) 1472 (setq i (1+ i)))
1329 (aset disptab 127 (vector ?^ ??))) 1473 (aset disptab 127 (vector ?^ ??)))
1330 @end example 1474 @end example
1331 1475
1476 @tindex display-table-slot
1477 @defun display-table-slot display-table slot
1478 This function returns the value of the extra slot @var{slot} of
1479 @var{display-table}. The argument @var{slot} may be a number from 0 to
1480 5 inclusive, or a slot name (symbol). Valid symbols are
1481 @code{truncation}, @code{wrap}, @code{escape}, @code{control},
1482 @code{selective-display}, and @code{vertical-border}.
1483 @end defun
1484
1485 @tindex set-display-table-slot
1486 @defun set-display-table-slot display-table slot value
1487 This function stores @var{value} in the extra slot @var{slot} of
1488 @var{display-table}. The argument @var{slot} may be a number from 0 to
1489 5 inclusive, or a slot name (symbol). Valid symbols are
1490 @code{truncation}, @code{wrap}, @code{escape}, @code{control},
1491 @code{selective-display}, and @code{vertical-border}.
1492 @end defun
1493
1332 @node Active Display Table 1494 @node Active Display Table
1333 @subsection Active Display Table 1495 @subsection Active Display Table
1334 @cindex active display table 1496 @cindex active display table
1335 1497
1336 Each window can specify a display table, and so can each buffer. When 1498 Each window can specify a display table, and so can each buffer. When
1362 window has no display table and neither does the buffer displayed in 1524 window has no display table and neither does the buffer displayed in
1363 that window. This variable is @code{nil} by default. 1525 that window. This variable is @code{nil} by default.
1364 @end defvar 1526 @end defvar
1365 1527
1366 If there is no display table to use for a particular window---that is, 1528 If there is no display table to use for a particular window---that is,
1367 if the window has none, its buffer has none, and 1529 if the window specifies none, its buffer specifies none, and
1368 @code{standard-display-table} has none---then Emacs uses the usual 1530 @code{standard-display-table} is @code{nil}---then Emacs uses the usual
1369 display conventions for all character codes in that window. @xref{Usual 1531 display conventions for all character codes in that window. @xref{Usual
1370 Display}. 1532 Display}.
1371 1533
1372 @node Glyphs 1534 @node Glyphs
1373 @subsection Glyphs 1535 @subsection Glyphs
1399 @item integer 1561 @item integer
1400 Define this glyph code as an alias for code @var{integer}. You can use 1562 Define this glyph code as an alias for code @var{integer}. You can use
1401 an alias to specify a face code for the glyph; see below. 1563 an alias to specify a face code for the glyph; see below.
1402 1564
1403 @item @code{nil} 1565 @item @code{nil}
1404 This glyph is simple. On an ordinary terminal, the glyph code mod 256 1566 This glyph is simple. On an ordinary terminal, the glyph code mod 524288
1405 is the character to output. With X, the glyph code mod 256 is the 1567 is the character to output. With X, the glyph code mod 524288 is the
1406 character to output, and the glyph code divided by 256 specifies the 1568 character to output, and the glyph code divided by 524288 specifies the
1407 @dfn{face id number} to use while outputting it. @xref{Faces}. 1569 @dfn{face id number} to use while outputting it. (524288 is
1570 @ifinfo
1571 2**19.
1572 @end ifinfo
1573 @tex
1574 $2^{19}$.
1575 @end tex
1576 @xref{Faces}.
1408 @end table 1577 @end table
1409 1578
1410 If a glyph code is greater than or equal to the length of the glyph 1579 If a glyph code is greater than or equal to the length of the glyph
1411 table, that code is automatically simple. 1580 table, that code is automatically simple.
1412
1413 @node ISO Latin 1
1414 @subsection ISO Latin 1
1415
1416 If you have a terminal that can handle the entire ISO Latin 1 character
1417 set, you can arrange to use that character set as follows:
1418
1419 @example
1420 (require 'disp-table)
1421 ;; @r{Set char codes 160--255 to display as themselves.}
1422 ;; @r{(Codes 128--159 are the additional control characters.)}
1423 (standard-display-8bit 160 255)
1424 @end example
1425
1426 If you are editing buffers written in the ISO Latin 1 character set and
1427 your terminal doesn't handle anything but @sc{ASCII}, you can load the
1428 file @file{iso-ascii} to set up a display table that displays the other
1429 ISO characters as explanatory sequences of @sc{ASCII} characters. For
1430 example, the character ``o with umlaut'' displays as @samp{@{"o@}}.
1431
1432 Some European countries have terminals that don't support ISO Latin 1
1433 but do support the special characters for that country's language. You
1434 can define a display table to work one language using such terminals.
1435 For an example, see @file{lisp/iso-swed.el}, which handles certain
1436 Swedish terminals.
1437
1438 You can load the appropriate display table for your terminal
1439 automatically by writing a terminal-specific Lisp file for the terminal
1440 type.
1441 1581
1442 @node Beeping 1582 @node Beeping
1443 @section Beeping 1583 @section Beeping
1444 @cindex beeping 1584 @cindex beeping
1445 @cindex bell 1585 @cindex bell
1446 1586
1447 You can make Emacs ring a bell (or blink the screen) to attract the 1587 This section describes how to make Emacs ring the bell (or blink the
1448 user's attention. Be conservative about how often you do this; frequent 1588 screen) to attract the user's attention. Be conservative about how
1449 bells can become irritating. Also be careful not to use beeping alone 1589 often you do this; frequent bells can become irritating. Also be
1450 when signaling an error is appropriate. (@xref{Errors}.) 1590 careful not to use just beeping when signaling an error is more
1591 appropriate. (@xref{Errors}.)
1451 1592
1452 @defun ding &optional dont-terminate 1593 @defun ding &optional dont-terminate
1453 @cindex keyboard macro termination 1594 @cindex keyboard macro termination
1454 This function beeps, or flashes the screen (see @code{visible-bell} below). 1595 This function beeps, or flashes the screen (see @code{visible-bell} below).
1455 It also terminates any keyboard macro currently executing unless 1596 It also terminates any keyboard macro currently executing unless
1466 is effective under X windows, and on a character-only terminal provided 1607 is effective under X windows, and on a character-only terminal provided
1467 the terminal's Termcap entry defines the visible bell capability 1608 the terminal's Termcap entry defines the visible bell capability
1468 (@samp{vb}). 1609 (@samp{vb}).
1469 @end defvar 1610 @end defvar
1470 1611
1612 @tindex ring-bell-function
1613 @defvar ring-bell-function
1614 If this is non-@code{nil}, it specifies how Emacs should ``ring the
1615 bell.'' Its value should bea function of no arguments.
1616 @end defvar
1617
1471 @node Window Systems 1618 @node Window Systems
1472 @section Window Systems 1619 @section Window Systems
1473 1620
1474 Emacs works with several window systems, most notably the X Window 1621 Emacs works with several window systems, most notably the X Window
1475 System. Both Emacs and X use the term ``window'', but use it 1622 System. Both Emacs and X use the term ``window'', but use it
1483 running under X) or @code{nil} (if Emacs is running on an ordinary 1630 running under X) or @code{nil} (if Emacs is running on an ordinary
1484 terminal). 1631 terminal).
1485 @end defvar 1632 @end defvar
1486 1633
1487 @defvar window-setup-hook 1634 @defvar window-setup-hook
1488 This variable is a normal hook which Emacs runs after loading your 1635 This variable is a normal hook which Emacs runs after handling the
1489 @file{.emacs} file and the default initialization file (if any), after 1636 initialization files. Emacs runs this hook after it has completed
1490 loading terminal-specific Lisp code, and after running the hook 1637 loading your @file{.emacs} file, the default initialization file (if
1638 any), and the terminal-specific Lisp code, and runring the hook
1491 @code{term-setup-hook}. 1639 @code{term-setup-hook}.
1492 1640
1493 This hook is used for internal purposes: setting up communication with 1641 This hook is used for internal purposes: setting up communication with
1494 the window system, and creating the initial window. Users should not 1642 the window system, and creating the initial window. Users should not
1495 interfere with it. 1643 interfere with it.