comparison src/editfns.c @ 109351:c8a969d13eda

merge trunk
author Kenichi Handa <handa@etlken>
date Fri, 09 Jul 2010 15:55:27 +0900
parents 8cfee7d2955f
children e856a274549b
comparison
equal deleted inserted replaced
109350:c11d07f3d731 109351:c8a969d13eda
207 } 207 }
208 208
209 DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, 209 DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0,
210 doc: /* Convert arg CHAR to a string containing that character. 210 doc: /* Convert arg CHAR to a string containing that character.
211 usage: (char-to-string CHAR) */) 211 usage: (char-to-string CHAR) */)
212 (character) 212 (Lisp_Object character)
213 Lisp_Object character;
214 { 213 {
215 int len; 214 int len;
216 unsigned char str[MAX_MULTIBYTE_LENGTH]; 215 unsigned char str[MAX_MULTIBYTE_LENGTH];
217 216
218 CHECK_CHARACTER (character); 217 CHECK_CHARACTER (character);
221 return make_string_from_bytes (str, 1, len); 220 return make_string_from_bytes (str, 1, len);
222 } 221 }
223 222
224 DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, 223 DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
225 doc: /* Convert arg BYTE to a string containing that byte. */) 224 doc: /* Convert arg BYTE to a string containing that byte. */)
226 (byte) 225 (Lisp_Object byte)
227 Lisp_Object byte;
228 { 226 {
229 unsigned char b; 227 unsigned char b;
230 CHECK_NUMBER (byte); 228 CHECK_NUMBER (byte);
231 b = XINT (byte); 229 b = XINT (byte);
232 return make_string_from_bytes (&b, 1, 1); 230 return make_string_from_bytes (&b, 1, 1);
233 } 231 }
234 232
235 DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, 233 DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,
236 doc: /* Convert arg STRING to a character, the first character of that string. 234 doc: /* Convert arg STRING to a character, the first character of that string.
237 A multibyte character is handled correctly. */) 235 A multibyte character is handled correctly. */)
238 (string) 236 (register Lisp_Object string)
239 register Lisp_Object string;
240 { 237 {
241 register Lisp_Object val; 238 register Lisp_Object val;
242 CHECK_STRING (string); 239 CHECK_STRING (string);
243 if (SCHARS (string)) 240 if (SCHARS (string))
244 { 241 {
262 } 259 }
263 260
264 DEFUN ("point", Fpoint, Spoint, 0, 0, 0, 261 DEFUN ("point", Fpoint, Spoint, 0, 0, 0,
265 doc: /* Return value of point, as an integer. 262 doc: /* Return value of point, as an integer.
266 Beginning of buffer is position (point-min). */) 263 Beginning of buffer is position (point-min). */)
267 () 264 (void)
268 { 265 {
269 Lisp_Object temp; 266 Lisp_Object temp;
270 XSETFASTINT (temp, PT); 267 XSETFASTINT (temp, PT);
271 return temp; 268 return temp;
272 } 269 }
273 270
274 DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0, 271 DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0,
275 doc: /* Return value of point, as a marker object. */) 272 doc: /* Return value of point, as a marker object. */)
276 () 273 (void)
277 { 274 {
278 return buildmark (PT, PT_BYTE); 275 return buildmark (PT, PT_BYTE);
279 } 276 }
280 277
281 int 278 int
292 DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", 289 DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
293 doc: /* Set point to POSITION, a number or marker. 290 doc: /* Set point to POSITION, a number or marker.
294 Beginning of buffer is position (point-min), end is (point-max). 291 Beginning of buffer is position (point-min), end is (point-max).
295 292
296 The return value is POSITION. */) 293 The return value is POSITION. */)
297 (position) 294 (register Lisp_Object position)
298 register Lisp_Object position;
299 { 295 {
300 int pos; 296 int pos;
301 297
302 if (MARKERP (position) 298 if (MARKERP (position)
303 && current_buffer == XMARKER (position)->buffer) 299 && current_buffer == XMARKER (position)->buffer)
345 return m; 341 return m;
346 } 342 }
347 343
348 DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0, 344 DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0,
349 doc: /* Return position of beginning of region, as an integer. */) 345 doc: /* Return position of beginning of region, as an integer. */)
350 () 346 (void)
351 { 347 {
352 return region_limit (1); 348 return region_limit (1);
353 } 349 }
354 350
355 DEFUN ("region-end", Fregion_end, Sregion_end, 0, 0, 0, 351 DEFUN ("region-end", Fregion_end, Sregion_end, 0, 0, 0,
356 doc: /* Return position of end of region, as an integer. */) 352 doc: /* Return position of end of region, as an integer. */)
357 () 353 (void)
358 { 354 {
359 return region_limit (0); 355 return region_limit (0);
360 } 356 }
361 357
362 DEFUN ("mark-marker", Fmark_marker, Smark_marker, 0, 0, 0, 358 DEFUN ("mark-marker", Fmark_marker, Smark_marker, 0, 0, 0,
363 doc: /* Return this buffer's mark, as a marker object. 359 doc: /* Return this buffer's mark, as a marker object.
364 Watch out! Moving this marker changes the mark position. 360 Watch out! Moving this marker changes the mark position.
365 If you set the marker not to point anywhere, the buffer will have no mark. */) 361 If you set the marker not to point anywhere, the buffer will have no mark. */)
366 () 362 (void)
367 { 363 {
368 return current_buffer->mark; 364 return current_buffer->mark;
369 } 365 }
370 366
371 367
637 633
638 DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0, 634 DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0,
639 doc: /* Delete the field surrounding POS. 635 doc: /* Delete the field surrounding POS.
640 A field is a region of text with the same `field' property. 636 A field is a region of text with the same `field' property.
641 If POS is nil, the value of point is used for POS. */) 637 If POS is nil, the value of point is used for POS. */)
642 (pos) 638 (Lisp_Object pos)
643 Lisp_Object pos;
644 { 639 {
645 int beg, end; 640 int beg, end;
646 find_field (pos, Qnil, Qnil, &beg, Qnil, &end); 641 find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
647 if (beg != end) 642 if (beg != end)
648 del_range (beg, end); 643 del_range (beg, end);
651 646
652 DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0, 647 DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0,
653 doc: /* Return the contents of the field surrounding POS as a string. 648 doc: /* Return the contents of the field surrounding POS as a string.
654 A field is a region of text with the same `field' property. 649 A field is a region of text with the same `field' property.
655 If POS is nil, the value of point is used for POS. */) 650 If POS is nil, the value of point is used for POS. */)
656 (pos) 651 (Lisp_Object pos)
657 Lisp_Object pos;
658 { 652 {
659 int beg, end; 653 int beg, end;
660 find_field (pos, Qnil, Qnil, &beg, Qnil, &end); 654 find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
661 return make_buffer_string (beg, end, 1); 655 return make_buffer_string (beg, end, 1);
662 } 656 }
663 657
664 DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0, 658 DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0,
665 doc: /* Return the contents of the field around POS, without text properties. 659 doc: /* Return the contents of the field around POS, without text properties.
666 A field is a region of text with the same `field' property. 660 A field is a region of text with the same `field' property.
667 If POS is nil, the value of point is used for POS. */) 661 If POS is nil, the value of point is used for POS. */)
668 (pos) 662 (Lisp_Object pos)
669 Lisp_Object pos;
670 { 663 {
671 int beg, end; 664 int beg, end;
672 find_field (pos, Qnil, Qnil, &beg, Qnil, &end); 665 find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
673 return make_buffer_string (beg, end, 0); 666 return make_buffer_string (beg, end, 0);
674 } 667 }
679 If POS is nil, the value of point is used for POS. 672 If POS is nil, the value of point is used for POS.
680 If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its 673 If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its
681 field, then the beginning of the *previous* field is returned. 674 field, then the beginning of the *previous* field is returned.
682 If LIMIT is non-nil, it is a buffer position; if the beginning of the field 675 If LIMIT is non-nil, it is a buffer position; if the beginning of the field
683 is before LIMIT, then LIMIT will be returned instead. */) 676 is before LIMIT, then LIMIT will be returned instead. */)
684 (pos, escape_from_edge, limit) 677 (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit)
685 Lisp_Object pos, escape_from_edge, limit;
686 { 678 {
687 int beg; 679 int beg;
688 find_field (pos, escape_from_edge, limit, &beg, Qnil, 0); 680 find_field (pos, escape_from_edge, limit, &beg, Qnil, 0);
689 return make_number (beg); 681 return make_number (beg);
690 } 682 }
695 If POS is nil, the value of point is used for POS. 687 If POS is nil, the value of point is used for POS.
696 If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field, 688 If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field,
697 then the end of the *following* field is returned. 689 then the end of the *following* field is returned.
698 If LIMIT is non-nil, it is a buffer position; if the end of the field 690 If LIMIT is non-nil, it is a buffer position; if the end of the field
699 is after LIMIT, then LIMIT will be returned instead. */) 691 is after LIMIT, then LIMIT will be returned instead. */)
700 (pos, escape_from_edge, limit) 692 (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit)
701 Lisp_Object pos, escape_from_edge, limit;
702 { 693 {
703 int end; 694 int end;
704 find_field (pos, escape_from_edge, Qnil, 0, limit, &end); 695 find_field (pos, escape_from_edge, Qnil, 0, limit, &end);
705 return make_number (end); 696 return make_number (end);
706 } 697 }
730 721
731 If the optional argument INHIBIT-CAPTURE-PROPERTY is non-nil, and OLD-POS has 722 If the optional argument INHIBIT-CAPTURE-PROPERTY is non-nil, and OLD-POS has
732 a non-nil property of that name, then any field boundaries are ignored. 723 a non-nil property of that name, then any field boundaries are ignored.
733 724
734 Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) 725 Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
735 (new_pos, old_pos, escape_from_edge, only_in_line, inhibit_capture_property) 726 (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property)
736 Lisp_Object new_pos, old_pos;
737 Lisp_Object escape_from_edge, only_in_line, inhibit_capture_property;
738 { 727 {
739 /* If non-zero, then the original point, before re-positioning. */ 728 /* If non-zero, then the original point, before re-positioning. */
740 int orig_point = 0; 729 int orig_point = 0;
741 int fwd; 730 int fwd;
742 Lisp_Object prev_old, prev_new; 731 Lisp_Object prev_old, prev_new;
827 unconstrained result. If N is nil or 1, and a front-sticky field 816 unconstrained result. If N is nil or 1, and a front-sticky field
828 starts at point, the scan stops as soon as it starts. To ignore field 817 starts at point, the scan stops as soon as it starts. To ignore field
829 boundaries bind `inhibit-field-text-motion' to t. 818 boundaries bind `inhibit-field-text-motion' to t.
830 819
831 This function does not move point. */) 820 This function does not move point. */)
832 (n) 821 (Lisp_Object n)
833 Lisp_Object n;
834 { 822 {
835 int orig, orig_byte, end; 823 int orig, orig_byte, end;
836 int count = SPECPDL_INDEX (); 824 int count = SPECPDL_INDEX ();
837 specbind (Qinhibit_point_motion_hooks, Qt); 825 specbind (Qinhibit_point_motion_hooks, Qt);
838 826
866 unconstrained result. If N is nil or 1, and a rear-sticky field ends 854 unconstrained result. If N is nil or 1, and a rear-sticky field ends
867 at point, the scan stops as soon as it starts. To ignore field 855 at point, the scan stops as soon as it starts. To ignore field
868 boundaries bind `inhibit-field-text-motion' to t. 856 boundaries bind `inhibit-field-text-motion' to t.
869 857
870 This function does not move point. */) 858 This function does not move point. */)
871 (n) 859 (Lisp_Object n)
872 Lisp_Object n;
873 { 860 {
874 int end_pos; 861 int end_pos;
875 int orig = PT; 862 int orig = PT;
876 863
877 if (NILP (n)) 864 if (NILP (n))
998 985
999 If you only want to save the current buffer but not point nor mark, 986 If you only want to save the current buffer but not point nor mark,
1000 then just use `save-current-buffer', or even `with-current-buffer'. 987 then just use `save-current-buffer', or even `with-current-buffer'.
1001 988
1002 usage: (save-excursion &rest BODY) */) 989 usage: (save-excursion &rest BODY) */)
1003 (args) 990 (Lisp_Object args)
1004 Lisp_Object args;
1005 { 991 {
1006 register Lisp_Object val; 992 register Lisp_Object val;
1007 int count = SPECPDL_INDEX (); 993 int count = SPECPDL_INDEX ();
1008 994
1009 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 995 record_unwind_protect (save_excursion_restore, save_excursion_save ());
1014 1000
1015 DEFUN ("save-current-buffer", Fsave_current_buffer, Ssave_current_buffer, 0, UNEVALLED, 0, 1001 DEFUN ("save-current-buffer", Fsave_current_buffer, Ssave_current_buffer, 0, UNEVALLED, 0,
1016 doc: /* Save the current buffer; execute BODY; restore the current buffer. 1002 doc: /* Save the current buffer; execute BODY; restore the current buffer.
1017 Executes BODY just like `progn'. 1003 Executes BODY just like `progn'.
1018 usage: (save-current-buffer &rest BODY) */) 1004 usage: (save-current-buffer &rest BODY) */)
1019 (args) 1005 (Lisp_Object args)
1020 Lisp_Object args;
1021 { 1006 {
1022 Lisp_Object val; 1007 Lisp_Object val;
1023 int count = SPECPDL_INDEX (); 1008 int count = SPECPDL_INDEX ();
1024 1009
1025 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); 1010 record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
1029 } 1014 }
1030 1015
1031 DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0, 1016 DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0,
1032 doc: /* Return the number of characters in the current buffer. 1017 doc: /* Return the number of characters in the current buffer.
1033 If BUFFER, return the number of characters in that buffer instead. */) 1018 If BUFFER, return the number of characters in that buffer instead. */)
1034 (buffer) 1019 (Lisp_Object buffer)
1035 Lisp_Object buffer;
1036 { 1020 {
1037 if (NILP (buffer)) 1021 if (NILP (buffer))
1038 return make_number (Z - BEG); 1022 return make_number (Z - BEG);
1039 else 1023 else
1040 { 1024 {
1045 } 1029 }
1046 1030
1047 DEFUN ("point-min", Fpoint_min, Spoint_min, 0, 0, 0, 1031 DEFUN ("point-min", Fpoint_min, Spoint_min, 0, 0, 0,
1048 doc: /* Return the minimum permissible value of point in the current buffer. 1032 doc: /* Return the minimum permissible value of point in the current buffer.
1049 This is 1, unless narrowing (a buffer restriction) is in effect. */) 1033 This is 1, unless narrowing (a buffer restriction) is in effect. */)
1050 () 1034 (void)
1051 { 1035 {
1052 Lisp_Object temp; 1036 Lisp_Object temp;
1053 XSETFASTINT (temp, BEGV); 1037 XSETFASTINT (temp, BEGV);
1054 return temp; 1038 return temp;
1055 } 1039 }
1056 1040
1057 DEFUN ("point-min-marker", Fpoint_min_marker, Spoint_min_marker, 0, 0, 0, 1041 DEFUN ("point-min-marker", Fpoint_min_marker, Spoint_min_marker, 0, 0, 0,
1058 doc: /* Return a marker to the minimum permissible value of point in this buffer. 1042 doc: /* Return a marker to the minimum permissible value of point in this buffer.
1059 This is the beginning, unless narrowing (a buffer restriction) is in effect. */) 1043 This is the beginning, unless narrowing (a buffer restriction) is in effect. */)
1060 () 1044 (void)
1061 { 1045 {
1062 return buildmark (BEGV, BEGV_BYTE); 1046 return buildmark (BEGV, BEGV_BYTE);
1063 } 1047 }
1064 1048
1065 DEFUN ("point-max", Fpoint_max, Spoint_max, 0, 0, 0, 1049 DEFUN ("point-max", Fpoint_max, Spoint_max, 0, 0, 0,
1066 doc: /* Return the maximum permissible value of point in the current buffer. 1050 doc: /* Return the maximum permissible value of point in the current buffer.
1067 This is (1+ (buffer-size)), unless narrowing (a buffer restriction) 1051 This is (1+ (buffer-size)), unless narrowing (a buffer restriction)
1068 is in effect, in which case it is less. */) 1052 is in effect, in which case it is less. */)
1069 () 1053 (void)
1070 { 1054 {
1071 Lisp_Object temp; 1055 Lisp_Object temp;
1072 XSETFASTINT (temp, ZV); 1056 XSETFASTINT (temp, ZV);
1073 return temp; 1057 return temp;
1074 } 1058 }
1075 1059
1076 DEFUN ("point-max-marker", Fpoint_max_marker, Spoint_max_marker, 0, 0, 0, 1060 DEFUN ("point-max-marker", Fpoint_max_marker, Spoint_max_marker, 0, 0, 0,
1077 doc: /* Return a marker to the maximum permissible value of point in this buffer. 1061 doc: /* Return a marker to the maximum permissible value of point in this buffer.
1078 This is (1+ (buffer-size)), unless narrowing (a buffer restriction) 1062 This is (1+ (buffer-size)), unless narrowing (a buffer restriction)
1079 is in effect, in which case it is less. */) 1063 is in effect, in which case it is less. */)
1080 () 1064 (void)
1081 { 1065 {
1082 return buildmark (ZV, ZV_BYTE); 1066 return buildmark (ZV, ZV_BYTE);
1083 } 1067 }
1084 1068
1085 DEFUN ("gap-position", Fgap_position, Sgap_position, 0, 0, 0, 1069 DEFUN ("gap-position", Fgap_position, Sgap_position, 0, 0, 0,
1086 doc: /* Return the position of the gap, in the current buffer. 1070 doc: /* Return the position of the gap, in the current buffer.
1087 See also `gap-size'. */) 1071 See also `gap-size'. */)
1088 () 1072 (void)
1089 { 1073 {
1090 Lisp_Object temp; 1074 Lisp_Object temp;
1091 XSETFASTINT (temp, GPT); 1075 XSETFASTINT (temp, GPT);
1092 return temp; 1076 return temp;
1093 } 1077 }
1094 1078
1095 DEFUN ("gap-size", Fgap_size, Sgap_size, 0, 0, 0, 1079 DEFUN ("gap-size", Fgap_size, Sgap_size, 0, 0, 0,
1096 doc: /* Return the size of the current buffer's gap. 1080 doc: /* Return the size of the current buffer's gap.
1097 See also `gap-position'. */) 1081 See also `gap-position'. */)
1098 () 1082 (void)
1099 { 1083 {
1100 Lisp_Object temp; 1084 Lisp_Object temp;
1101 XSETFASTINT (temp, GAP_SIZE); 1085 XSETFASTINT (temp, GAP_SIZE);
1102 return temp; 1086 return temp;
1103 } 1087 }
1104 1088
1105 DEFUN ("position-bytes", Fposition_bytes, Sposition_bytes, 1, 1, 0, 1089 DEFUN ("position-bytes", Fposition_bytes, Sposition_bytes, 1, 1, 0,
1106 doc: /* Return the byte position for character position POSITION. 1090 doc: /* Return the byte position for character position POSITION.
1107 If POSITION is out of range, the value is nil. */) 1091 If POSITION is out of range, the value is nil. */)
1108 (position) 1092 (Lisp_Object position)
1109 Lisp_Object position;
1110 { 1093 {
1111 CHECK_NUMBER_COERCE_MARKER (position); 1094 CHECK_NUMBER_COERCE_MARKER (position);
1112 if (XINT (position) < BEG || XINT (position) > Z) 1095 if (XINT (position) < BEG || XINT (position) > Z)
1113 return Qnil; 1096 return Qnil;
1114 return make_number (CHAR_TO_BYTE (XINT (position))); 1097 return make_number (CHAR_TO_BYTE (XINT (position)));
1115 } 1098 }
1116 1099
1117 DEFUN ("byte-to-position", Fbyte_to_position, Sbyte_to_position, 1, 1, 0, 1100 DEFUN ("byte-to-position", Fbyte_to_position, Sbyte_to_position, 1, 1, 0,
1118 doc: /* Return the character position for byte position BYTEPOS. 1101 doc: /* Return the character position for byte position BYTEPOS.
1119 If BYTEPOS is out of range, the value is nil. */) 1102 If BYTEPOS is out of range, the value is nil. */)
1120 (bytepos) 1103 (Lisp_Object bytepos)
1121 Lisp_Object bytepos;
1122 { 1104 {
1123 CHECK_NUMBER (bytepos); 1105 CHECK_NUMBER (bytepos);
1124 if (XINT (bytepos) < BEG_BYTE || XINT (bytepos) > Z_BYTE) 1106 if (XINT (bytepos) < BEG_BYTE || XINT (bytepos) > Z_BYTE)
1125 return Qnil; 1107 return Qnil;
1126 return make_number (BYTE_TO_CHAR (XINT (bytepos))); 1108 return make_number (BYTE_TO_CHAR (XINT (bytepos)));
1127 } 1109 }
1128 1110
1129 DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0, 1111 DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0,
1130 doc: /* Return the character following point, as a number. 1112 doc: /* Return the character following point, as a number.
1131 At the end of the buffer or accessible region, return 0. */) 1113 At the end of the buffer or accessible region, return 0. */)
1132 () 1114 (void)
1133 { 1115 {
1134 Lisp_Object temp; 1116 Lisp_Object temp;
1135 if (PT >= ZV) 1117 if (PT >= ZV)
1136 XSETFASTINT (temp, 0); 1118 XSETFASTINT (temp, 0);
1137 else 1119 else
1140 } 1122 }
1141 1123
1142 DEFUN ("preceding-char", Fprevious_char, Sprevious_char, 0, 0, 0, 1124 DEFUN ("preceding-char", Fprevious_char, Sprevious_char, 0, 0, 0,
1143 doc: /* Return the character preceding point, as a number. 1125 doc: /* Return the character preceding point, as a number.
1144 At the beginning of the buffer or accessible region, return 0. */) 1126 At the beginning of the buffer or accessible region, return 0. */)
1145 () 1127 (void)
1146 { 1128 {
1147 Lisp_Object temp; 1129 Lisp_Object temp;
1148 if (PT <= BEGV) 1130 if (PT <= BEGV)
1149 XSETFASTINT (temp, 0); 1131 XSETFASTINT (temp, 0);
1150 else if (!NILP (current_buffer->enable_multibyte_characters)) 1132 else if (!NILP (current_buffer->enable_multibyte_characters))
1159 } 1141 }
1160 1142
1161 DEFUN ("bobp", Fbobp, Sbobp, 0, 0, 0, 1143 DEFUN ("bobp", Fbobp, Sbobp, 0, 0, 0,
1162 doc: /* Return t if point is at the beginning of the buffer. 1144 doc: /* Return t if point is at the beginning of the buffer.
1163 If the buffer is narrowed, this means the beginning of the narrowed part. */) 1145 If the buffer is narrowed, this means the beginning of the narrowed part. */)
1164 () 1146 (void)
1165 { 1147 {
1166 if (PT == BEGV) 1148 if (PT == BEGV)
1167 return Qt; 1149 return Qt;
1168 return Qnil; 1150 return Qnil;
1169 } 1151 }
1170 1152
1171 DEFUN ("eobp", Feobp, Seobp, 0, 0, 0, 1153 DEFUN ("eobp", Feobp, Seobp, 0, 0, 0,
1172 doc: /* Return t if point is at the end of the buffer. 1154 doc: /* Return t if point is at the end of the buffer.
1173 If the buffer is narrowed, this means the end of the narrowed part. */) 1155 If the buffer is narrowed, this means the end of the narrowed part. */)
1174 () 1156 (void)
1175 { 1157 {
1176 if (PT == ZV) 1158 if (PT == ZV)
1177 return Qt; 1159 return Qt;
1178 return Qnil; 1160 return Qnil;
1179 } 1161 }
1180 1162
1181 DEFUN ("bolp", Fbolp, Sbolp, 0, 0, 0, 1163 DEFUN ("bolp", Fbolp, Sbolp, 0, 0, 0,
1182 doc: /* Return t if point is at the beginning of a line. */) 1164 doc: /* Return t if point is at the beginning of a line. */)
1183 () 1165 (void)
1184 { 1166 {
1185 if (PT == BEGV || FETCH_BYTE (PT_BYTE - 1) == '\n') 1167 if (PT == BEGV || FETCH_BYTE (PT_BYTE - 1) == '\n')
1186 return Qt; 1168 return Qt;
1187 return Qnil; 1169 return Qnil;
1188 } 1170 }
1189 1171
1190 DEFUN ("eolp", Feolp, Seolp, 0, 0, 0, 1172 DEFUN ("eolp", Feolp, Seolp, 0, 0, 0,
1191 doc: /* Return t if point is at the end of a line. 1173 doc: /* Return t if point is at the end of a line.
1192 `End of a line' includes point being at the end of the buffer. */) 1174 `End of a line' includes point being at the end of the buffer. */)
1193 () 1175 (void)
1194 { 1176 {
1195 if (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n') 1177 if (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n')
1196 return Qt; 1178 return Qt;
1197 return Qnil; 1179 return Qnil;
1198 } 1180 }
1199 1181
1200 DEFUN ("char-after", Fchar_after, Schar_after, 0, 1, 0, 1182 DEFUN ("char-after", Fchar_after, Schar_after, 0, 1, 0,
1201 doc: /* Return character in current buffer at position POS. 1183 doc: /* Return character in current buffer at position POS.
1202 POS is an integer or a marker and defaults to point. 1184 POS is an integer or a marker and defaults to point.
1203 If POS is out of range, the value is nil. */) 1185 If POS is out of range, the value is nil. */)
1204 (pos) 1186 (Lisp_Object pos)
1205 Lisp_Object pos;
1206 { 1187 {
1207 register int pos_byte; 1188 register int pos_byte;
1208 1189
1209 if (NILP (pos)) 1190 if (NILP (pos))
1210 { 1191 {
1232 1213
1233 DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0, 1214 DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0,
1234 doc: /* Return character in current buffer preceding position POS. 1215 doc: /* Return character in current buffer preceding position POS.
1235 POS is an integer or a marker and defaults to point. 1216 POS is an integer or a marker and defaults to point.
1236 If POS is out of range, the value is nil. */) 1217 If POS is out of range, the value is nil. */)
1237 (pos) 1218 (Lisp_Object pos)
1238 Lisp_Object pos;
1239 { 1219 {
1240 register Lisp_Object val; 1220 register Lisp_Object val;
1241 register int pos_byte; 1221 register int pos_byte;
1242 1222
1243 if (NILP (pos)) 1223 if (NILP (pos))
1282 Also, if the environment variables LOGNAME or USER are set, 1262 Also, if the environment variables LOGNAME or USER are set,
1283 that determines the value of this function. 1263 that determines the value of this function.
1284 1264
1285 If optional argument UID is an integer or a float, return the login name 1265 If optional argument UID is an integer or a float, return the login name
1286 of the user with that uid, or nil if there is no such user. */) 1266 of the user with that uid, or nil if there is no such user. */)
1287 (uid) 1267 (Lisp_Object uid)
1288 Lisp_Object uid;
1289 { 1268 {
1290 struct passwd *pw; 1269 struct passwd *pw;
1291 uid_t id; 1270 uid_t id;
1292 1271
1293 /* Set up the user name info if we didn't do it before. 1272 /* Set up the user name info if we didn't do it before.
1309 DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name, 1288 DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name,
1310 0, 0, 0, 1289 0, 0, 0,
1311 doc: /* Return the name of the user's real uid, as a string. 1290 doc: /* Return the name of the user's real uid, as a string.
1312 This ignores the environment variables LOGNAME and USER, so it differs from 1291 This ignores the environment variables LOGNAME and USER, so it differs from
1313 `user-login-name' when running under `su'. */) 1292 `user-login-name' when running under `su'. */)
1314 () 1293 (void)
1315 { 1294 {
1316 /* Set up the user name info if we didn't do it before. 1295 /* Set up the user name info if we didn't do it before.
1317 (That can happen if Emacs is dumpable 1296 (That can happen if Emacs is dumpable
1318 but you decide to run `temacs -l loadup' and not dump. */ 1297 but you decide to run `temacs -l loadup' and not dump. */
1319 if (INTEGERP (Vuser_login_name)) 1298 if (INTEGERP (Vuser_login_name))
1322 } 1301 }
1323 1302
1324 DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0, 1303 DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0,
1325 doc: /* Return the effective uid of Emacs. 1304 doc: /* Return the effective uid of Emacs.
1326 Value is an integer or a float, depending on the value. */) 1305 Value is an integer or a float, depending on the value. */)
1327 () 1306 (void)
1328 { 1307 {
1329 /* Assignment to EMACS_INT stops GCC whining about limited range of 1308 /* Assignment to EMACS_INT stops GCC whining about limited range of
1330 data type. */ 1309 data type. */
1331 EMACS_INT euid = geteuid (); 1310 EMACS_INT euid = geteuid ();
1332 1311
1338 } 1317 }
1339 1318
1340 DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0, 1319 DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0,
1341 doc: /* Return the real uid of Emacs. 1320 doc: /* Return the real uid of Emacs.
1342 Value is an integer or a float, depending on the value. */) 1321 Value is an integer or a float, depending on the value. */)
1343 () 1322 (void)
1344 { 1323 {
1345 /* Assignment to EMACS_INT stops GCC whining about limited range of 1324 /* Assignment to EMACS_INT stops GCC whining about limited range of
1346 data type. */ 1325 data type. */
1347 EMACS_INT uid = getuid (); 1326 EMACS_INT uid = getuid ();
1348 1327
1360 1339
1361 If optional argument UID is an integer or float, return the full name 1340 If optional argument UID is an integer or float, return the full name
1362 of the user with that uid, or nil if there is no such user. 1341 of the user with that uid, or nil if there is no such user.
1363 If UID is a string, return the full name of the user with that login 1342 If UID is a string, return the full name of the user with that login
1364 name, or nil if there is no such user. */) 1343 name, or nil if there is no such user. */)
1365 (uid) 1344 (Lisp_Object uid)
1366 Lisp_Object uid;
1367 { 1345 {
1368 struct passwd *pw; 1346 struct passwd *pw;
1369 register unsigned char *p, *q; 1347 register unsigned char *p, *q;
1370 Lisp_Object full; 1348 Lisp_Object full;
1371 1349
1417 return full; 1395 return full;
1418 } 1396 }
1419 1397
1420 DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, 1398 DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0,
1421 doc: /* Return the host name of the machine you are running on, as a string. */) 1399 doc: /* Return the host name of the machine you are running on, as a string. */)
1422 () 1400 (void)
1423 { 1401 {
1424 return Vsystem_name; 1402 return Vsystem_name;
1425 } 1403 }
1426 1404
1427 /* For the benefit of callers who don't want to include lisp.h */ 1405 /* For the benefit of callers who don't want to include lisp.h */
1444 return ""; 1422 return "";
1445 } 1423 }
1446 1424
1447 DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, 1425 DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
1448 doc: /* Return the process ID of Emacs, as an integer. */) 1426 doc: /* Return the process ID of Emacs, as an integer. */)
1449 () 1427 (void)
1450 { 1428 {
1451 return make_number (getpid ()); 1429 return make_number (getpid ());
1452 } 1430 }
1453 1431
1454 DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0, 1432 DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0,
1458 least significant 16 bits. The third integer gives the microsecond 1436 least significant 16 bits. The third integer gives the microsecond
1459 count. 1437 count.
1460 1438
1461 The microsecond count is zero on systems that do not provide 1439 The microsecond count is zero on systems that do not provide
1462 resolution finer than a second. */) 1440 resolution finer than a second. */)
1463 () 1441 (void)
1464 { 1442 {
1465 EMACS_TIME t; 1443 EMACS_TIME t;
1466 1444
1467 EMACS_GET_TIME (t); 1445 EMACS_GET_TIME (t);
1468 return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff), 1446 return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff),
1479 count. 1457 count.
1480 1458
1481 On systems that can't determine the run time, `get-internal-run-time' 1459 On systems that can't determine the run time, `get-internal-run-time'
1482 does the same thing as `current-time'. The microsecond count is zero 1460 does the same thing as `current-time'. The microsecond count is zero
1483 on systems that do not provide resolution finer than a second. */) 1461 on systems that do not provide resolution finer than a second. */)
1484 () 1462 (void)
1485 { 1463 {
1486 #ifdef HAVE_GETRUSAGE 1464 #ifdef HAVE_GETRUSAGE
1487 struct rusage usage; 1465 struct rusage usage;
1488 int secs, usecs; 1466 int secs, usecs;
1489 1467
1570 have the form (HIGH . LOW), but this is considered obsolete. 1548 have the form (HIGH . LOW), but this is considered obsolete.
1571 1549
1572 WARNING: Since the result is floating point, it may not be exact. 1550 WARNING: Since the result is floating point, it may not be exact.
1573 If precise time stamps are required, use either `current-time', 1551 If precise time stamps are required, use either `current-time',
1574 or (if you need time as a string) `format-time-string'. */) 1552 or (if you need time as a string) `format-time-string'. */)
1575 (specified_time) 1553 (Lisp_Object specified_time)
1576 Lisp_Object specified_time;
1577 { 1554 {
1578 time_t sec; 1555 time_t sec;
1579 int usec; 1556 int usec;
1580 1557
1581 if (! lisp_time_argument (specified_time, &sec, &usec)) 1558 if (! lisp_time_argument (specified_time, &sec, &usec))
1681 The modifiers are `E' and `O'. For certain characters X, 1658 The modifiers are `E' and `O'. For certain characters X,
1682 %EX is a locale's alternative version of %X; 1659 %EX is a locale's alternative version of %X;
1683 %OX is like %X, but uses the locale's number symbols. 1660 %OX is like %X, but uses the locale's number symbols.
1684 1661
1685 For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) 1662 For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */)
1686 (format_string, time, universal) 1663 (Lisp_Object format_string, Lisp_Object time, Lisp_Object universal)
1687 Lisp_Object format_string, time, universal;
1688 { 1664 {
1689 time_t value; 1665 time_t value;
1690 int size; 1666 int size;
1691 struct tm *tm; 1667 struct tm *tm;
1692 int ut = ! NILP (universal); 1668 int ut = ! NILP (universal);
1749 four-digit year. DOW is the day of week, an integer between 0 and 6, 1725 four-digit year. DOW is the day of week, an integer between 0 and 6,
1750 where 0 is Sunday. DST is t if daylight saving time is in effect, 1726 where 0 is Sunday. DST is t if daylight saving time is in effect,
1751 otherwise nil. ZONE is an integer indicating the number of seconds 1727 otherwise nil. ZONE is an integer indicating the number of seconds
1752 east of Greenwich. (Note that Common Lisp has different meanings for 1728 east of Greenwich. (Note that Common Lisp has different meanings for
1753 DOW and ZONE.) */) 1729 DOW and ZONE.) */)
1754 (specified_time) 1730 (Lisp_Object specified_time)
1755 Lisp_Object specified_time;
1756 { 1731 {
1757 time_t time_spec; 1732 time_t time_spec;
1758 struct tm save_tm; 1733 struct tm save_tm;
1759 struct tm *decoded_time; 1734 struct tm *decoded_time;
1760 Lisp_Object list_args[9]; 1735 Lisp_Object list_args[9];
1810 1785
1811 Years before 1970 are not guaranteed to work. On some systems, 1786 Years before 1970 are not guaranteed to work. On some systems,
1812 year values as low as 1901 do work. 1787 year values as low as 1901 do work.
1813 1788
1814 usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) 1789 usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1815 (nargs, args) 1790 (int nargs, register Lisp_Object *args)
1816 int nargs;
1817 register Lisp_Object *args;
1818 { 1791 {
1819 time_t time; 1792 time_t time;
1820 struct tm tm; 1793 struct tm tm;
1821 Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); 1794 Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil);
1822 1795
1898 If SPECIFIED-TIME is given, it is a time to format instead of the 1871 If SPECIFIED-TIME is given, it is a time to format instead of the
1899 current time. The argument should have the form (HIGH LOW . IGNORED). 1872 current time. The argument should have the form (HIGH LOW . IGNORED).
1900 Thus, you can use times obtained from `current-time' and from 1873 Thus, you can use times obtained from `current-time' and from
1901 `file-attributes'. SPECIFIED-TIME can also have the form (HIGH . LOW), 1874 `file-attributes'. SPECIFIED-TIME can also have the form (HIGH . LOW),
1902 but this is considered obsolete. */) 1875 but this is considered obsolete. */)
1903 (specified_time) 1876 (Lisp_Object specified_time)
1904 Lisp_Object specified_time;
1905 { 1877 {
1906 time_t value; 1878 time_t value;
1907 struct tm *tm; 1879 struct tm *tm;
1908 register char *tem; 1880 register char *tem;
1909 1881
1961 have the form (HIGH . LOW), but this is considered obsolete. 1933 have the form (HIGH . LOW), but this is considered obsolete.
1962 1934
1963 Some operating systems cannot provide all this information to Emacs; 1935 Some operating systems cannot provide all this information to Emacs;
1964 in this case, `current-time-zone' returns a list containing nil for 1936 in this case, `current-time-zone' returns a list containing nil for
1965 the data it can't find. */) 1937 the data it can't find. */)
1966 (specified_time) 1938 (Lisp_Object specified_time)
1967 Lisp_Object specified_time;
1968 { 1939 {
1969 time_t value; 1940 time_t value;
1970 struct tm *t; 1941 struct tm *t;
1971 struct tm gmt; 1942 struct tm gmt;
1972 1943
2026 1997
2027 DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0, 1998 DEFUN ("set-time-zone-rule", Fset_time_zone_rule, Sset_time_zone_rule, 1, 1, 0,
2028 doc: /* Set the local time zone using TZ, a string specifying a time zone rule. 1999 doc: /* Set the local time zone using TZ, a string specifying a time zone rule.
2029 If TZ is nil, use implementation-defined default time zone information. 2000 If TZ is nil, use implementation-defined default time zone information.
2030 If TZ is t, use Universal Time. */) 2001 If TZ is t, use Universal Time. */)
2031 (tz) 2002 (Lisp_Object tz)
2032 Lisp_Object tz;
2033 { 2003 {
2034 char *tzstring; 2004 char *tzstring;
2035 2005
2036 /* When called for the first time, save the original TZ. */ 2006 /* When called for the first time, save the original TZ. */
2037 if (!environbuf) 2007 if (!environbuf)
2223 original bytes of a unibyte string when inserting it into a multibyte 2193 original bytes of a unibyte string when inserting it into a multibyte
2224 buffer; to accomplish this, apply `string-as-multibyte' to the string 2194 buffer; to accomplish this, apply `string-as-multibyte' to the string
2225 and insert the result. 2195 and insert the result.
2226 2196
2227 usage: (insert &rest ARGS) */) 2197 usage: (insert &rest ARGS) */)
2228 (nargs, args) 2198 (int nargs, register Lisp_Object *args)
2229 int nargs;
2230 register Lisp_Object *args;
2231 { 2199 {
2232 general_insert_function (insert, insert_from_string, 0, nargs, args); 2200 general_insert_function (insert, insert_from_string, 0, nargs, args);
2233 return Qnil; 2201 return Qnil;
2234 } 2202 }
2235 2203
2244 to multibyte for insertion (see `unibyte-char-to-multibyte'). 2212 to multibyte for insertion (see `unibyte-char-to-multibyte').
2245 If the current buffer is unibyte, multibyte strings are converted 2213 If the current buffer is unibyte, multibyte strings are converted
2246 to unibyte for insertion. 2214 to unibyte for insertion.
2247 2215
2248 usage: (insert-and-inherit &rest ARGS) */) 2216 usage: (insert-and-inherit &rest ARGS) */)
2249 (nargs, args) 2217 (int nargs, register Lisp_Object *args)
2250 int nargs;
2251 register Lisp_Object *args;
2252 { 2218 {
2253 general_insert_function (insert_and_inherit, insert_from_string, 1, 2219 general_insert_function (insert_and_inherit, insert_from_string, 1,
2254 nargs, args); 2220 nargs, args);
2255 return Qnil; 2221 return Qnil;
2256 } 2222 }
2263 to multibyte for insertion (see `unibyte-char-to-multibyte'). 2229 to multibyte for insertion (see `unibyte-char-to-multibyte').
2264 If the current buffer is unibyte, multibyte strings are converted 2230 If the current buffer is unibyte, multibyte strings are converted
2265 to unibyte for insertion. 2231 to unibyte for insertion.
2266 2232
2267 usage: (insert-before-markers &rest ARGS) */) 2233 usage: (insert-before-markers &rest ARGS) */)
2268 (nargs, args) 2234 (int nargs, register Lisp_Object *args)
2269 int nargs;
2270 register Lisp_Object *args;
2271 { 2235 {
2272 general_insert_function (insert_before_markers, 2236 general_insert_function (insert_before_markers,
2273 insert_from_string_before_markers, 0, 2237 insert_from_string_before_markers, 0,
2274 nargs, args); 2238 nargs, args);
2275 return Qnil; 2239 return Qnil;
2284 to multibyte for insertion (see `unibyte-char-to-multibyte'). 2248 to multibyte for insertion (see `unibyte-char-to-multibyte').
2285 If the current buffer is unibyte, multibyte strings are converted 2249 If the current buffer is unibyte, multibyte strings are converted
2286 to unibyte for insertion. 2250 to unibyte for insertion.
2287 2251
2288 usage: (insert-before-markers-and-inherit &rest ARGS) */) 2252 usage: (insert-before-markers-and-inherit &rest ARGS) */)
2289 (nargs, args) 2253 (int nargs, register Lisp_Object *args)
2290 int nargs;
2291 register Lisp_Object *args;
2292 { 2254 {
2293 general_insert_function (insert_before_markers_and_inherit, 2255 general_insert_function (insert_before_markers_and_inherit,
2294 insert_from_string_before_markers, 1, 2256 insert_from_string_before_markers, 1,
2295 nargs, args); 2257 nargs, args);
2296 return Qnil; 2258 return Qnil;
2299 DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0, 2261 DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0,
2300 doc: /* Insert COUNT copies of CHARACTER. 2262 doc: /* Insert COUNT copies of CHARACTER.
2301 Point, and before-insertion markers, are relocated as in the function `insert'. 2263 Point, and before-insertion markers, are relocated as in the function `insert'.
2302 The optional third arg INHERIT, if non-nil, says to inherit text properties 2264 The optional third arg INHERIT, if non-nil, says to inherit text properties
2303 from adjoining text, if those properties are sticky. */) 2265 from adjoining text, if those properties are sticky. */)
2304 (character, count, inherit) 2266 (Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
2305 Lisp_Object character, count, inherit;
2306 { 2267 {
2307 register unsigned char *string; 2268 register unsigned char *string;
2308 register int strlen; 2269 register int strlen;
2309 register int i, n; 2270 register int i, n;
2310 int len; 2271 int len;
2352 corresponding eight-bit character is inserted. 2313 corresponding eight-bit character is inserted.
2353 2314
2354 Point, and before-insertion markers, are relocated as in the function `insert'. 2315 Point, and before-insertion markers, are relocated as in the function `insert'.
2355 The optional third arg INHERIT, if non-nil, says to inherit text properties 2316 The optional third arg INHERIT, if non-nil, says to inherit text properties
2356 from adjoining text, if those properties are sticky. */) 2317 from adjoining text, if those properties are sticky. */)
2357 (byte, count, inherit) 2318 (Lisp_Object byte, Lisp_Object count, Lisp_Object inherit)
2358 Lisp_Object byte, count, inherit;
2359 { 2319 {
2360 CHECK_NUMBER (byte); 2320 CHECK_NUMBER (byte);
2361 if (XINT (byte) < 0 || XINT (byte) > 255) 2321 if (XINT (byte) < 0 || XINT (byte) > 255)
2362 args_out_of_range_3 (byte, make_number (0), make_number (255)); 2322 args_out_of_range_3 (byte, make_number (0), make_number (255));
2363 if (XINT (byte) >= 128 2323 if (XINT (byte) >= 128
2475 The string returned is multibyte if the buffer is multibyte. 2435 The string returned is multibyte if the buffer is multibyte.
2476 2436
2477 This function copies the text properties of that part of the buffer 2437 This function copies the text properties of that part of the buffer
2478 into the result string; if you don't want the text properties, 2438 into the result string; if you don't want the text properties,
2479 use `buffer-substring-no-properties' instead. */) 2439 use `buffer-substring-no-properties' instead. */)
2480 (start, end) 2440 (Lisp_Object start, Lisp_Object end)
2481 Lisp_Object start, end;
2482 { 2441 {
2483 register int b, e; 2442 register int b, e;
2484 2443
2485 validate_region (&start, &end); 2444 validate_region (&start, &end);
2486 b = XINT (start); 2445 b = XINT (start);
2492 DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties, 2451 DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties,
2493 Sbuffer_substring_no_properties, 2, 2, 0, 2452 Sbuffer_substring_no_properties, 2, 2, 0,
2494 doc: /* Return the characters of part of the buffer, without the text properties. 2453 doc: /* Return the characters of part of the buffer, without the text properties.
2495 The two arguments START and END are character positions; 2454 The two arguments START and END are character positions;
2496 they can be in either order. */) 2455 they can be in either order. */)
2497 (start, end) 2456 (Lisp_Object start, Lisp_Object end)
2498 Lisp_Object start, end;
2499 { 2457 {
2500 register int b, e; 2458 register int b, e;
2501 2459
2502 validate_region (&start, &end); 2460 validate_region (&start, &end);
2503 b = XINT (start); 2461 b = XINT (start);
2508 2466
2509 DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0, 2467 DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0,
2510 doc: /* Return the contents of the current buffer as a string. 2468 doc: /* Return the contents of the current buffer as a string.
2511 If narrowing is in effect, this function returns only the visible part 2469 If narrowing is in effect, this function returns only the visible part
2512 of the buffer. */) 2470 of the buffer. */)
2513 () 2471 (void)
2514 { 2472 {
2515 return make_buffer_string (BEGV, ZV, 1); 2473 return make_buffer_string (BEGV, ZV, 1);
2516 } 2474 }
2517 2475
2518 DEFUN ("insert-buffer-substring", Finsert_buffer_substring, Sinsert_buffer_substring, 2476 DEFUN ("insert-buffer-substring", Finsert_buffer_substring, Sinsert_buffer_substring,
2519 1, 3, 0, 2477 1, 3, 0,
2520 doc: /* Insert before point a substring of the contents of BUFFER. 2478 doc: /* Insert before point a substring of the contents of BUFFER.
2521 BUFFER may be a buffer or a buffer name. 2479 BUFFER may be a buffer or a buffer name.
2522 Arguments START and END are character positions specifying the substring. 2480 Arguments START and END are character positions specifying the substring.
2523 They default to the values of (point-min) and (point-max) in BUFFER. */) 2481 They default to the values of (point-min) and (point-max) in BUFFER. */)
2524 (buffer, start, end) 2482 (Lisp_Object buffer, Lisp_Object start, Lisp_Object end)
2525 Lisp_Object buffer, start, end;
2526 { 2483 {
2527 register int b, e, temp; 2484 register int b, e, temp;
2528 register struct buffer *bp, *obuf; 2485 register struct buffer *bp, *obuf;
2529 Lisp_Object buf; 2486 Lisp_Object buf;
2530 2487
2573 Each substring is represented as three arguments: BUFFER, START and END. 2530 Each substring is represented as three arguments: BUFFER, START and END.
2574 That makes six args in all, three for each substring. 2531 That makes six args in all, three for each substring.
2575 2532
2576 The value of `case-fold-search' in the current buffer 2533 The value of `case-fold-search' in the current buffer
2577 determines whether case is significant or ignored. */) 2534 determines whether case is significant or ignored. */)
2578 (buffer1, start1, end1, buffer2, start2, end2) 2535 (Lisp_Object buffer1, Lisp_Object start1, Lisp_Object end1, Lisp_Object buffer2, Lisp_Object start2, Lisp_Object end2)
2579 Lisp_Object buffer1, start1, end1, buffer2, start2, end2;
2580 { 2536 {
2581 register int begp1, endp1, begp2, endp2, temp; 2537 register int begp1, endp1, begp2, endp2, temp;
2582 register struct buffer *bp1, *bp2; 2538 register struct buffer *bp1, *bp2;
2583 register Lisp_Object trt 2539 register Lisp_Object trt
2584 = (!NILP (current_buffer->case_fold_search) 2540 = (!NILP (current_buffer->case_fold_search)
2741 Ssubst_char_in_region, 4, 5, 0, 2697 Ssubst_char_in_region, 4, 5, 0,
2742 doc: /* From START to END, replace FROMCHAR with TOCHAR each time it occurs. 2698 doc: /* From START to END, replace FROMCHAR with TOCHAR each time it occurs.
2743 If optional arg NOUNDO is non-nil, don't record this change for undo 2699 If optional arg NOUNDO is non-nil, don't record this change for undo
2744 and don't mark the buffer as really changed. 2700 and don't mark the buffer as really changed.
2745 Both characters must have the same length of multi-byte form. */) 2701 Both characters must have the same length of multi-byte form. */)
2746 (start, end, fromchar, tochar, noundo) 2702 (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo)
2747 Lisp_Object start, end, fromchar, tochar, noundo;
2748 { 2703 {
2749 register int pos, pos_byte, stop, i, len, end_byte; 2704 register int pos, pos_byte, stop, i, len, end_byte;
2750 /* Keep track of the first change in the buffer: 2705 /* Keep track of the first change in the buffer:
2751 if 0 we haven't found it yet. 2706 if 0 we haven't found it yet.
2752 if < 0 we've found it and we've run the before-change-function. 2707 if < 0 we've found it and we've run the before-change-function.
2983 doc: /* Internal use only. 2938 doc: /* Internal use only.
2984 From START to END, translate characters according to TABLE. 2939 From START to END, translate characters according to TABLE.
2985 TABLE is a string or a char-table; the Nth character in it is the 2940 TABLE is a string or a char-table; the Nth character in it is the
2986 mapping for the character with code N. 2941 mapping for the character with code N.
2987 It returns the number of characters changed. */) 2942 It returns the number of characters changed. */)
2988 (start, end, table) 2943 (Lisp_Object start, Lisp_Object end, register Lisp_Object table)
2989 Lisp_Object start;
2990 Lisp_Object end;
2991 register Lisp_Object table;
2992 { 2944 {
2993 register unsigned char *tt; /* Trans table. */ 2945 register unsigned char *tt; /* Trans table. */
2994 register int nc; /* New character. */ 2946 register int nc; /* New character. */
2995 int cnt; /* Number of changes made. */ 2947 int cnt; /* Number of changes made. */
2996 int size; /* Size of translate table. */ 2948 int size; /* Size of translate table. */
3152 DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r", 3104 DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r",
3153 doc: /* Delete the text between point and mark. 3105 doc: /* Delete the text between point and mark.
3154 3106
3155 When called from a program, expects two arguments, 3107 When called from a program, expects two arguments,
3156 positions (integers or markers) specifying the stretch to be deleted. */) 3108 positions (integers or markers) specifying the stretch to be deleted. */)
3157 (start, end) 3109 (Lisp_Object start, Lisp_Object end)
3158 Lisp_Object start, end;
3159 { 3110 {
3160 validate_region (&start, &end); 3111 validate_region (&start, &end);
3161 del_range (XINT (start), XINT (end)); 3112 del_range (XINT (start), XINT (end));
3162 return Qnil; 3113 return Qnil;
3163 } 3114 }
3164 3115
3165 DEFUN ("delete-and-extract-region", Fdelete_and_extract_region, 3116 DEFUN ("delete-and-extract-region", Fdelete_and_extract_region,
3166 Sdelete_and_extract_region, 2, 2, 0, 3117 Sdelete_and_extract_region, 2, 2, 0,
3167 doc: /* Delete the text between START and END and return it. */) 3118 doc: /* Delete the text between START and END and return it. */)
3168 (start, end) 3119 (Lisp_Object start, Lisp_Object end)
3169 Lisp_Object start, end;
3170 { 3120 {
3171 validate_region (&start, &end); 3121 validate_region (&start, &end);
3172 if (XINT (start) == XINT (end)) 3122 if (XINT (start) == XINT (end))
3173 return empty_unibyte_string; 3123 return empty_unibyte_string;
3174 return del_range_1 (XINT (start), XINT (end), 1, 1); 3124 return del_range_1 (XINT (start), XINT (end), 1, 1);
3175 } 3125 }
3176 3126
3177 DEFUN ("widen", Fwiden, Swiden, 0, 0, "", 3127 DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
3178 doc: /* Remove restrictions (narrowing) from current buffer. 3128 doc: /* Remove restrictions (narrowing) from current buffer.
3179 This allows the buffer's full text to be seen and edited. */) 3129 This allows the buffer's full text to be seen and edited. */)
3180 () 3130 (void)
3181 { 3131 {
3182 if (BEG != BEGV || Z != ZV) 3132 if (BEG != BEGV || Z != ZV)
3183 current_buffer->clip_changed = 1; 3133 current_buffer->clip_changed = 1;
3184 BEGV = BEG; 3134 BEGV = BEG;
3185 BEGV_BYTE = BEG_BYTE; 3135 BEGV_BYTE = BEG_BYTE;
3196 text is included in the file. \\[widen] makes all visible again. 3146 text is included in the file. \\[widen] makes all visible again.
3197 See also `save-restriction'. 3147 See also `save-restriction'.
3198 3148
3199 When calling from a program, pass two arguments; positions (integers 3149 When calling from a program, pass two arguments; positions (integers
3200 or markers) bounding the text that should remain visible. */) 3150 or markers) bounding the text that should remain visible. */)
3201 (start, end) 3151 (register Lisp_Object start, Lisp_Object end)
3202 register Lisp_Object start, end;
3203 { 3152 {
3204 CHECK_NUMBER_COERCE_MARKER (start); 3153 CHECK_NUMBER_COERCE_MARKER (start);
3205 CHECK_NUMBER_COERCE_MARKER (end); 3154 CHECK_NUMBER_COERCE_MARKER (end);
3206 3155
3207 if (XINT (start) > XINT (end)) 3156 if (XINT (start) > XINT (end))
3330 Note: if you are using both `save-excursion' and `save-restriction', 3279 Note: if you are using both `save-excursion' and `save-restriction',
3331 use `save-excursion' outermost: 3280 use `save-excursion' outermost:
3332 (save-excursion (save-restriction ...)) 3281 (save-excursion (save-restriction ...))
3333 3282
3334 usage: (save-restriction &rest BODY) */) 3283 usage: (save-restriction &rest BODY) */)
3335 (body) 3284 (Lisp_Object body)
3336 Lisp_Object body;
3337 { 3285 {
3338 register Lisp_Object val; 3286 register Lisp_Object val;
3339 int count = SPECPDL_INDEX (); 3287 int count = SPECPDL_INDEX ();
3340 3288
3341 record_unwind_protect (save_restriction_restore, save_restriction_save ()); 3289 record_unwind_protect (save_restriction_restore, save_restriction_save ());
3364 If the first argument is nil or the empty string, the function clears 3312 If the first argument is nil or the empty string, the function clears
3365 any existing message; this lets the minibuffer contents show. See 3313 any existing message; this lets the minibuffer contents show. See
3366 also `current-message'. 3314 also `current-message'.
3367 3315
3368 usage: (message FORMAT-STRING &rest ARGS) */) 3316 usage: (message FORMAT-STRING &rest ARGS) */)
3369 (nargs, args) 3317 (int nargs, Lisp_Object *args)
3370 int nargs;
3371 Lisp_Object *args;
3372 { 3318 {
3373 if (NILP (args[0]) 3319 if (NILP (args[0])
3374 || (STRINGP (args[0]) 3320 || (STRINGP (args[0])
3375 && SBYTES (args[0]) == 0)) 3321 && SBYTES (args[0]) == 0))
3376 { 3322 {
3394 3340
3395 If the first argument is nil or the empty string, clear any existing 3341 If the first argument is nil or the empty string, clear any existing
3396 message; let the minibuffer contents show. 3342 message; let the minibuffer contents show.
3397 3343
3398 usage: (message-box FORMAT-STRING &rest ARGS) */) 3344 usage: (message-box FORMAT-STRING &rest ARGS) */)
3399 (nargs, args) 3345 (int nargs, Lisp_Object *args)
3400 int nargs;
3401 Lisp_Object *args;
3402 { 3346 {
3403 if (NILP (args[0])) 3347 if (NILP (args[0]))
3404 { 3348 {
3405 message (0); 3349 message (0);
3406 return Qnil; 3350 return Qnil;
3456 3400
3457 If the first argument is nil or the empty string, clear any existing 3401 If the first argument is nil or the empty string, clear any existing
3458 message; let the minibuffer contents show. 3402 message; let the minibuffer contents show.
3459 3403
3460 usage: (message-or-box FORMAT-STRING &rest ARGS) */) 3404 usage: (message-or-box FORMAT-STRING &rest ARGS) */)
3461 (nargs, args) 3405 (int nargs, Lisp_Object *args)
3462 int nargs;
3463 Lisp_Object *args;
3464 { 3406 {
3465 #ifdef HAVE_MENUS 3407 #ifdef HAVE_MENUS
3466 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) 3408 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
3467 && use_dialog_box) 3409 && use_dialog_box)
3468 return Fmessage_box (nargs, args); 3410 return Fmessage_box (nargs, args);
3470 return Fmessage (nargs, args); 3412 return Fmessage (nargs, args);
3471 } 3413 }
3472 3414
3473 DEFUN ("current-message", Fcurrent_message, Scurrent_message, 0, 0, 0, 3415 DEFUN ("current-message", Fcurrent_message, Scurrent_message, 0, 0, 0,
3474 doc: /* Return the string currently displayed in the echo area, or nil if none. */) 3416 doc: /* Return the string currently displayed in the echo area, or nil if none. */)
3475 () 3417 (void)
3476 { 3418 {
3477 return current_message (); 3419 return current_message ();
3478 } 3420 }
3479 3421
3480 3422
3482 doc: /* Return a copy of STRING with text properties added. 3424 doc: /* Return a copy of STRING with text properties added.
3483 First argument is the string to copy. 3425 First argument is the string to copy.
3484 Remaining arguments form a sequence of PROPERTY VALUE pairs for text 3426 Remaining arguments form a sequence of PROPERTY VALUE pairs for text
3485 properties to add to the result. 3427 properties to add to the result.
3486 usage: (propertize STRING &rest PROPERTIES) */) 3428 usage: (propertize STRING &rest PROPERTIES) */)
3487 (nargs, args) 3429 (int nargs, Lisp_Object *args)
3488 int nargs;
3489 Lisp_Object *args;
3490 { 3430 {
3491 Lisp_Object properties, string; 3431 Lisp_Object properties, string;
3492 struct gcpro gcpro1, gcpro2; 3432 struct gcpro gcpro1, gcpro2;
3493 int i; 3433 int i;
3494 3434
3566 precision specifier says how many decimal places to show; if zero, the 3506 precision specifier says how many decimal places to show; if zero, the
3567 decimal point itself is omitted. For %s and %S, the precision 3507 decimal point itself is omitted. For %s and %S, the precision
3568 specifier truncates the string to the given width. 3508 specifier truncates the string to the given width.
3569 3509
3570 usage: (format STRING &rest OBJECTS) */) 3510 usage: (format STRING &rest OBJECTS) */)
3571 (nargs, args) 3511 (int nargs, register Lisp_Object *args)
3572 int nargs;
3573 register Lisp_Object *args;
3574 { 3512 {
3575 register int n; /* The number of the next arg to substitute */ 3513 register int n; /* The number of the next arg to substitute */
3576 register int total; /* An estimate of the final length */ 3514 register int total; /* An estimate of the final length */
3577 char *buf, *p; 3515 char *buf, *p;
3578 register unsigned char *format, *end, *format_start; 3516 register unsigned char *format, *end, *format_start;
4184 4122
4185 DEFUN ("char-equal", Fchar_equal, Schar_equal, 2, 2, 0, 4123 DEFUN ("char-equal", Fchar_equal, Schar_equal, 2, 2, 0,
4186 doc: /* Return t if two characters match, optionally ignoring case. 4124 doc: /* Return t if two characters match, optionally ignoring case.
4187 Both arguments must be characters (i.e. integers). 4125 Both arguments must be characters (i.e. integers).
4188 Case is ignored if `case-fold-search' is non-nil in the current buffer. */) 4126 Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
4189 (c1, c2) 4127 (register Lisp_Object c1, Lisp_Object c2)
4190 register Lisp_Object c1, c2;
4191 { 4128 {
4192 int i1, i2; 4129 int i1, i2;
4193 /* Check they're chars, not just integers, otherwise we could get array 4130 /* Check they're chars, not just integers, otherwise we could get array
4194 bounds violations in DOWNCASE. */ 4131 bounds violations in DOWNCASE. */
4195 CHECK_CHARACTER (c1); 4132 CHECK_CHARACTER (c1);
4311 4248
4312 Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update 4249 Optional fifth arg LEAVE-MARKERS, if non-nil, means don't update
4313 any markers that happen to be located in the regions. 4250 any markers that happen to be located in the regions.
4314 4251
4315 Transposing beyond buffer boundaries is an error. */) 4252 Transposing beyond buffer boundaries is an error. */)
4316 (startr1, endr1, startr2, endr2, leave_markers) 4253 (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
4317 Lisp_Object startr1, endr1, startr2, endr2, leave_markers;
4318 { 4254 {
4319 register EMACS_INT start1, end1, start2, end2; 4255 register EMACS_INT start1, end1, start2, end2;
4320 EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte; 4256 EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte;
4321 EMACS_INT gap, len1, len_mid, len2; 4257 EMACS_INT gap, len1, len_mid, len2;
4322 unsigned char *start1_addr, *start2_addr, *temp; 4258 unsigned char *start1_addr, *start2_addr, *temp;