comparison man/lispref/text.texi @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents 9d177e8d4150
children 1ccc32a20af4
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
1 @c -*-texinfo-*- 1 @c -*-texinfo-*-
2 @c This is part of the XEmacs Lisp Reference Manual. 2 @c This is part of the XEmacs 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 Free Software Foundation, Inc.
4 @c See the file lispref.texi for copying conditions. 4 @c See the file lispref.texi for copying conditions.
5 @setfilename ../../info/text.info 5 @setfilename ../../info/text.info
6 @node Text, Searching and Matching, Markers, Top 6 @node Text, Searching and Matching, Markers, Top
7 @chapter Text 7 @chapter Text
8 @cindex text 8 @cindex text
327 function is chiefly useful if you want to insert a string in 327 function is chiefly useful if you want to insert a string in
328 a buffer other than the current one (otherwise you could just 328 a buffer other than the current one (otherwise you could just
329 use @code{insert}). 329 use @code{insert}).
330 @end defun 330 @end defun
331 331
332 @defun insert-char character count &optional buffer 332 @defun insert-char character &optional count ignored buffer
333 This function inserts @var{count} instances of @var{character} into 333 This function inserts @var{count} instances of @var{character} into
334 @var{buffer} before point. @var{count} must be a number, and 334 @var{buffer} before point. @var{count} must be a number, and
335 @var{character} must be a character. The value is @code{nil}. If 335 @var{character} must be a character.
336 optional argument @var{buffer} is @code{nil}, the current buffer is 336
337 assumed. (In FSF Emacs, the third argument is called @var{inherit} 337 If optional argument @var{buffer} is @code{nil}, the current buffer is
338 and refers to text properties.) 338 assumed. (In FSF Emacs, the third argument is called @var{inherit} and
339 refers to text properties. In XEmacs, it is always ignored.)
340
341 This function always returns @code{nil}.
339 @end defun 342 @end defun
340 343
341 @defun insert-buffer-substring from-buffer-or-name &optional start end 344 @defun insert-buffer-substring from-buffer-or-name &optional start end
342 This function inserts a portion of buffer @var{from-buffer-or-name} 345 This function inserts a portion of buffer @var{from-buffer-or-name}
343 (which must already exist) into the current buffer before point. The 346 (which must already exist) into the current buffer before point. The
401 404
402 This is also responsible for calling @code{blink-paren-function} when 405 This is also responsible for calling @code{blink-paren-function} when
403 the inserted character has close parenthesis syntax (@pxref{Blinking}). 406 the inserted character has close parenthesis syntax (@pxref{Blinking}).
404 @end deffn 407 @end deffn
405 408
406 @deffn Command newline &optional number-of-newlines 409 @deffn Command newline &optional count
407 This command inserts newlines into the current buffer before point. 410 This command inserts newlines into the current buffer before point.
408 If @var{number-of-newlines} is supplied, that many newline characters 411 If @var{count} is supplied, that many newline characters
409 are inserted. 412 are inserted.
410 413
411 @cindex newline and Auto Fill mode 414 @cindex newline and Auto Fill mode
412 This function calls @code{auto-fill-function} if the current column 415 This function calls @code{auto-fill-function} if the current column
413 number is greater than the value of @code{fill-column} and 416 number is greater than the value of @code{fill-column} and
414 @var{number-of-newlines} is @code{nil}. Typically what 417 @var{count} is @code{nil}. Typically what
415 @code{auto-fill-function} does is insert a newline; thus, the overall 418 @code{auto-fill-function} does is insert a newline; thus, the overall
416 result in this case is to insert two newlines at different places: one 419 result in this case is to insert two newlines at different places: one
417 at point, and another earlier in the line. @code{newline} does not 420 at point, and another earlier in the line. @code{newline} does not
418 auto-fill if @var{number-of-newlines} is non-@code{nil}. 421 auto-fill if @var{count} is non-@code{nil}.
419 422
420 This command indents to the left margin if that is not zero. 423 This command indents to the left margin if that is not zero.
421 @xref{Margins}. 424 @xref{Margins}.
422 425
423 The value returned is @code{nil}. In an interactive call, @var{count} 426 The value returned is @code{nil}. In an interactive call, @var{count}
451 cases. 454 cases.
452 455
453 All of the deletion functions operate on the current buffer, and all 456 All of the deletion functions operate on the current buffer, and all
454 return a value of @code{nil}. 457 return a value of @code{nil}.
455 458
456 @defun erase-buffer &optional buffer 459 @deffn Command erase-buffer &optional buffer
457 This function deletes the entire text of @var{buffer}, leaving it 460 This function deletes the entire text of @var{buffer}, leaving it
458 empty. If the buffer is read-only, it signals a @code{buffer-read-only} 461 empty. If the buffer is read-only, it signals a @code{buffer-read-only}
459 error. Otherwise, it deletes the text without asking for any 462 error. Otherwise, it deletes the text without asking for any
460 confirmation. It returns @code{nil}. @var{buffer} defaults to the 463 confirmation. It returns @code{nil}. @var{buffer} defaults to the
461 current buffer if omitted. 464 current buffer if omitted.
463 Normally, deleting a large amount of text from a buffer inhibits further 466 Normally, deleting a large amount of text from a buffer inhibits further
464 auto-saving of that buffer ``because it has shrunk''. However, 467 auto-saving of that buffer ``because it has shrunk''. However,
465 @code{erase-buffer} does not do this, the idea being that the future 468 @code{erase-buffer} does not do this, the idea being that the future
466 text is not really related to the former text, and its size should not 469 text is not really related to the former text, and its size should not
467 be compared with that of the former text. 470 be compared with that of the former text.
468 @end defun 471 @end deffn
469 472
470 @deffn Command delete-region start end &optional buffer 473 @deffn Command delete-region start end &optional buffer
471 This command deletes the text in @var{buffer} in the region defined by 474 This command deletes the text in @var{buffer} in the region defined by
472 @var{start} and @var{end}. The value is @code{nil}. If optional 475 @var{start} and @var{end}. The value is @code{nil}. If optional
473 argument @var{buffer} is @code{nil}, the current buffer is assumed. 476 argument @var{buffer} is @code{nil}, the current buffer is assumed.
562 ---------- Buffer: foo ---------- 565 ---------- Buffer: foo ----------
563 @end group 566 @end group
564 @end example 567 @end example
565 @end deffn 568 @end deffn
566 569
567 @deffn Command delete-indentation &optional join-following-p 570 @deffn Command delete-indentation &optional join-following-p
568 This function joins the line point is on to the previous line, deleting 571 This function joins the line point is on to the previous line, deleting
569 any whitespace at the join and in some cases replacing it with one 572 any whitespace at the join and in some cases replacing it with one
570 space. If @var{join-following-p} is non-@code{nil}, 573 space. If @var{join-following-p} is non-@code{nil},
571 @code{delete-indentation} joins this line to the following line 574 @code{delete-indentation} joins this line to the following line
572 instead. The value is @code{nil}. 575 instead. The value is @code{nil}.
599 602
600 After the lines are joined, the function @code{fixup-whitespace} is 603 After the lines are joined, the function @code{fixup-whitespace} is
601 responsible for deciding whether to leave a space at the junction. 604 responsible for deciding whether to leave a space at the junction.
602 @end deffn 605 @end deffn
603 606
604 @defun fixup-whitespace 607 @deffn Command fixup-whitespace
605 This function replaces all the white space surrounding point with either 608 This function replaces all the white space surrounding point with either
606 one space or no space, according to the context. It returns @code{nil}. 609 one space or no space, according to the context. It returns @code{nil}.
607 610
608 At the beginning or end of a line, the appropriate amount of space is 611 At the beginning or end of a line, the appropriate amount of space is
609 none. Before a character with close parenthesis syntax, or after a 612 none. Before a character with close parenthesis syntax, or after a
635 This has too many spaces 638 This has too many spaces
636 This has too many spaces at the start of (this list) 639 This has too many spaces at the start of (this list)
637 ---------- Buffer: foo ---------- 640 ---------- Buffer: foo ----------
638 @end group 641 @end group
639 @end smallexample 642 @end smallexample
640 @end defun 643 @end deffn
641 644
642 @deffn Command just-one-space 645 @deffn Command just-one-space
643 @comment !!SourceFile simple.el 646 @comment !!SourceFile simple.el
644 This command replaces any spaces and tabs around point with a single 647 This command replaces any spaces and tabs around point with a single
645 space. It returns @code{nil}. 648 space. It returns @code{nil}.
736 newly killed text in a new element at the beginning of the kill ring or 739 newly killed text in a new element at the beginning of the kill ring or
737 adds it to the most recent element. It uses the @code{last-command} 740 adds it to the most recent element. It uses the @code{last-command}
738 variable to determine whether the previous command was a kill command, 741 variable to determine whether the previous command was a kill command,
739 and if so appends the killed text to the most recent entry. 742 and if so appends the killed text to the most recent entry.
740 743
741 @deffn Command kill-region start end 744 @deffn Command kill-region start end &optional verbose
742 This function kills the text in the region defined by @var{start} and 745 This function kills the text in the region defined by @var{start} and
743 @var{end}. The text is deleted but saved in the kill ring, along with 746 @var{end}. The text is deleted but saved in the kill ring, along with
744 its text properties. The value is always @code{nil}. 747 its text properties. The value is always @code{nil}.
745 748
746 In an interactive call, @var{start} and @var{end} are point and 749 In an interactive call, @var{start} and @var{end} are point and
820 These functions and variables provide access to the kill ring at a lower 823 These functions and variables provide access to the kill ring at a lower
821 level, but still convenient for use in Lisp programs. They take care of 824 level, but still convenient for use in Lisp programs. They take care of
822 interaction with X Window selections. They do not exist in Emacs 825 interaction with X Window selections. They do not exist in Emacs
823 version 18. 826 version 18.
824 827
825 @defun current-kill n &optional do-not-move 828 @defun current-kill count &optional do-not-move
826 The function @code{current-kill} rotates the yanking pointer which 829 The function @code{current-kill} rotates the yanking pointer which
827 designates the ``front'' of the kill ring by @var{n} places (from newer 830 designates the ``front'' of the kill ring by @var{count} places (from newer
828 kills to older ones), and returns the text at that place in the ring. 831 kills to older ones), and returns the text at that place in the ring.
829 832
830 If the optional second argument @var{do-not-move} is non-@code{nil}, 833 If the optional second argument @var{do-not-move} is non-@code{nil},
831 then @code{current-kill} doesn't alter the yanking pointer; it just 834 then @code{current-kill} doesn't alter the yanking pointer; it just
832 returns the @var{n}th kill, counting from the current yanking pointer. 835 returns the @var{count}th kill, counting from the current yanking pointer.
833 836
834 If @var{n} is zero, indicating a request for the latest kill, 837 If @var{count} is zero, indicating a request for the latest kill,
835 @code{current-kill} calls the value of 838 @code{current-kill} calls the value of
836 @code{interprogram-paste-function} (documented below) before consulting 839 @code{interprogram-paste-function} (documented below) before consulting
837 the kill ring. 840 the kill ring.
838 @end defun 841 @end defun
839 842
840 @defun kill-new string 843 @defun kill-new string &optional replace
841 This function puts the text @var{string} into the kill ring as a new 844 This function makes the text @var{string} the latest entry in the kill
842 entry at the front of the ring. It discards the oldest entry if 845 ring, and sets @code{kill-ring-yank-pointer} to point to it.
843 appropriate. It also invokes the value of 846
844 @code{interprogram-cut-function} (see below). 847 Normally, @var{string} is added to the front of the kill ring as a new
848 entry. However, if optional argument @var{replace} is non-@code{nil},
849 the entry previously at the front of the kill ring is discarded, and
850 @var{string} replaces it.
851
852 This function runs the functions on @code{kill-hooks}, and also invokes
853 the value of @code{interprogram-cut-function} (see below).
845 @end defun 854 @end defun
846 855
847 @defun kill-append string before-p 856 @defun kill-append string before-p
848 This function appends the text @var{string} to the first entry in the 857 This function appends the text @var{string} to the first entry in the
849 kill ring. Normally @var{string} goes at the end of the entry, but if 858 kill ring. Normally @var{string} goes at the end of the entry, but if
882 @node Internals of Kill Ring 891 @node Internals of Kill Ring
883 @subsection Internals of the Kill Ring 892 @subsection Internals of the Kill Ring
884 893
885 The variable @code{kill-ring} holds the kill ring contents, in the 894 The variable @code{kill-ring} holds the kill ring contents, in the
886 form of a list of strings. The most recent kill is always at the front 895 form of a list of strings. The most recent kill is always at the front
887 of the list. 896 of the list.
888 897
889 The @code{kill-ring-yank-pointer} variable points to a link in the 898 The @code{kill-ring-yank-pointer} variable points to a link in the
890 kill ring list, whose @sc{car} is the text to yank next. We say it 899 kill ring list, whose @sc{car} is the text to yank next. We say it
891 identifies the ``front'' of the ring. Moving 900 identifies the ``front'' of the ring. Moving
892 @code{kill-ring-yank-pointer} to a different link is called 901 @code{kill-ring-yank-pointer} to a different link is called
907 set this variable to the value of @code{kill-ring}. The effect is to 916 set this variable to the value of @code{kill-ring}. The effect is to
908 rotate the ring so that the newly killed text is at the front. 917 rotate the ring so that the newly killed text is at the front.
909 918
910 Here is a diagram that shows the variable @code{kill-ring-yank-pointer} 919 Here is a diagram that shows the variable @code{kill-ring-yank-pointer}
911 pointing to the second entry in the kill ring @code{("some text" "a 920 pointing to the second entry in the kill ring @code{("some text" "a
912 different piece of text" "yet older text")}. 921 different piece of text" "yet older text")}.
913 922
914 @example 923 @example
915 @group 924 @group
916 kill-ring kill-ring-yank-pointer 925 kill-ring kill-ring-yank-pointer
917 | | 926 | |
918 | ___ ___ ---> ___ ___ ___ ___ 927 | ___ ___ ---> ___ ___ ___ ___
919 --> |___|___|------> |___|___|--> |___|___|--> nil 928 --> |___|___|------> |___|___|--> |___|___|--> nil
920 | | | 929 | | |
921 | | | 930 | | |
922 | | -->"yet older text" 931 | | -->"yet older text"
923 | | 932 | |
924 | --> "a different piece of text" 933 | --> "a different piece of text"
925 | 934 |
926 --> "some text" 935 --> "some text"
927 @end group 936 @end group
928 @end example 937 @end example
929 938
971 @item @var{integer} 980 @item @var{integer}
972 This kind of element records a previous value of point. Ordinary cursor 981 This kind of element records a previous value of point. Ordinary cursor
973 motion does not get any sort of undo record, but deletion commands use 982 motion does not get any sort of undo record, but deletion commands use
974 these entries to record where point was before the command. 983 these entries to record where point was before the command.
975 984
976 @item (@var{beg} . @var{end}) 985 @item (@var{start} . @var{end})
977 This kind of element indicates how to delete text that was inserted. 986 This kind of element indicates how to delete text that was inserted.
978 Upon insertion, the text occupied the range @var{beg}--@var{end} in the 987 Upon insertion, the text occupied the range @var{start}--@var{end} in the
979 buffer. 988 buffer.
980 989
981 @item (@var{text} . @var{position}) 990 @item (@var{text} . @var{position})
982 This kind of element indicates how to reinsert text that was deleted. 991 This kind of element indicates how to reinsert text that was deleted.
983 The deleted text itself is the string @var{text}. The place to 992 The deleted text itself is the string @var{text}. The place to
989 recording 16 bits of the visited file's modification time as of when it 998 recording 16 bits of the visited file's modification time as of when it
990 was previously visited or saved. @code{primitive-undo} uses those 999 was previously visited or saved. @code{primitive-undo} uses those
991 values to determine whether to mark the buffer as unmodified once again; 1000 values to determine whether to mark the buffer as unmodified once again;
992 it does so only if the file's modification time matches those numbers. 1001 it does so only if the file's modification time matches those numbers.
993 1002
994 @item (nil @var{property} @var{value} @var{beg} . @var{end}) 1003 @item (nil @var{property} @var{value} @var{start} . @var{end})
995 This kind of element records a change in a text property. 1004 This kind of element records a change in a text property.
996 Here's how you might undo the change: 1005 Here's how you might undo the change:
997 1006
998 @example 1007 @example
999 (put-text-property @var{beg} @var{end} @var{property} @var{value}) 1008 (put-text-property @var{start} @var{end} @var{property} @var{value})
1000 @end example 1009 @end example
1001 1010
1002 @item @var{position} 1011 @item @var{position}
1003 This element indicates where point was at an earlier time. Undoing this 1012 This element indicates where point was at an earlier time. Undoing this
1004 element sets point to @var{position}. Deletion normally creates an 1013 element sets point to @var{position}. Deletion normally creates an
1070 1079
1071 In an interactive call, @var{buffer-or-name} is the current buffer. 1080 In an interactive call, @var{buffer-or-name} is the current buffer.
1072 You cannot specify any other buffer. 1081 You cannot specify any other buffer.
1073 @end deffn 1082 @end deffn
1074 1083
1075 @defun buffer-disable-undo &optional buffer 1084 @deffn Command buffer-disable-undo &optional buffer
1076 @defunx buffer-flush-undo &optional buffer 1085 @deffnx Command buffer-flush-undo &optional buffer
1077 @cindex disable undo 1086 @cindex disable undo
1078 This function discards the undo list of @var{buffer}, and disables 1087 This function discards the undo list of @var{buffer}, and disables
1079 further recording of undo information. As a result, it is no longer 1088 further recording of undo information. As a result, it is no longer
1080 possible to undo either previous changes or any subsequent changes. If 1089 possible to undo either previous changes or any subsequent changes. If
1081 the undo list of @var{buffer} is already disabled, this function 1090 the undo list of @var{buffer} is already disabled, this function
1084 This function returns @code{nil}. It cannot be called interactively. 1093 This function returns @code{nil}. It cannot be called interactively.
1085 1094
1086 The name @code{buffer-flush-undo} is not considered obsolete, but the 1095 The name @code{buffer-flush-undo} is not considered obsolete, but the
1087 preferred name @code{buffer-disable-undo} is new as of Emacs versions 1096 preferred name @code{buffer-disable-undo} is new as of Emacs versions
1088 19. 1097 19.
1089 @end defun 1098 @end deffn
1090 1099
1091 As editing continues, undo lists get longer and longer. To prevent 1100 As editing continues, undo lists get longer and longer. To prevent
1092 them from using up all available memory space, garbage collection trims 1101 them from using up all available memory space, garbage collection trims
1093 them back to size limits you can set. (For this purpose, the ``size'' 1102 them back to size limits you can set. (For this purpose, the ``size''
1094 of an undo list measures the cons cells that make up the list, plus the 1103 of an undo list measures the cons cells that make up the list, plus the
1319 1328
1320 If @var{force} is non-@code{nil}, that says to fix the line's 1329 If @var{force} is non-@code{nil}, that says to fix the line's
1321 indentation if that doesn't match the left margin value. 1330 indentation if that doesn't match the left margin value.
1322 @end deffn 1331 @end deffn
1323 1332
1324 @defun delete-to-left-margin from to 1333 @defun delete-to-left-margin &optional from to
1325 This function removes left margin indentation from the text 1334 This function removes left margin indentation from the text
1326 between @var{from} and @var{to}. The amount of indentation 1335 between @var{from} and @var{to}. The amount of indentation
1327 to delete is determined by calling @code{current-left-margin}. 1336 to delete is determined by calling @code{current-left-margin}.
1328 In no case does this function delete non-whitespace. 1337 In no case does this function delete non-whitespace.
1338
1339 The arguments @var{from} and @var{to} are optional; the default is the
1340 whole buffer.
1329 @end defun 1341 @end defun
1330 1342
1331 @defun indent-to-left-margin 1343 @defun indent-to-left-margin
1332 This is the default @code{indent-line-function}, used in Fundamental 1344 This is the default @code{indent-line-function}, used in Fundamental
1333 mode, Text mode, etc. Its effect is to adjust the indentation at the 1345 mode, Text mode, etc. Its effect is to adjust the indentation at the
1439 1451
1440 @example 1452 @example
1441 @group 1453 @group
1442 ;; @r{Note that the first two lines of doc string} 1454 ;; @r{Note that the first two lines of doc string}
1443 ;; @r{are effectively one line when viewed by a user.} 1455 ;; @r{are effectively one line when viewed by a user.}
1444 (defun sort-lines (reverse beg end) 1456 (defun sort-lines (reverse start end)
1445 "Sort lines in region alphabetically. 1457 "Sort lines in region alphabetically.
1446 Called from a program, there are three arguments: 1458 Called from a program, there are three arguments:
1447 @end group 1459 @end group
1448 @group 1460 @group
1449 REVERSE (non-nil means reverse order), 1461 REVERSE (non-nil means reverse order),
1450 and BEG and END (the region to sort)." 1462 and START and END (the region to sort)."
1451 (interactive "P\nr") 1463 (interactive "P\nr")
1452 (save-restriction 1464 (save-restriction
1453 (narrow-to-region beg end) 1465 (narrow-to-region start end)
1454 (goto-char (point-min)) 1466 (goto-char (point-min))
1455 (sort-subr reverse 1467 (sort-subr reverse
1456 'forward-line 1468 'forward-line
1457 'end-of-line))) 1469 'end-of-line)))
1458 @end group 1470 @end group
1467 its @code{sort-subr} call looks like this: 1479 its @code{sort-subr} call looks like this:
1468 1480
1469 @example 1481 @example
1470 @group 1482 @group
1471 (sort-subr reverse 1483 (sort-subr reverse
1472 (function 1484 (function
1473 (lambda () 1485 (lambda ()
1474 (skip-chars-forward "\n \t\f"))) 1486 (skip-chars-forward "\n \t\f")))
1475 'forward-paragraph) 1487 'forward-paragraph)
1476 @end group 1488 @end group
1477 @end example 1489 @end example
1478 @end defun 1490 @end defun
1580 1. If @var{field} is negative, sorting is by the 1592 1. If @var{field} is negative, sorting is by the
1581 @w{@minus{}@var{field}th} field from the end of the line. This command 1593 @w{@minus{}@var{field}th} field from the end of the line. This command
1582 is useful for sorting tables. 1594 is useful for sorting tables.
1583 @end deffn 1595 @end deffn
1584 1596
1585 @deffn Command sort-columns reverse &optional beg end 1597 @deffn Command sort-columns reverse &optional start end
1586 This command sorts the lines in the region between @var{beg} and 1598 This command sorts the lines in the region between @var{start} and
1587 @var{end}, comparing them alphabetically by a certain range of columns. 1599 @var{end}, comparing them alphabetically by a certain range of columns.
1588 The column positions of @var{beg} and @var{end} bound the range of 1600 The column positions of @var{start} and @var{end} bound the range of
1589 columns to sort on. 1601 columns to sort on.
1590 1602
1591 If @var{reverse} is non-@code{nil}, the sort is in reverse order. 1603 If @var{reverse} is non-@code{nil}, the sort is in reverse order.
1592 1604
1593 One unusual thing about this command is that the entire line 1605 One unusual thing about this command is that the entire line
1594 containing position @var{beg}, and the entire line containing position 1606 containing position @var{start}, and the entire line containing position
1595 @var{end}, are included in the region sorted. 1607 @var{end}, are included in the region sorted.
1596 1608
1597 Note that @code{sort-columns} uses the @code{sort} utility program, 1609 Note that @code{sort-columns} uses the @code{sort} utility program,
1598 and so cannot work properly on text containing tab characters. Use 1610 and so cannot work properly on text containing tab characters. Use
1599 @kbd{M-x @code{untabify}} to convert tabs to spaces before sorting. 1611 @kbd{M-x @code{untabify}} to convert tabs to spaces before sorting.
1618 1630
1619 Column number computations ignore the width of the window and the 1631 Column number computations ignore the width of the window and the
1620 amount of horizontal scrolling. Consequently, a column value can be 1632 amount of horizontal scrolling. Consequently, a column value can be
1621 arbitrarily high. The first (or leftmost) column is numbered 0. 1633 arbitrarily high. The first (or leftmost) column is numbered 0.
1622 1634
1623 @defun current-column 1635 @defun current-column &optional buffer
1624 This function returns the horizontal position of point, measured in 1636 This function returns the horizontal position of point, measured in
1625 columns, counting from 0 at the left margin. The column position is the 1637 columns, counting from 0 at the left margin.
1626 sum of the widths of all the displayed representations of the characters 1638
1627 between the start of the current line and point. 1639 This is calculated by adding together the widths of all the displayed
1640 representations of the character between the start of the previous line
1641 and point. (e.g. control characters will have a width of 2 or 4, tabs
1642 will have a variable width.)
1643
1644 Ignores the finite width of frame displaying the buffer, which means
1645 that this function may return values greater than
1646 @code{(frame-width)}.
1647
1648 Whether the line is visible (if @code{selective-display} is t) has no effect;
1649 however, ^M is treated as end of line when @code{selective-display} is t.
1650
1651 If @var{buffer} is nil, the current buffer is assumed.
1628 1652
1629 For an example of using @code{current-column}, see the description of 1653 For an example of using @code{current-column}, see the description of
1630 @code{count-lines} in @ref{Text Lines}. 1654 @code{count-lines} in @ref{Text Lines}.
1631 @end defun 1655 @end defun
1632 1656
1633 @defun move-to-column column &optional force 1657 @defun move-to-column column &optional force buffer
1634 This function moves point to @var{column} in the current line. The 1658 This function moves point to @var{column} in the current line. The
1635 calculation of @var{column} takes into account the widths of the 1659 calculation of @var{column} takes into account the widths of the
1636 displayed representations of the characters between the start of the 1660 displayed representations of the characters between the start of the
1637 line and point. 1661 line and point.
1638 1662
1647 converts the tab into spaces so that it can move precisely to column 1671 converts the tab into spaces so that it can move precisely to column
1648 @var{column}. Other multicolumn characters can cause anomalies despite 1672 @var{column}. Other multicolumn characters can cause anomalies despite
1649 @var{force}, since there is no way to split them. 1673 @var{force}, since there is no way to split them.
1650 1674
1651 The argument @var{force} also has an effect if the line isn't long 1675 The argument @var{force} also has an effect if the line isn't long
1652 enough to reach column @var{column}; in that case, it says to add 1676 enough to reach column @var{column}; in that case, unless the value of
1677 @var{force} is the special value @code{coerce}, it says to add
1653 whitespace at the end of the line to reach that column. 1678 whitespace at the end of the line to reach that column.
1654 1679
1655 If @var{column} is not an integer, an error is signaled. 1680 If @var{column} is not a non-negative integer, an error is signaled.
1656 1681
1657 The return value is the column number actually moved to. 1682 The return value is the column number actually moved to.
1658 @end defun 1683 @end defun
1659 1684
1660 @node Indentation 1685 @node Indentation
1680 1705
1681 This section describes the primitive functions used to count and 1706 This section describes the primitive functions used to count and
1682 insert indentation. The functions in the following sections use these 1707 insert indentation. The functions in the following sections use these
1683 primitives. 1708 primitives.
1684 1709
1685 @defun current-indentation 1710 @defun current-indentation &optional buffer
1686 @comment !!Type Primitive Function 1711 @comment !!Type Primitive Function
1687 @comment !!SourceFile indent.c 1712 @comment !!SourceFile indent.c
1688 This function returns the indentation of the current line, which is 1713 This function returns the indentation of the current line, which is
1689 the horizontal position of the first nonblank character. If the 1714 the horizontal position of the first nonblank character. If the
1690 contents are entirely blank, then this is the horizontal position of the 1715 contents are entirely blank, then this is the horizontal position of the
1691 end of the line. 1716 end of the line.
1692 @end defun 1717 @end defun
1693 1718
1694 @deffn Command indent-to column &optional minimum 1719 @deffn Command indent-to column &optional minimum buffer
1695 @comment !!Type Primitive Function 1720 @comment !!Type Primitive Function
1696 @comment !!SourceFile indent.c 1721 @comment !!SourceFile indent.c
1697 This function indents from point with tabs and spaces until @var{column} 1722 This function indents from point with tabs and spaces until @var{column}
1698 is reached. If @var{minimum} is specified and non-@code{nil}, then at 1723 is reached. If @var{minimum} is specified and non-@code{nil}, then at
1699 least that many spaces are inserted even if this requires going beyond 1724 least that many spaces are inserted even if this requires going beyond
1700 @var{column}. Otherwise the function does nothing if point is already 1725 @var{column}. Otherwise the function does nothing if point is already
1701 beyond @var{column}. The value is the column at which the inserted 1726 beyond @var{column}. The value is the column at which the inserted
1702 indentation ends. 1727 indentation ends. If @var{buffer} is @code{nil}, the current buffer is assumed.
1703 @end deffn 1728 @end deffn
1704 1729
1705 @defopt indent-tabs-mode 1730 @defopt indent-tabs-mode
1706 @comment !!SourceFile indent.c 1731 @comment !!SourceFile indent.c
1707 If this variable is non-@code{nil}, indentation functions can insert 1732 If this variable is non-@code{nil}, indentation functions can insert
1732 @deffn Command indent-according-to-mode 1757 @deffn Command indent-according-to-mode
1733 This command calls the function in @code{indent-line-function} to 1758 This command calls the function in @code{indent-line-function} to
1734 indent the current line in a way appropriate for the current major mode. 1759 indent the current line in a way appropriate for the current major mode.
1735 @end deffn 1760 @end deffn
1736 1761
1737 @deffn Command indent-for-tab-command 1762 @deffn Command indent-for-tab-command &optional prefix-arg
1738 This command calls the function in @code{indent-line-function} to indent 1763 This command calls the function in @code{indent-line-function} to indent
1739 the current line; except that if that function is 1764 the current line; except that if that function is
1740 @code{indent-to-left-margin}, it calls @code{insert-tab} instead. (That 1765 @code{indent-to-left-margin}, it calls @code{insert-tab} instead. (That
1741 is a trivial command that inserts a tab character.) 1766 is a trivial command that inserts a tab character.)
1742 @end deffn 1767 @end deffn
1824 In Mail mode, @kbd{C-c C-y} (@code{mail-yank-original}) uses 1849 In Mail mode, @kbd{C-c C-y} (@code{mail-yank-original}) uses
1825 @code{indent-rigidly} to indent the text copied from the message being 1850 @code{indent-rigidly} to indent the text copied from the message being
1826 replied to. 1851 replied to.
1827 @end deffn 1852 @end deffn
1828 1853
1829 @defun indent-code-rigidly start end columns &optional nochange-regexp 1854 @deffn Command indent-code-rigidly start end columns &optional nochange-regexp
1830 This is like @code{indent-rigidly}, except that it doesn't alter lines 1855 This is like @code{indent-rigidly}, except that it doesn't alter lines
1831 that start within strings or comments. 1856 that start within strings or comments.
1832 1857
1833 In addition, it doesn't alter a line if @var{nochange-regexp} matches at 1858 In addition, it doesn't alter a line if @var{nochange-regexp} matches at
1834 the beginning of the line (if @var{nochange-regexp} is non-@code{nil}). 1859 the beginning of the line (if @var{nochange-regexp} is non-@code{nil}).
1835 @end defun 1860 @end deffn
1836 1861
1837 @node Relative Indent 1862 @node Relative Indent
1838 @subsection Indentation Relative to Previous Lines 1863 @subsection Indentation Relative to Previous Lines
1839 1864
1840 This section describes two commands that indent the current line 1865 This section describes two commands that indent the current line
1944 @subsection Indentation-Based Motion Commands 1969 @subsection Indentation-Based Motion Commands
1945 1970
1946 These commands, primarily for interactive use, act based on the 1971 These commands, primarily for interactive use, act based on the
1947 indentation in the text. 1972 indentation in the text.
1948 1973
1949 @deffn Command back-to-indentation 1974 @deffn Command back-to-indentation
1950 @comment !!SourceFile simple.el 1975 @comment !!SourceFile simple.el
1951 This command moves point to the first non-whitespace character in the 1976 This command moves point to the first non-whitespace character in the
1952 current line (which is the line in which point is located). It returns 1977 current line (which is the line in which point is located). It returns
1953 @code{nil}. 1978 @code{nil}.
1954 @end deffn 1979 @end deffn
1972 The case change commands described here work on text in the current 1997 The case change commands described here work on text in the current
1973 buffer. @xref{Character Case}, for case conversion commands that work 1998 buffer. @xref{Character Case}, for case conversion commands that work
1974 on strings and characters. @xref{Case Tables}, for how to customize 1999 on strings and characters. @xref{Case Tables}, for how to customize
1975 which characters are upper or lower case and how to convert them. 2000 which characters are upper or lower case and how to convert them.
1976 2001
1977 @deffn Command capitalize-region start end 2002 @deffn Command capitalize-region start end &optional buffer
1978 This function capitalizes all words in the region defined by 2003 This function capitalizes all words in the region defined by
1979 @var{start} and @var{end}. To capitalize means to convert each word's 2004 @var{start} and @var{end}. To capitalize means to convert each word's
1980 first character to upper case and convert the rest of each word to lower 2005 first character to upper case and convert the rest of each word to lower
1981 case. The function returns @code{nil}. 2006 case. The function returns @code{nil}.
1982 2007
2002 ---------- Buffer: foo ---------- 2027 ---------- Buffer: foo ----------
2003 @end group 2028 @end group
2004 @end example 2029 @end example
2005 @end deffn 2030 @end deffn
2006 2031
2007 @deffn Command downcase-region start end 2032 @deffn Command downcase-region start end &optional buffer
2008 This function converts all of the letters in the region defined by 2033 This function converts all of the letters in the region defined by
2009 @var{start} and @var{end} to lower case. The function returns 2034 @var{start} and @var{end} to lower case. The function returns
2010 @code{nil}. 2035 @code{nil}.
2011 2036
2012 When @code{downcase-region} is called interactively, @var{start} and 2037 When @code{downcase-region} is called interactively, @var{start} and
2013 @var{end} are point and the mark, with the smallest first. 2038 @var{end} are point and the mark, with the smallest first.
2014 @end deffn 2039 @end deffn
2015 2040
2016 @deffn Command upcase-region start end 2041 @deffn Command upcase-region start end &optional buffer
2017 This function converts all of the letters in the region defined by 2042 This function converts all of the letters in the region defined by
2018 @var{start} and @var{end} to upper case. The function returns 2043 @var{start} and @var{end} to upper case. The function returns
2019 @code{nil}. 2044 @code{nil}.
2020 2045
2021 When @code{upcase-region} is called interactively, @var{start} and 2046 When @code{upcase-region} is called interactively, @var{start} and
2022 @var{end} are point and the mark, with the smallest first. 2047 @var{end} are point and the mark, with the smallest first.
2023 @end deffn 2048 @end deffn
2024 2049
2025 @deffn Command capitalize-word count 2050 @deffn Command capitalize-word count &optional buffer
2026 This function capitalizes @var{count} words after point, moving point 2051 This function capitalizes @var{count} words after point, moving point
2027 over as it does. To capitalize means to convert each word's first 2052 over as it does. To capitalize means to convert each word's first
2028 character to upper case and convert the rest of each word to lower case. 2053 character to upper case and convert the rest of each word to lower case.
2029 If @var{count} is negative, the function capitalizes the 2054 If @var{count} is negative, the function capitalizes the
2030 @minus{}@var{count} previous words but does not move point. The value 2055 @minus{}@var{count} previous words but does not move point. The value
2035 2060
2036 When @code{capitalize-word} is called interactively, @var{count} is 2061 When @code{capitalize-word} is called interactively, @var{count} is
2037 set to the numeric prefix argument. 2062 set to the numeric prefix argument.
2038 @end deffn 2063 @end deffn
2039 2064
2040 @deffn Command downcase-word count 2065 @deffn Command downcase-word count &optional buffer
2041 This function converts the @var{count} words after point to all lower 2066 This function converts the @var{count} words after point to all lower
2042 case, moving point over as it does. If @var{count} is negative, it 2067 case, moving point over as it does. If @var{count} is negative, it
2043 converts the @minus{}@var{count} previous words but does not move point. 2068 converts the @minus{}@var{count} previous words but does not move point.
2044 The value is @code{nil}. 2069 The value is @code{nil}.
2045 2070
2046 When @code{downcase-word} is called interactively, @var{count} is set 2071 When @code{downcase-word} is called interactively, @var{count} is set
2047 to the numeric prefix argument. 2072 to the numeric prefix argument.
2048 @end deffn 2073 @end deffn
2049 2074
2050 @deffn Command upcase-word count 2075 @deffn Command upcase-word count &optional buffer
2051 This function converts the @var{count} words after point to all upper 2076 This function converts the @var{count} words after point to all upper
2052 case, moving point over as it does. If @var{count} is negative, it 2077 case, moving point over as it does. If @var{count} is negative, it
2053 converts the @minus{}@var{count} previous words but does not move point. 2078 converts the @minus{}@var{count} previous words but does not move point.
2054 The value is @code{nil}. 2079 The value is @code{nil}.
2055 2080
2113 2138
2114 These functions handle both strings and buffers. (Keep in mind that 2139 These functions handle both strings and buffers. (Keep in mind that
2115 positions in a string start from 0, whereas positions in a buffer start 2140 positions in a string start from 0, whereas positions in a buffer start
2116 from 1.) 2141 from 1.)
2117 2142
2118 @defun get-text-property pos prop &optional object 2143 @defun get-text-property pos prop &optional object at-flag
2119 This function returns the value of the @var{prop} property of the 2144 This function returns the value of the @var{prop} property of the
2120 character after position @var{pos} in @var{object} (a buffer or string). 2145 character after position @var{pos} in @var{object} (a buffer or string).
2121 The argument @var{object} is optional and defaults to the current 2146 The argument @var{object} is optional and defaults to the current
2122 buffer. 2147 buffer.
2123 @ignore @c Bogus as hell! 2148 @ignore @c Bogus as hell!
2125 has a category that is a symbol, then @code{get-text-property} returns 2150 has a category that is a symbol, then @code{get-text-property} returns
2126 the @var{prop} property of that symbol. 2151 the @var{prop} property of that symbol.
2127 @end ignore 2152 @end ignore
2128 @end defun 2153 @end defun
2129 2154
2130 @defun get-char-property pos prop &optional object 2155 @defun get-char-property pos prop &optional object at-flag
2131 This function is like @code{get-text-property}, except that it checks 2156 This function is like @code{get-text-property}, except that it checks
2132 all extents, not just text-property extents. 2157 all extents, not just text-property extents.
2133 2158
2134 @ignore Does not apply in XEmacs 2159 @ignore Does not apply in XEmacs
2135 The argument @var{object} may be a string, a buffer, or a window. If it 2160 The argument @var{object} may be a string, a buffer, or a window. If it
2278 returns the position of the first character beyond @var{pos} whose 2303 returns the position of the first character beyond @var{pos} whose
2279 properties are not identical to those of the character just after 2304 properties are not identical to those of the character just after
2280 @var{pos}. 2305 @var{pos}.
2281 2306
2282 If @var{limit} is non-@code{nil}, then the scan ends at position 2307 If @var{limit} is non-@code{nil}, then the scan ends at position
2283 @var{limit}. If there is no property change before that point, 2308 @var{limit}. If there is no property change before that point,
2284 @code{next-property-change} returns @var{limit}. 2309 @code{next-property-change} returns @var{limit}.
2285 2310
2286 The value is @code{nil} if the properties remain unchanged all the way 2311 The value is @code{nil} if the properties remain unchanged all the way
2287 to the end of @var{object} and @var{limit} is @code{nil}. If the value 2312 to the end of @var{object} and @var{limit} is @code{nil}. If the value
2288 is non-@code{nil}, it is a position greater than or equal to @var{pos}. 2313 is non-@code{nil}, it is a position greater than or equal to @var{pos}.
2309 returns the position of the first character beyond @var{pos} whose 2334 returns the position of the first character beyond @var{pos} whose
2310 @var{prop} property differs from that of the character just after 2335 @var{prop} property differs from that of the character just after
2311 @var{pos}. 2336 @var{pos}.
2312 2337
2313 If @var{limit} is non-@code{nil}, then the scan ends at position 2338 If @var{limit} is non-@code{nil}, then the scan ends at position
2314 @var{limit}. If there is no property change before that point, 2339 @var{limit}. If there is no property change before that point,
2315 @code{next-single-property-change} returns @var{limit}. 2340 @code{next-single-property-change} returns @var{limit}.
2316 2341
2317 The value is @code{nil} if the property remains unchanged all the way to 2342 The value is @code{nil} if the property remains unchanged all the way to
2318 the end of @var{object} and @var{limit} is @code{nil}. If the value is 2343 the end of @var{object} and @var{limit} is @code{nil}. If the value is
2319 non-@code{nil}, it is a position greater than or equal to @var{pos}; it 2344 non-@code{nil}, it is a position greater than or equal to @var{pos}; it
2320 equals @var{pos} only if @var{limit} equals @var{pos}. 2345 equals @var{pos} only if @var{limit} equals @var{pos}.
2321 @end defun 2346 @end defun
2322 2347
2323 @defun previous-property-change pos &optional object limit 2348 @defun previous-property-change pos &optional object limit
2324 This is like @code{next-property-change}, but scans back from @var{pos} 2349 This is like @code{next-property-change}, but scans backward from @var{pos}
2325 instead of forward. If the value is non-@code{nil}, it is a position 2350 instead of forward. If the value is non-@code{nil}, it is a position
2326 less than or equal to @var{pos}; it equals @var{pos} only if @var{limit} 2351 less than or equal to @var{pos}; it equals @var{pos} only if @var{limit}
2327 equals @var{pos}. 2352 equals @var{pos}.
2328 @end defun 2353 @end defun
2329 2354
2330 @defun previous-single-property-change pos prop &optional object limit 2355 @defun previous-single-property-change pos prop &optional object limit
2331 This is like @code{next-single-property-change}, but scans back from 2356 This is like @code{next-single-property-change}, but scans backward from
2332 @var{pos} instead of forward. If the value is non-@code{nil}, it is a 2357 @var{pos} instead of forward. If the value is non-@code{nil}, it is a
2333 position less than or equal to @var{pos}; it equals @var{pos} only if 2358 position less than or equal to @var{pos}; it equals @var{pos} only if
2334 @var{limit} equals @var{pos}. 2359 @var{limit} equals @var{pos}.
2335 @end defun 2360 @end defun
2336 2361
2370 @subsection Saving Text Properties in Files 2395 @subsection Saving Text Properties in Files
2371 @cindex text properties in files 2396 @cindex text properties in files
2372 @cindex saving text properties 2397 @cindex saving text properties
2373 2398
2374 You can save text properties in files, and restore text properties 2399 You can save text properties in files, and restore text properties
2375 when inserting the files, using these two hooks: 2400 when inserting the files, using these two hooks:
2376 2401
2377 @defvar write-region-annotate-functions 2402 @defvar write-region-annotate-functions
2378 This variable's value is a list of functions for @code{write-region} to 2403 This variable's value is a list of functions for @code{write-region} to
2379 run to encode text properties in some fashion as annotations to the text 2404 run to encode text properties in some fashion as annotations to the text
2380 being written in the file. @xref{Writing to Files}. 2405 being written in the file. @xref{Writing to Files}.
2420 uses may be possible. 2445 uses may be possible.
2421 @end defvar 2446 @end defvar
2422 2447
2423 We invite users to write Lisp programs to store and retrieve text 2448 We invite users to write Lisp programs to store and retrieve text
2424 properties in files, using these hooks, and thus to experiment with 2449 properties in files, using these hooks, and thus to experiment with
2425 various data formats and find good ones. Eventually we hope users 2450 various data formats and find good ones. Eventually we hope users
2426 will produce good, general extensions we can install in Emacs. 2451 will produce good, general extensions we can install in Emacs.
2427 2452
2428 We suggest not trying to handle arbitrary Lisp objects as property 2453 We suggest not trying to handle arbitrary Lisp objects as property
2429 names or property values---because a program that general is probably 2454 names or property values---because a program that general is probably
2430 difficult to write, and slow. Instead, choose a set of possible data 2455 difficult to write, and slow. Instead, choose a set of possible data
2475 @defun translate-region start end table 2500 @defun translate-region start end table
2476 This function applies a translation table to the characters in the 2501 This function applies a translation table to the characters in the
2477 buffer between positions @var{start} and @var{end}. The translation 2502 buffer between positions @var{start} and @var{end}. The translation
2478 table @var{table} can be either a string, a vector, or a char-table. 2503 table @var{table} can be either a string, a vector, or a char-table.
2479 2504
2480 If @var{table} is a string, its @var{n}th element is the mapping for the 2505 If @var{table} is a string, its @var{n}th element is the mapping for the
2481 character with code @var{n}. 2506 character with code @var{n}.
2482 2507
2483 If @var{table} is a vector, its @var{n}th element is the mapping for 2508 If @var{table} is a vector, its @var{n}th element is the mapping for
2484 character with code @var{n}. Legal mappings are characters, strings, or 2509 character with code @var{n}. Legal mappings are characters, strings, or
2485 @code{nil} (meaning don't replace.) 2510 @code{nil} (meaning don't replace.)
2555 representing the register contents. A string represents text stored in 2580 representing the register contents. A string represents text stored in
2556 the register. A marker represents a position. A list represents a 2581 the register. A marker represents a position. A list represents a
2557 rectangle; its elements are strings, one per line of the rectangle. 2582 rectangle; its elements are strings, one per line of the rectangle.
2558 @end defvar 2583 @end defvar
2559 2584
2560 @defun get-register reg 2585 @defun get-register register
2561 This function returns the contents of the register 2586 This function returns the contents of the register
2562 @var{reg}, or @code{nil} if it has no contents. 2587 @var{register}, or @code{nil} if it has no contents.
2563 @end defun 2588 @end defun
2564 2589
2565 @defun set-register reg value 2590 @defun set-register register value
2566 This function sets the contents of register @var{reg} to @var{value}. 2591 This function sets the contents of register @var{register} to @var{value}.
2567 A register can be set to any value, but the other register functions 2592 A register can be set to any value, but the other register functions
2568 expect only certain data types. The return value is @var{value}. 2593 expect only certain data types. The return value is @var{value}.
2569 @end defun 2594 @end defun
2570 2595
2571 @deffn Command view-register reg 2596 @deffn Command view-register register
2572 This command displays what is contained in register @var{reg}. 2597 This command displays what is contained in register @var{register}.
2573 @end deffn 2598 @end deffn
2574 2599
2575 @ignore 2600 @ignore
2576 @deffn Command point-to-register reg 2601 @deffn Command point-to-register register
2577 This command stores both the current location of point and the current 2602 This command stores both the current location of point and the current
2578 buffer in register @var{reg} as a marker. 2603 buffer in register @var{register} as a marker.
2579 @end deffn 2604 @end deffn
2580 2605
2581 @deffn Command jump-to-register reg 2606 @deffn Command jump-to-register register
2582 @deffnx Command register-to-point reg 2607 @deffnx Command register-to-point register
2583 @comment !!SourceFile register.el 2608 @comment !!SourceFile register.el
2584 This command restores the status recorded in register @var{reg}. 2609 This command restores the status recorded in register @var{register}.
2585 2610
2586 If @var{reg} contains a marker, it moves point to the position stored in 2611 If @var{register} contains a marker, it moves point to the position
2587 the marker. Since both the buffer and the location within the buffer 2612 stored in the marker. Since both the buffer and the location within the
2588 are stored by the @code{point-to-register} function, this command can 2613 buffer are stored by the @code{point-to-register} function, this command
2589 switch you to another buffer. 2614 can switch you to another buffer.
2590 2615
2591 If @var{reg} contains a window configuration or a frame configuration. 2616 If @var{register} contains a window configuration or a frame configuration.
2592 @code{jump-to-register} restores that configuration. 2617 @code{jump-to-register} restores that configuration.
2593 @end deffn 2618 @end deffn
2594 @end ignore 2619 @end ignore
2595 2620
2596 @deffn Command insert-register reg &optional beforep 2621 @deffn Command insert-register register &optional beforep
2597 This command inserts contents of register @var{reg} into the current 2622 This command inserts contents of register @var{register} into the current
2598 buffer. 2623 buffer.
2599 2624
2600 Normally, this command puts point before the inserted text, and the 2625 Normally, this command puts point before the inserted text, and the
2601 mark after it. However, if the optional second argument @var{beforep} 2626 mark after it. However, if the optional second argument @var{beforep}
2602 is non-@code{nil}, it puts the mark before and point after. 2627 is non-@code{nil}, it puts the mark before and point after.
2611 a rectangle (a list), currently useless things happen. This may be 2636 a rectangle (a list), currently useless things happen. This may be
2612 changed in the future. 2637 changed in the future.
2613 @end deffn 2638 @end deffn
2614 2639
2615 @ignore 2640 @ignore
2616 @deffn Command copy-to-register reg start end &optional delete-flag 2641 @deffn Command copy-to-register register start end &optional delete-flag
2617 This command copies the region from @var{start} to @var{end} into 2642 This command copies the region from @var{start} to @var{end} into
2618 register @var{reg}. If @var{delete-flag} is non-@code{nil}, it deletes 2643 register @var{register}. If @var{delete-flag} is non-@code{nil}, it deletes
2619 the region from the buffer after copying it into the register. 2644 the region from the buffer after copying it into the register.
2620 @end deffn 2645 @end deffn
2621 2646
2622 @deffn Command prepend-to-register reg start end &optional delete-flag 2647 @deffn Command prepend-to-register register start end &optional delete-flag
2623 This command prepends the region from @var{start} to @var{end} into 2648 This command prepends the region from @var{start} to @var{end} into
2624 register @var{reg}. If @var{delete-flag} is non-@code{nil}, it deletes 2649 register @var{register}. If @var{delete-flag} is non-@code{nil}, it deletes
2625 the region from the buffer after copying it to the register. 2650 the region from the buffer after copying it to the register.
2626 @end deffn 2651 @end deffn
2627 2652
2628 @deffn Command append-to-register reg start end &optional delete-flag 2653 @deffn Command append-to-register register start end &optional delete-flag
2629 This command appends the region from @var{start} to @var{end} to the 2654 This command appends the region from @var{start} to @var{end} to the
2630 text already in register @var{reg}. If @var{delete-flag} is 2655 text already in register @var{register}. If @var{delete-flag} is
2631 non-@code{nil}, it deletes the region from the buffer after copying it 2656 non-@code{nil}, it deletes the region from the buffer after copying it
2632 to the register. 2657 to the register.
2633 @end deffn 2658 @end deffn
2634 2659
2635 @deffn Command copy-rectangle-to-register reg start end &optional delete-flag 2660 @deffn Command copy-rectangle-to-register register start end &optional delete-flag
2636 This command copies a rectangular region from @var{start} to @var{end} 2661 This command copies a rectangular region from @var{start} to @var{end}
2637 into register @var{reg}. If @var{delete-flag} is non-@code{nil}, it 2662 into register @var{register}. If @var{delete-flag} is non-@code{nil}, it
2638 deletes the region from the buffer after copying it to the register. 2663 deletes the region from the buffer after copying it to the register.
2639 @end deffn 2664 @end deffn
2640 2665
2641 @deffn Command window-configuration-to-register reg 2666 @deffn Command window-configuration-to-register register
2642 This function stores the window configuration of the selected frame in 2667 This function stores the window configuration of the selected frame in
2643 register @var{reg}. 2668 register @var{register}.
2644 @end deffn 2669 @end deffn
2645 2670
2646 @deffn Command frame-configuration-to-register reg 2671 @deffn Command frame-configuration-to-register register
2647 This function stores the current frame configuration in register 2672 This function stores the current frame configuration in register
2648 @var{reg}. 2673 @var{register}.
2649 @end deffn 2674 @end deffn
2650 @end ignore 2675 @end ignore
2651 2676
2652 @node Transposition 2677 @node Transposition
2653 @section Transposition of Text 2678 @section Transposition of Text
2740 the same MD5 digest, or to produce a message having a prespecified 2765 the same MD5 digest, or to produce a message having a prespecified
2741 target digest. MD5 is used heavily by various authentication schemes. 2766 target digest. MD5 is used heavily by various authentication schemes.
2742 2767
2743 Emacs Lisp interface to MD5 consists of a single function @code{md5}: 2768 Emacs Lisp interface to MD5 consists of a single function @code{md5}:
2744 2769
2745 @defun md5 object &optional start end 2770 @defun md5 object &optional start end coding noerror
2746 This function returns the MD5 message digest of @var{object}, a buffer 2771 This function returns the MD5 message digest of @var{object}, a buffer
2747 or string. 2772 or string.
2748 2773
2749 Optional arguments @var{start} and @var{end} denote positions for 2774 Optional arguments @var{start} and @var{end} denote positions for
2750 computing the digest of a portion of @var{object}. 2775 computing the digest of a portion of @var{object}.
2751 2776
2752 Some examples of usage: 2777 The optional @var{coding} argument specifies the coding system the text
2778 is to be represented in while computing the digest. If unspecified, it
2779 defaults to the current format of the data, or is guessed.
2780
2781 If @var{noerror} is non-@code{nil}, silently assume binary coding if the
2782 guesswork fails. Normally, an error is signaled in such case.
2783
2784 @var{coding} and @var{noerror} arguments are meaningful only in XEmacsen
2785 with file-coding or Mule support. Otherwise, they are ignored. Some
2786 examples of usage:
2753 2787
2754 @example 2788 @example
2755 @group 2789 @group
2756 ;; @r{Calculate the digest of the entire buffer} 2790 ;; @r{Calculate the digest of the entire buffer}
2757 (md5 (current-buffer)) 2791 (md5 (current-buffer))
2777 of US-ASCII, as described in rfc2045. Base64 is used by MIME to encode 2811 of US-ASCII, as described in rfc2045. Base64 is used by MIME to encode
2778 binary bodies, and to encode binary characters in message headers. 2812 binary bodies, and to encode binary characters in message headers.
2779 2813
2780 The Lisp interface to base64 consists of four functions: 2814 The Lisp interface to base64 consists of four functions:
2781 2815
2782 @defun base64-encode-region beg end &optional no-line-break 2816 @deffn Command base64-encode-region start end &optional no-line-break
2783 This function encodes the region between @var{beg} and @var{end} of the 2817 This function encodes the region between @var{start} and @var{end} of the
2784 current buffer to base64 format. This means that the original region is 2818 current buffer to base64 format. This means that the original region is
2785 deleted, and replaced with its base64 equivalent. 2819 deleted, and replaced with its base64 equivalent.
2786 2820
2787 Normally, encoded base64 output is multi-line, with 76-character lines. 2821 Normally, encoded base64 output is multi-line, with 76-character lines.
2788 If @var{no-line-break} is non-@code{nil}, newlines will not be inserted, 2822 If @var{no-line-break} is non-@code{nil}, newlines will not be inserted,
2789 resulting in single-line output. 2823 resulting in single-line output.
2790 2824
2791 Mule note: you should make sure that you convert the multibyte 2825 Mule note: you should make sure that you convert the multibyte
2792 characters (those that do not fit into 0--255 range) to something else, 2826 characters (those that do not fit into 0--255 range) to something else,
2793 because they cannot be meaningfully converted to base64. If the 2827 because they cannot be meaningfully converted to base64. If the
2803 @end group 2837 @end group
2804 @end example 2838 @end example
2805 2839
2806 The function can also be used interactively, in which case it works on 2840 The function can also be used interactively, in which case it works on
2807 the currently active region. 2841 the currently active region.
2808 @end defun 2842 @end deffn
2809 2843
2810 @defun base64-encode-string string 2844 @defun base64-encode-string string &optional no-line-break
2811 This function encodes @var{string} to base64, and returns the encoded 2845 This function encodes @var{string} to base64, and returns the encoded
2812 string. 2846 string.
2813 2847
2848 Normally, encoded base64 output is multi-line, with 76-character lines.
2849 If @var{no-line-break} is non-@code{nil}, newlines will not be inserted,
2850 resulting in single-line output.
2851
2814 For Mule, the same considerations apply as for 2852 For Mule, the same considerations apply as for
2815 @code{base64-encode-region}. 2853 @code{base64-encode-region}.
2816 2854
2817 @example 2855 @example
2818 @group 2856 @group
2820 @result{} "ZnViYXI=" 2858 @result{} "ZnViYXI="
2821 @end group 2859 @end group
2822 @end example 2860 @end example
2823 @end defun 2861 @end defun
2824 2862
2825 @defun base64-decode-region beg end 2863 @deffn Command base64-decode-region start end
2826 This function decodes the region between @var{beg} and @var{end} of the 2864 This function decodes the region between @var{start} and @var{end} of the
2827 current buffer. The region should be in base64 encoding. 2865 current buffer. The region should be in base64 encoding.
2828 2866
2829 If the region was decoded correctly, @code{base64-decode-region} returns 2867 If the region was decoded correctly, @code{base64-decode-region} returns
2830 the length of the decoded region. If the decoding failed, @code{nil} is 2868 the length of the decoded region. If the decoding failed, @code{nil} is
2831 returned. 2869 returned.
2832 2870
2833 @example 2871 @example
2834 @group 2872 @group
2835 ;; @r{Decode a base64 buffer, and replace it with the decoded version} 2873 ;; @r{Decode a base64 buffer, and replace it with the decoded version}
2836 (base64-decode-region (point-min) (point-max)) 2874 (base64-decode-region (point-min) (point-max))
2837 @end group 2875 @end group
2838 @end example 2876 @end example
2839 @end defun 2877 @end deffn
2840 2878
2841 @defun base64-decode-string string 2879 @defun base64-decode-string string
2842 This function decodes @var{string} to base64, and returns the decoded 2880 This function decodes @var{string} to base64, and returns the decoded
2843 string. @var{string} should be valid base64-encoded text. 2881 string. @var{string} should be valid base64-encoded text.
2844 2882