diff options
| author | Erik Naggum | 1996-01-09 00:31:34 +0000 |
|---|---|---|
| committer | Erik Naggum | 1996-01-09 00:31:34 +0000 |
| commit | 2591ec64b01cd43139aff0aebeb3406ef0e297c3 (patch) | |
| tree | 3e8ebea779f21e1a8f7086127aea6ddad4fd0fa8 /src | |
| parent | e20104ba13e0dca04263c873a7c12d481caa41fa (diff) | |
| download | emacs-2591ec64b01cd43139aff0aebeb3406ef0e297c3.tar.gz emacs-2591ec64b01cd43139aff0aebeb3406ef0e297c3.zip | |
(Fchar_to_string, Fstring_to_char, Fgoto_char, Fencode_time, Finsert_char,
Fbuffer_substring, Fbuffer_substring_no_properties,
Finsert_buffer_substring, Fdelete_region, Fnarrow_to_region): Harmonize
arguments with documentation. (Fformat_time_string): Allow TIME to default
to current time.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/src/editfns.c b/src/editfns.c index e115300e24b..4f72ed6da51 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -133,27 +133,27 @@ init_editfns () | |||
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, | 135 | DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, |
| 136 | "Convert arg CHAR to a one-character string containing that character.") | 136 | "Convert arg CHARACTER to a one-character string containing that character.") |
| 137 | (n) | 137 | (character) |
| 138 | Lisp_Object n; | 138 | Lisp_Object character; |
| 139 | { | 139 | { |
| 140 | char c; | 140 | char c; |
| 141 | CHECK_NUMBER (n, 0); | 141 | CHECK_NUMBER (character, 0); |
| 142 | 142 | ||
| 143 | c = XINT (n); | 143 | c = XINT (character); |
| 144 | return make_string (&c, 1); | 144 | return make_string (&c, 1); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, | 147 | DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, |
| 148 | "Convert arg STRING to a character, the first character of that string.") | 148 | "Convert arg STRING to a character, the first character of that string.") |
| 149 | (str) | 149 | (string) |
| 150 | register Lisp_Object str; | 150 | register Lisp_Object string; |
| 151 | { | 151 | { |
| 152 | register Lisp_Object val; | 152 | register Lisp_Object val; |
| 153 | register struct Lisp_String *p; | 153 | register struct Lisp_String *p; |
| 154 | CHECK_STRING (str, 0); | 154 | CHECK_STRING (string, 0); |
| 155 | 155 | ||
| 156 | p = XSTRING (str); | 156 | p = XSTRING (string); |
| 157 | if (p->size) | 157 | if (p->size) |
| 158 | XSETFASTINT (val, ((unsigned char *) p->data)[0]); | 158 | XSETFASTINT (val, ((unsigned char *) p->data)[0]); |
| 159 | else | 159 | else |
| @@ -203,13 +203,13 @@ clip_to_bounds (lower, num, upper) | |||
| 203 | DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", | 203 | DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", |
| 204 | "Set point to POSITION, a number or marker.\n\ | 204 | "Set point to POSITION, a number or marker.\n\ |
| 205 | Beginning of buffer is position (point-min), end is (point-max).") | 205 | Beginning of buffer is position (point-min), end is (point-max).") |
| 206 | (n) | 206 | (position) |
| 207 | register Lisp_Object n; | 207 | register Lisp_Object position; |
| 208 | { | 208 | { |
| 209 | CHECK_NUMBER_COERCE_MARKER (n, 0); | 209 | CHECK_NUMBER_COERCE_MARKER (position, 0); |
| 210 | 210 | ||
| 211 | SET_PT (clip_to_bounds (BEGV, XINT (n), ZV)); | 211 | SET_PT (clip_to_bounds (BEGV, XINT (position), ZV)); |
| 212 | return n; | 212 | return position; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | static Lisp_Object | 215 | static Lisp_Object |
| @@ -591,7 +591,7 @@ lisp_time_argument (specified_time, result) | |||
| 591 | } | 591 | } |
| 592 | } | 592 | } |
| 593 | 593 | ||
| 594 | DEFUN ("format-time-string", Fformat_time_string, Sformat_time_string, 2, 2, 0, | 594 | DEFUN ("format-time-string", Fformat_time_string, Sformat_time_string, 1, 2, 0, |
| 595 | "Use FORMAT-STRING to format the time TIME.\n\ | 595 | "Use FORMAT-STRING to format the time TIME.\n\ |
| 596 | TIME is specified as (HIGH LOW . IGNORED) or (HIGH . LOW), as from\n\ | 596 | TIME is specified as (HIGH LOW . IGNORED) or (HIGH . LOW), as from\n\ |
| 597 | `current-time' and `file-attributes'.\n\ | 597 | `current-time' and `file-attributes'.\n\ |
| @@ -700,7 +700,7 @@ ZONE is an integer indicating the number of seconds east of Greenwich.\n\ | |||
| 700 | } | 700 | } |
| 701 | 701 | ||
| 702 | DEFUN ("encode-time", Fencode_time, Sencode_time, 6, 7, 0, | 702 | DEFUN ("encode-time", Fencode_time, Sencode_time, 6, 7, 0, |
| 703 | "Convert SEC, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time.\n\ | 703 | "Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time.\n\ |
| 704 | This is the reverse operation of `decode-time', which see. ZONE defaults\n\ | 704 | This is the reverse operation of `decode-time', which see. ZONE defaults\n\ |
| 705 | to the current time zone rule if not specified; if specified, it can\n\ | 705 | to the current time zone rule if not specified; if specified, it can\n\ |
| 706 | be a string (as from `set-time-zone-rule'), or it can be a list\n\ | 706 | be a string (as from `set-time-zone-rule'), or it can be a list\n\ |
| @@ -710,20 +710,20 @@ Out-of-range values for SEC, MINUTE, HOUR, DAY, or MONTH are allowed;\n\ | |||
| 710 | for example, a DAY of 0 means the day preceding the given month.\n\ | 710 | for example, a DAY of 0 means the day preceding the given month.\n\ |
| 711 | Year numbers less than 100 are treated just like other year numbers.\n\ | 711 | Year numbers less than 100 are treated just like other year numbers.\n\ |
| 712 | If you want them to stand for years in this century, you must do that yourself.") | 712 | If you want them to stand for years in this century, you must do that yourself.") |
| 713 | (sec, minute, hour, day, month, year, zone) | 713 | (second, minute, hour, day, month, year, zone) |
| 714 | Lisp_Object sec, minute, hour, day, month, year, zone; | 714 | Lisp_Object second, minute, hour, day, month, year, zone; |
| 715 | { | 715 | { |
| 716 | time_t time; | 716 | time_t time; |
| 717 | struct tm tm; | 717 | struct tm tm; |
| 718 | 718 | ||
| 719 | CHECK_NUMBER (sec, 0); | 719 | CHECK_NUMBER (second, 0); |
| 720 | CHECK_NUMBER (minute, 1); | 720 | CHECK_NUMBER (minute, 1); |
| 721 | CHECK_NUMBER (hour, 2); | 721 | CHECK_NUMBER (hour, 2); |
| 722 | CHECK_NUMBER (day, 3); | 722 | CHECK_NUMBER (day, 3); |
| 723 | CHECK_NUMBER (month, 4); | 723 | CHECK_NUMBER (month, 4); |
| 724 | CHECK_NUMBER (year, 5); | 724 | CHECK_NUMBER (year, 5); |
| 725 | 725 | ||
| 726 | tm.tm_sec = XINT (sec); | 726 | tm.tm_sec = XINT (second); |
| 727 | tm.tm_min = XINT (minute); | 727 | tm.tm_min = XINT (minute); |
| 728 | tm.tm_hour = XINT (hour); | 728 | tm.tm_hour = XINT (hour); |
| 729 | tm.tm_mday = XINT (day); | 729 | tm.tm_mday = XINT (day); |
| @@ -1105,19 +1105,19 @@ Any other markers at the point of insertion also end up after the text.") | |||
| 1105 | } | 1105 | } |
| 1106 | 1106 | ||
| 1107 | DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0, | 1107 | DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0, |
| 1108 | "Insert COUNT (second arg) copies of CHAR (first arg).\n\ | 1108 | "Insert COUNT (second arg) copies of CHARACTER (first arg).\n\ |
| 1109 | Point and all markers are affected as in the function `insert'.\n\ | 1109 | Point and all markers are affected as in the function `insert'.\n\ |
| 1110 | Both arguments are required.\n\ | 1110 | Both arguments are required.\n\ |
| 1111 | The optional third arg INHERIT, if non-nil, says to inherit text properties\n\ | 1111 | The optional third arg INHERIT, if non-nil, says to inherit text properties\n\ |
| 1112 | from adjoining text, if those properties are sticky.") | 1112 | from adjoining text, if those properties are sticky.") |
| 1113 | (chr, count, inherit) | 1113 | (character, count, inherit) |
| 1114 | Lisp_Object chr, count, inherit; | 1114 | Lisp_Object character, count, inherit; |
| 1115 | { | 1115 | { |
| 1116 | register unsigned char *string; | 1116 | register unsigned char *string; |
| 1117 | register int strlen; | 1117 | register int strlen; |
| 1118 | register int i, n; | 1118 | register int i, n; |
| 1119 | 1119 | ||
| 1120 | CHECK_NUMBER (chr, 0); | 1120 | CHECK_NUMBER (character, 0); |
| 1121 | CHECK_NUMBER (count, 1); | 1121 | CHECK_NUMBER (count, 1); |
| 1122 | 1122 | ||
| 1123 | n = XINT (count); | 1123 | n = XINT (count); |
| @@ -1126,7 +1126,7 @@ from adjoining text, if those properties are sticky.") | |||
| 1126 | strlen = min (n, 256); | 1126 | strlen = min (n, 256); |
| 1127 | string = (unsigned char *) alloca (strlen); | 1127 | string = (unsigned char *) alloca (strlen); |
| 1128 | for (i = 0; i < strlen; i++) | 1128 | for (i = 0; i < strlen; i++) |
| 1129 | string[i] = XFASTINT (chr); | 1129 | string[i] = XFASTINT (character); |
| 1130 | while (n >= strlen) | 1130 | while (n >= strlen) |
| 1131 | { | 1131 | { |
| 1132 | if (!NILP (inherit)) | 1132 | if (!NILP (inherit)) |
| @@ -1230,16 +1230,16 @@ DEFUN ("buffer-substring", Fbuffer_substring, Sbuffer_substring, 2, 2, 0, | |||
| 1230 | "Return the contents of part of the current buffer as a string.\n\ | 1230 | "Return the contents of part of the current buffer as a string.\n\ |
| 1231 | The two arguments START and END are character positions;\n\ | 1231 | The two arguments START and END are character positions;\n\ |
| 1232 | they can be in either order.") | 1232 | they can be in either order.") |
| 1233 | (b, e) | 1233 | (start, end) |
| 1234 | Lisp_Object b, e; | 1234 | Lisp_Object start, end; |
| 1235 | { | 1235 | { |
| 1236 | register int beg, end; | 1236 | register int b, e; |
| 1237 | 1237 | ||
| 1238 | validate_region (&b, &e); | 1238 | validate_region (&start, &end); |
| 1239 | beg = XINT (b); | 1239 | b = XINT (start); |
| 1240 | end = XINT (e); | 1240 | e = XINT (end); |
| 1241 | 1241 | ||
| 1242 | return make_buffer_string (beg, end, 1); | 1242 | return make_buffer_string (b, e, 1); |
| 1243 | } | 1243 | } |
| 1244 | 1244 | ||
| 1245 | DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties, | 1245 | DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties, |
| @@ -1247,16 +1247,16 @@ DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties, | |||
| 1247 | "Return the characters of part of the buffer, without the text properties.\n\ | 1247 | "Return the characters of part of the buffer, without the text properties.\n\ |
| 1248 | The two arguments START and END are character positions;\n\ | 1248 | The two arguments START and END are character positions;\n\ |
| 1249 | they can be in either order.") | 1249 | they can be in either order.") |
| 1250 | (b, e) | 1250 | (start, end) |
| 1251 | Lisp_Object b, e; | 1251 | Lisp_Object start, end; |
| 1252 | { | 1252 | { |
| 1253 | register int beg, end; | 1253 | register int b, e; |
| 1254 | 1254 | ||
| 1255 | validate_region (&b, &e); | 1255 | validate_region (&start, &end); |
| 1256 | beg = XINT (b); | 1256 | b = XINT (start); |
| 1257 | end = XINT (e); | 1257 | e = XINT (end); |
| 1258 | 1258 | ||
| 1259 | return make_buffer_string (beg, end, 0); | 1259 | return make_buffer_string (b, e, 0); |
| 1260 | } | 1260 | } |
| 1261 | 1261 | ||
| 1262 | DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0, | 1262 | DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0, |
| @@ -1274,10 +1274,10 @@ DEFUN ("insert-buffer-substring", Finsert_buffer_substring, Sinsert_buffer_subst | |||
| 1274 | BUFFER may be a buffer or a buffer name.\n\ | 1274 | BUFFER may be a buffer or a buffer name.\n\ |
| 1275 | Arguments START and END are character numbers specifying the substring.\n\ | 1275 | Arguments START and END are character numbers specifying the substring.\n\ |
| 1276 | They default to the beginning and the end of BUFFER.") | 1276 | They default to the beginning and the end of BUFFER.") |
| 1277 | (buf, b, e) | 1277 | (buf, start, end) |
| 1278 | Lisp_Object buf, b, e; | 1278 | Lisp_Object buf, start, end; |
| 1279 | { | 1279 | { |
| 1280 | register int beg, end, temp; | 1280 | register int b, e, temp; |
| 1281 | register struct buffer *bp, *obuf; | 1281 | register struct buffer *bp, *obuf; |
| 1282 | Lisp_Object buffer; | 1282 | Lisp_Object buffer; |
| 1283 | 1283 | ||
| @@ -1286,33 +1286,33 @@ They default to the beginning and the end of BUFFER.") | |||
| 1286 | nsberror (buf); | 1286 | nsberror (buf); |
| 1287 | bp = XBUFFER (buffer); | 1287 | bp = XBUFFER (buffer); |
| 1288 | 1288 | ||
| 1289 | if (NILP (b)) | 1289 | if (NILP (start)) |
| 1290 | beg = BUF_BEGV (bp); | 1290 | b = BUF_BEGV (bp); |
| 1291 | else | 1291 | else |
| 1292 | { | 1292 | { |
| 1293 | CHECK_NUMBER_COERCE_MARKER (b, 0); | 1293 | CHECK_NUMBER_COERCE_MARKER (start, 0); |
| 1294 | beg = XINT (b); | 1294 | b = XINT (start); |
| 1295 | } | 1295 | } |
| 1296 | if (NILP (e)) | 1296 | if (NILP (end)) |
| 1297 | end = BUF_ZV (bp); | 1297 | e = BUF_ZV (bp); |
| 1298 | else | 1298 | else |
| 1299 | { | 1299 | { |
| 1300 | CHECK_NUMBER_COERCE_MARKER (e, 1); | 1300 | CHECK_NUMBER_COERCE_MARKER (end, 1); |
| 1301 | end = XINT (e); | 1301 | e = XINT (end); |
| 1302 | } | 1302 | } |
| 1303 | 1303 | ||
| 1304 | if (beg > end) | 1304 | if (b > e) |
| 1305 | temp = beg, beg = end, end = temp; | 1305 | temp = b, b = e, e = temp; |
| 1306 | 1306 | ||
| 1307 | if (!(BUF_BEGV (bp) <= beg && end <= BUF_ZV (bp))) | 1307 | if (!(BUF_BEGV (bp) <= b && e <= BUF_ZV (bp))) |
| 1308 | args_out_of_range (b, e); | 1308 | args_out_of_range (start, end); |
| 1309 | 1309 | ||
| 1310 | obuf = current_buffer; | 1310 | obuf = current_buffer; |
| 1311 | set_buffer_internal_1 (bp); | 1311 | set_buffer_internal_1 (bp); |
| 1312 | update_buffer_properties (beg, end); | 1312 | update_buffer_properties (b, e); |
| 1313 | set_buffer_internal_1 (obuf); | 1313 | set_buffer_internal_1 (obuf); |
| 1314 | 1314 | ||
| 1315 | insert_from_buffer (bp, beg, end - beg, 0); | 1315 | insert_from_buffer (bp, b, e - b, 0); |
| 1316 | return Qnil; | 1316 | return Qnil; |
| 1317 | } | 1317 | } |
| 1318 | 1318 | ||
| @@ -1573,11 +1573,11 @@ DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r", | |||
| 1573 | "Delete the text between point and mark.\n\ | 1573 | "Delete the text between point and mark.\n\ |
| 1574 | When called from a program, expects two arguments,\n\ | 1574 | When called from a program, expects two arguments,\n\ |
| 1575 | positions (integers or markers) specifying the stretch to be deleted.") | 1575 | positions (integers or markers) specifying the stretch to be deleted.") |
| 1576 | (b, e) | 1576 | (start, end) |
| 1577 | Lisp_Object b, e; | 1577 | Lisp_Object start, end; |
| 1578 | { | 1578 | { |
| 1579 | validate_region (&b, &e); | 1579 | validate_region (&start, &end); |
| 1580 | del_range (XINT (b), XINT (e)); | 1580 | del_range (XINT (start), XINT (end)); |
| 1581 | return Qnil; | 1581 | return Qnil; |
| 1582 | } | 1582 | } |
| 1583 | 1583 | ||
| @@ -1603,27 +1603,27 @@ See also `save-restriction'.\n\ | |||
| 1603 | \n\ | 1603 | \n\ |
| 1604 | When calling from a program, pass two arguments; positions (integers\n\ | 1604 | When calling from a program, pass two arguments; positions (integers\n\ |
| 1605 | or markers) bounding the text that should remain visible.") | 1605 | or markers) bounding the text that should remain visible.") |
| 1606 | (b, e) | 1606 | (start, end) |
| 1607 | register Lisp_Object b, e; | 1607 | register Lisp_Object start, end; |
| 1608 | { | 1608 | { |
| 1609 | CHECK_NUMBER_COERCE_MARKER (b, 0); | 1609 | CHECK_NUMBER_COERCE_MARKER (start, 0); |
| 1610 | CHECK_NUMBER_COERCE_MARKER (e, 1); | 1610 | CHECK_NUMBER_COERCE_MARKER (end, 1); |
| 1611 | 1611 | ||
| 1612 | if (XINT (b) > XINT (e)) | 1612 | if (XINT (start) > XINT (end)) |
| 1613 | { | 1613 | { |
| 1614 | Lisp_Object tem; | 1614 | Lisp_Object tem; |
| 1615 | tem = b; b = e; e = tem; | 1615 | tem = start; start = end; end = tem; |
| 1616 | } | 1616 | } |
| 1617 | 1617 | ||
| 1618 | if (!(BEG <= XINT (b) && XINT (b) <= XINT (e) && XINT (e) <= Z)) | 1618 | if (!(BEG <= XINT (start) && XINT (start) <= XINT (end) && XINT (end) <= Z)) |
| 1619 | args_out_of_range (b, e); | 1619 | args_out_of_range (start, end); |
| 1620 | 1620 | ||
| 1621 | BEGV = XFASTINT (b); | 1621 | BEGV = XFASTINT (start); |
| 1622 | SET_BUF_ZV (current_buffer, XFASTINT (e)); | 1622 | SET_BUF_ZV (current_buffer, XFASTINT (end)); |
| 1623 | if (point < XFASTINT (b)) | 1623 | if (point < XFASTINT (start)) |
| 1624 | SET_PT (XFASTINT (b)); | 1624 | SET_PT (XFASTINT (start)); |
| 1625 | if (point > XFASTINT (e)) | 1625 | if (point > XFASTINT (end)) |
| 1626 | SET_PT (XFASTINT (e)); | 1626 | SET_PT (XFASTINT (end)); |
| 1627 | current_buffer->clip_changed = 1; | 1627 | current_buffer->clip_changed = 1; |
| 1628 | /* Changing the buffer bounds invalidates any recorded current column. */ | 1628 | /* Changing the buffer bounds invalidates any recorded current column. */ |
| 1629 | invalidate_current_column (); | 1629 | invalidate_current_column (); |