comparison lispref/text.texi @ 22138:d4ac295a98b3

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Tue, 19 May 1998 03:45:57 +0000
parents 90da2489c498
children 40089afa2b1d
comparison
equal deleted inserted replaced
22137:2b0e6a1e7fb9 22138:d4ac295a98b3
194 properties, just the characters themselves. @xref{Text Properties}. 194 properties, just the characters themselves. @xref{Text Properties}.
195 @end defun 195 @end defun
196 196
197 @defun buffer-string 197 @defun buffer-string
198 This function returns the contents of the entire accessible portion of 198 This function returns the contents of the entire accessible portion of
199 the current buffer as a string. This is the portion between 199 the current buffer as a string. It is equivalent to
200 @code{(point-min)} and @code{(point-max)} (@pxref{Narrowing}). 200
201 @example
202 (buffer-substring (point-min) (point-max))
203 @end example
201 204
202 @example 205 @example
203 @group 206 @group
204 ---------- Buffer: foo ---------- 207 ---------- Buffer: foo ----------
205 This is the contents of buffer foo 208 This is the contents of buffer foo
300 with their properties. The inserted characters have exactly the same 303 with their properties. The inserted characters have exactly the same
301 properties as the characters they were copied from. By contrast, 304 properties as the characters they were copied from. By contrast,
302 characters specified as separate arguments, not part of a string or 305 characters specified as separate arguments, not part of a string or
303 buffer, inherit their text properties from the neighboring text. 306 buffer, inherit their text properties from the neighboring text.
304 307
308 The insertion functions convert text from unibyte to multibyte in
309 order to insert in a multibyte buffer, and vice versa---if the text
310 comes from a string or from a buffer. However, they do not convert
311 unibyte character codes 128 through 255 to multibyte characters, not
312 even if the current buffer is a multibyte buffer. @xref{Converting
313 Representations}.
314
305 @defun insert &rest args 315 @defun insert &rest args
306 This function inserts the strings and/or characters @var{args} into the 316 This function inserts the strings and/or characters @var{args} into the
307 current buffer, at point, moving point forward. In other words, it 317 current buffer, at point, moving point forward. In other words, it
308 inserts the text before point. An error is signaled unless all 318 inserts the text before point. An error is signaled unless all
309 @var{args} are either strings or characters. The value is @code{nil}. 319 @var{args} are either strings or characters. The value is @code{nil}.
325 @defun insert-char character &optional count inherit 335 @defun insert-char character &optional count inherit
326 This function inserts @var{count} instances of @var{character} into the 336 This function inserts @var{count} instances of @var{character} into the
327 current buffer before point. The argument @var{count} should be a 337 current buffer before point. The argument @var{count} should be a
328 number (@code{nil} means 1), and @var{character} must be a character. 338 number (@code{nil} means 1), and @var{character} must be a character.
329 The value is @code{nil}. 339 The value is @code{nil}.
340
341 This function does not convert unibyte character codes 128 through 255
342 to multibyte characters, not even if the current buffer is a multibyte
343 buffer. @xref{Converting Representations}.
330 344
331 If @var{inherit} is non-@code{nil}, then the inserted characters inherit 345 If @var{inherit} is non-@code{nil}, then the inserted characters inherit
332 sticky text properties from the two characters before and after the 346 sticky text properties from the two characters before and after the
333 insertion point. @xref{Sticky Properties}. 347 insertion point. @xref{Sticky Properties}.
334 @end defun 348 @end defun
522 the kill ring. 536 the kill ring.
523 537
524 The value returned is always @code{nil}. 538 The value returned is always @code{nil}.
525 @end deffn 539 @end deffn
526 540
541 @defopt backward-delete-char-untabify-method
527 @tindex backward-delete-char-untabify-method 542 @tindex backward-delete-char-untabify-method
528 @defopt backward-delete-char-untabify-method
529 This option specifies how @code{backward-delete-char-untabify} should 543 This option specifies how @code{backward-delete-char-untabify} should
530 deal with whitespace. Possible values include @code{untabify}, the 544 deal with whitespace. Possible values include @code{untabify}, the
531 default, meaning convert a tab to many spaces and delete one; 545 default, meaning convert a tab to many spaces and delete one;
532 @code{hungry}, meaning delete all the whitespace characters before point 546 @code{hungry}, meaning delete all the whitespace characters before point
533 with one command, and @code{nil}, meaning do nothing special for 547 with one command, and @code{nil}, meaning do nothing special for
577 @deffn Command delete-indentation &optional join-following-p 591 @deffn Command delete-indentation &optional join-following-p
578 This function joins the line point is on to the previous line, deleting 592 This function joins the line point is on to the previous line, deleting
579 any whitespace at the join and in some cases replacing it with one 593 any whitespace at the join and in some cases replacing it with one
580 space. If @var{join-following-p} is non-@code{nil}, 594 space. If @var{join-following-p} is non-@code{nil},
581 @code{delete-indentation} joins this line to the following line 595 @code{delete-indentation} joins this line to the following line
582 instead. The value is @code{nil}. 596 instead. The function returns @code{nil}.
583 597
584 If there is a fill prefix, and the second of the lines being joined 598 If there is a fill prefix, and the second of the lines being joined
585 starts with the prefix, then @code{delete-indentation} deletes the 599 starts with the prefix, then @code{delete-indentation} deletes the
586 fill prefix before joining the lines. @xref{Margins}. 600 fill prefix before joining the lines. @xref{Margins}.
587 601
610 After the lines are joined, the function @code{fixup-whitespace} is 624 After the lines are joined, the function @code{fixup-whitespace} is
611 responsible for deciding whether to leave a space at the junction. 625 responsible for deciding whether to leave a space at the junction.
612 @end deffn 626 @end deffn
613 627
614 @defun fixup-whitespace 628 @defun fixup-whitespace
615 This function replaces all the white space surrounding point with either 629 This function replaces all the whitespace surrounding point with either
616 one space or no space, according to the context. It returns @code{nil}. 630 one space or no space, according to the context. It returns @code{nil}.
617 631
618 At the beginning or end of a line, the appropriate amount of space is 632 At the beginning or end of a line, the appropriate amount of space is
619 none. Before a character with close parenthesis syntax, or after a 633 none. Before a character with close parenthesis syntax, or after a
620 character with open parenthesis or expression-prefix syntax, no space is 634 character with open parenthesis or expression-prefix syntax, no space is
726 When the list reaches @code{kill-ring-max} entries in length, adding a 740 When the list reaches @code{kill-ring-max} entries in length, adding a
727 new entry automatically deletes the last entry. 741 new entry automatically deletes the last entry.
728 742
729 When kill commands are interwoven with other commands, each kill 743 When kill commands are interwoven with other commands, each kill
730 command makes a new entry in the kill ring. Multiple kill commands in 744 command makes a new entry in the kill ring. Multiple kill commands in
731 succession build up a single entry in the kill ring, which would be 745 succession build up a single kill-ring entry, which would be yanked as a
732 yanked as a unit; the second and subsequent consecutive kill commands 746 unit; the second and subsequent consecutive kill commands add text to
733 add text to the entry made by the first one. 747 the entry made by the first one.
734 748
735 For yanking, one entry in the kill ring is designated the ``front'' of 749 For yanking, one entry in the kill ring is designated the ``front'' of
736 the ring. Some yank commands ``rotate'' the ring by designating a 750 the ring. Some yank commands ``rotate'' the ring by designating a
737 different element as the ``front.'' But this virtual rotation doesn't 751 different element as the ``front.'' But this virtual rotation doesn't
738 change the list itself---the most recent entry always comes first in the 752 change the list itself---the most recent entry always comes first in the
823 837
824 The sequence of kills in the kill ring wraps around, so that after the 838 The sequence of kills in the kill ring wraps around, so that after the
825 oldest one comes the newest one, and before the newest one goes the 839 oldest one comes the newest one, and before the newest one goes the
826 oldest. 840 oldest.
827 841
828 The value is always @code{nil}. 842 The return value is always @code{nil}.
829 @end deffn 843 @end deffn
830 844
831 @node Low-Level Kill Ring 845 @node Low-Level Kill Ring
832 @subsection Low-Level Kill Ring 846 @subsection Low-Level Kill Ring
833 847
835 lower level, but still convenient for use in Lisp programs, because they 849 lower level, but still convenient for use in Lisp programs, because they
836 take care of interaction with window system selections 850 take care of interaction with window system selections
837 (@pxref{Window System Selections}). 851 (@pxref{Window System Selections}).
838 852
839 @defun current-kill n &optional do-not-move 853 @defun current-kill n &optional do-not-move
840 The function @code{current-kill} rotates the yanking pointer which 854 The function @code{current-kill} rotates the yanking pointer, which
841 designates the ``front'' of the kill ring by @var{n} places (from newer 855 designates the ``front'' of the kill ring, by @var{n} places (from newer
842 kills to older ones), and returns the text at that place in the ring. 856 kills to older ones), and returns the text at that place in the ring.
843 857
844 If the optional second argument @var{do-not-move} is non-@code{nil}, 858 If the optional second argument @var{do-not-move} is non-@code{nil},
845 then @code{current-kill} doesn't alter the yanking pointer; it just 859 then @code{current-kill} doesn't alter the yanking pointer; it just
846 returns the @var{n}th kill, counting from the current yanking pointer. 860 returns the @var{n}th kill, counting from the current yanking pointer.
1047 character; the next 19 consecutive self-inserting input characters do 1061 character; the next 19 consecutive self-inserting input characters do
1048 not make boundaries, and then the 20th does, and so on as long as 1062 not make boundaries, and then the 20th does, and so on as long as
1049 self-inserting characters continue. 1063 self-inserting characters continue.
1050 1064
1051 All buffer modifications add a boundary whenever the previous undoable 1065 All buffer modifications add a boundary whenever the previous undoable
1052 change was made in some other buffer. This way, a command that modifies 1066 change was made in some other buffer. This is to ensure that
1053 several buffers makes a boundary in each buffer it changes. 1067 each command makes a boundary in each buffer where it makes changes.
1054 1068
1055 Calling this function explicitly is useful for splitting the effects of 1069 Calling this function explicitly is useful for splitting the effects of
1056 a command into more than one unit. For example, @code{query-replace} 1070 a command into more than one unit. For example, @code{query-replace}
1057 calls @code{undo-boundary} after each replacement, so that the user can 1071 calls @code{undo-boundary} after each replacement, so that the user can
1058 undo individual replacements one by one. 1072 undo individual replacements one by one.
1094 1108
1095 In an interactive call, @var{buffer-or-name} is the current buffer. 1109 In an interactive call, @var{buffer-or-name} is the current buffer.
1096 You cannot specify any other buffer. 1110 You cannot specify any other buffer.
1097 @end deffn 1111 @end deffn
1098 1112
1099 @defun buffer-disable-undo &optional buffer 1113 @deffn Command buffer-disable-undo &optional buffer
1100 @defunx buffer-flush-undo &optional buffer 1114 @deffnx Command buffer-flush-undo &optional buffer
1101 @cindex disable undo 1115 @cindex disable undo
1102 This function discards the undo list of @var{buffer}, and disables 1116 This function discards the undo list of @var{buffer}, and disables
1103 further recording of undo information. As a result, it is no longer 1117 further recording of undo information. As a result, it is no longer
1104 possible to undo either previous changes or any subsequent changes. If 1118 possible to undo either previous changes or any subsequent changes. If
1105 the undo list of @var{buffer} is already disabled, this function 1119 the undo list of @var{buffer} is already disabled, this function
1106 has no effect. 1120 has no effect.
1107 1121
1108 This function returns @code{nil}. It cannot be called interactively. 1122 This function returns @code{nil}.
1109 1123
1110 The name @code{buffer-flush-undo} is not considered obsolete, but the 1124 The name @code{buffer-flush-undo} is not considered obsolete, but the
1111 preferred name is @code{buffer-disable-undo}. 1125 preferred name is @code{buffer-disable-undo}.
1112 @end defun 1126 @end deffn
1113 1127
1114 As editing continues, undo lists get longer and longer. To prevent 1128 As editing continues, undo lists get longer and longer. To prevent
1115 them from using up all available memory space, garbage collection trims 1129 them from using up all available memory space, garbage collection trims
1116 them back to size limits you can set. (For this purpose, the ``size'' 1130 them back to size limits you can set. (For this purpose, the ``size''
1117 of an undo list measures the cons cells that make up the list, plus the 1131 of an undo list measures the cons cells that make up the list, plus the
1212 between paragraphs are removed. This function justifies as well as 1226 between paragraphs are removed. This function justifies as well as
1213 filling when @var{justify} is non-@code{nil}. 1227 filling when @var{justify} is non-@code{nil}.
1214 1228
1215 In an interactive call, any prefix argument requests justification. 1229 In an interactive call, any prefix argument requests justification.
1216 1230
1231 @cindex Adaptive Fill mode
1217 In Adaptive Fill mode, which is enabled by default, calling the function 1232 In Adaptive Fill mode, which is enabled by default, calling the function
1218 @code{fill-region-as-paragraph} on an indented paragraph when there is 1233 @code{fill-region-as-paragraph} on an indented paragraph when there is
1219 no fill prefix uses the indentation of the second line of the paragraph 1234 no fill prefix uses the indentation of the second line of the paragraph
1220 as the fill prefix. 1235 as the fill prefix.
1221 @end deffn 1236 @end deffn
1277 1292
1278 @node Margins 1293 @node Margins
1279 @section Margins for Filling 1294 @section Margins for Filling
1280 1295
1281 @defopt fill-prefix 1296 @defopt fill-prefix
1282 This variable specifies a string of text that appears at the beginning 1297 This buffer-local variable specifies a string of text that appears at
1298 the beginning
1283 of normal text lines and should be disregarded when filling them. Any 1299 of normal text lines and should be disregarded when filling them. Any
1284 line that fails to start with the fill prefix is considered the start of 1300 line that fails to start with the fill prefix is considered the start of
1285 a paragraph; so is any line that starts with the fill prefix followed by 1301 a paragraph; so is any line that starts with the fill prefix followed by
1286 additional whitespace. Lines that start with the fill prefix but no 1302 additional whitespace. Lines that start with the fill prefix but no
1287 additional whitespace are ordinary text lines that can be filled 1303 additional whitespace are ordinary text lines that can be filled
1288 together. The resulting filled lines also start with the fill prefix. 1304 together. The resulting filled lines also start with the fill prefix.
1289 1305
1290 The fill prefix follows the left margin whitespace, if any. 1306 The fill prefix follows the left margin whitespace, if any.
1291 @end defopt 1307 @end defopt
1292 1308
1293 @defopt fill-column 1309 @defvar fill-column
1294 This buffer-local variable specifies the maximum width of filled lines. 1310 This buffer-local variable specifies the maximum width of filled lines.
1295 Its value should be an integer, which is a number of columns. All the 1311 Its value should be an integer, which is a number of columns. All the
1296 filling, justification, and centering commands are affected by this 1312 filling, justification, and centering commands are affected by this
1297 variable, including Auto Fill mode (@pxref{Auto Filling}). 1313 variable, including Auto Fill mode (@pxref{Auto Filling}).
1298 1314
1299 As a practical matter, if you are writing text for other people to 1315 As a practical matter, if you are writing text for other people to
1300 read, you should set @code{fill-column} to no more than 70. Otherwise 1316 read, you should set @code{fill-column} to no more than 70. Otherwise
1301 the line will be too long for people to read comfortably, and this can 1317 the line will be too long for people to read comfortably, and this can
1302 make the text seem clumsy. 1318 make the text seem clumsy.
1303 @end defopt 1319 @end defvar
1304 1320
1305 @defvar default-fill-column 1321 @defvar default-fill-column
1306 The value of this variable is the default value for @code{fill-column} in 1322 The value of this variable is the default value for @code{fill-column} in
1307 buffers that do not override it. This is the same as 1323 buffers that do not override it. This is the same as
1308 @code{(default-value 'fill-column)}. 1324 @code{(default-value 'fill-column)}.
1365 This variable specifies the base left margin column. In Fundamental 1381 This variable specifies the base left margin column. In Fundamental
1366 mode, @kbd{C-j} indents to this column. This variable automatically 1382 mode, @kbd{C-j} indents to this column. This variable automatically
1367 becomes buffer-local when set in any fashion. 1383 becomes buffer-local when set in any fashion.
1368 @end defvar 1384 @end defvar
1369 1385
1386 @defvar fill-nobreak-predicate
1370 @tindex fill-nobreak-predicate 1387 @tindex fill-nobreak-predicate
1371 @defvar fill-nobreak-predicate
1372 This variable gives major modes a way to specify not to break a line at 1388 This variable gives major modes a way to specify not to break a line at
1373 certain places. Its value should be a function. This function is 1389 certain places. Its value should be a function. This function is
1374 called during filling, with no arguments and with point located at the 1390 called during filling, with no arguments and with point located at the
1375 place where a break is being considered. If the function returns 1391 place where a break is being considered. If the function returns
1376 non-@code{nil}, then the line won't be broken there. 1392 non-@code{nil}, then the line won't be broken there.
1785 indent the current line in a way appropriate for the current major mode. 1801 indent the current line in a way appropriate for the current major mode.
1786 @end deffn 1802 @end deffn
1787 1803
1788 @deffn Command indent-for-tab-command 1804 @deffn Command indent-for-tab-command
1789 This command calls the function in @code{indent-line-function} to indent 1805 This command calls the function in @code{indent-line-function} to indent
1790 the current line; except that if that function is 1806 the current line; however, if that function is
1791 @code{indent-to-left-margin}, it calls @code{insert-tab} instead. (That 1807 @code{indent-to-left-margin}, @code{insert-tab} is called instead. (That
1792 is a trivial command that inserts a tab character.) 1808 is a trivial command that inserts a tab character.)
1793 @end deffn 1809 @end deffn
1794 1810
1795 @deffn Command newline-and-indent 1811 @deffn Command newline-and-indent
1796 @comment !!SourceFile simple.el 1812 @comment !!SourceFile simple.el
1840 by making it start with the fill prefix. 1856 by making it start with the fill prefix.
1841 @end deffn 1857 @end deffn
1842 1858
1843 @defvar indent-region-function 1859 @defvar indent-region-function
1844 The value of this variable is a function that can be used by 1860 The value of this variable is a function that can be used by
1845 @code{indent-region} as a short cut. You should design the function so 1861 @code{indent-region} as a short cut. It should take two arguments, the
1862 start and end of the region. You should design the function so
1846 that it will produce the same results as indenting the lines of the 1863 that it will produce the same results as indenting the lines of the
1847 region one by one, but presumably faster. 1864 region one by one, but presumably faster.
1848 1865
1849 If the value is @code{nil}, there is no short cut, and 1866 If the value is @code{nil}, there is no short cut, and
1850 @code{indent-region} actually works line by line. 1867 @code{indent-region} actually works line by line.
2387 @var{pos} instead of forward. If the value is non-@code{nil}, it is a 2404 @var{pos} instead of forward. If the value is non-@code{nil}, it is a
2388 position less than or equal to @var{pos}; it equals @var{pos} only if 2405 position less than or equal to @var{pos}; it equals @var{pos} only if
2389 @var{limit} equals @var{pos}. 2406 @var{limit} equals @var{pos}.
2390 @end defun 2407 @end defun
2391 2408
2409 @defun next-char-property-change position &optional limit
2392 @tindex next-char-property-change 2410 @tindex next-char-property-change
2393 @defun next-char-property-change position &optional limit
2394 This is like @code{next-property-change} except that it considers 2411 This is like @code{next-property-change} except that it considers
2395 overlay properties as well as text properties. There is no @var{object} 2412 overlay properties as well as text properties. There is no @var{object}
2396 operand because this function operates only on the current buffer. It 2413 operand because this function operates only on the current buffer. It
2397 returns the next address at which either kind of property changes. 2414 returns the next address at which either kind of property changes.
2398 @end defun 2415 @end defun
2399 2416
2417 @defun previous-char-property-change position &optional limit
2400 @tindex previous-char-property-change 2418 @tindex previous-char-property-change
2401 @defun previous-char-property-change position &optional limit
2402 This is like @code{next-char-property-change}, but scans back from 2419 This is like @code{next-char-property-change}, but scans back from
2403 @var{position} instead of forward. 2420 @var{position} instead of forward.
2404 @end defun 2421 @end defun
2405 2422
2406 @defun text-property-any start end prop value &optional object 2423 @defun text-property-any start end prop value &optional object
3158 modification. Each function receives three arguments: the beginning and 3175 modification. Each function receives three arguments: the beginning and
3159 end of the region just changed, and the length of the text that existed 3176 end of the region just changed, and the length of the text that existed
3160 before the change. All three arguments are integers. The buffer that's 3177 before the change. All three arguments are integers. The buffer that's
3161 about to change is always the current buffer. 3178 about to change is always the current buffer.
3162 3179
3163 The length of the old text is measured in bytes; it is the difference 3180 The length of the old text the difference between the buffer positions
3164 between the buffer positions before and after that text, before the 3181 before and after that text as it was before the change. As for the
3165 change. As for the changed text, its length in bytes is simply the 3182 changed text, its length is simply the difference between the first two
3166 difference between the first two arguments. If you want the length 3183 arguments.
3167 in @emph{characters} of the text before the change, you should use
3168 a @code{before-change-functions} function that calls @code{chars-in-region}
3169 (@pxref{Chars and Bytes}).
3170 @end defvar 3184 @end defvar
3171 3185
3186 @defmac combine-after-change-calls body...
3172 @tindex combine-after-change-calls 3187 @tindex combine-after-change-calls
3173 @defmac combine-after-change-calls body...
3174 The macro executes @var{body} normally, but arranges to call the 3188 The macro executes @var{body} normally, but arranges to call the
3175 after-change functions just once for a series of several changes---if 3189 after-change functions just once for a series of several changes---if
3176 that seems safe. 3190 that seems safe.
3177 3191
3178 If a program makes several text changes in the same area of the buffer, 3192 If a program makes several text changes in the same area of the buffer,