Commit 2591ec64 authored by Erik Naggum's avatar Erik Naggum
Browse files

(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.
parent e20104ba
...@@ -133,27 +133,27 @@ init_editfns () ...@@ -133,27 +133,27 @@ init_editfns ()
} }
DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0, DEFUN ("char-to-string", Fchar_to_string, Schar_to_string, 1, 1, 0,
"Convert arg CHAR to a one-character string containing that character.") "Convert arg CHARACTER to a one-character string containing that character.")
(n) (character)
Lisp_Object n; Lisp_Object character;
{ {
char c; char c;
CHECK_NUMBER (n, 0); CHECK_NUMBER (character, 0);
c = XINT (n); c = XINT (character);
return make_string (&c, 1); return make_string (&c, 1);
} }
DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,
"Convert arg STRING to a character, the first character of that string.") "Convert arg STRING to a character, the first character of that string.")
(str) (string)
register Lisp_Object str; register Lisp_Object string;
{ {
register Lisp_Object val; register Lisp_Object val;
register struct Lisp_String *p; register struct Lisp_String *p;
CHECK_STRING (str, 0); CHECK_STRING (string, 0);
p = XSTRING (str); p = XSTRING (string);
if (p->size) if (p->size)
XSETFASTINT (val, ((unsigned char *) p->data)[0]); XSETFASTINT (val, ((unsigned char *) p->data)[0]);
else else
...@@ -203,13 +203,13 @@ clip_to_bounds (lower, num, upper) ...@@ -203,13 +203,13 @@ clip_to_bounds (lower, num, upper)
DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
"Set point to POSITION, a number or marker.\n\ "Set point to POSITION, a number or marker.\n\
Beginning of buffer is position (point-min), end is (point-max).") Beginning of buffer is position (point-min), end is (point-max).")
(n) (position)
register Lisp_Object n; register Lisp_Object position;
{ {
CHECK_NUMBER_COERCE_MARKER (n, 0); CHECK_NUMBER_COERCE_MARKER (position, 0);
SET_PT (clip_to_bounds (BEGV, XINT (n), ZV)); SET_PT (clip_to_bounds (BEGV, XINT (position), ZV));
return n; return position;
} }
static Lisp_Object static Lisp_Object
...@@ -591,7 +591,7 @@ lisp_time_argument (specified_time, result) ...@@ -591,7 +591,7 @@ lisp_time_argument (specified_time, result)
} }
} }
DEFUN ("format-time-string", Fformat_time_string, Sformat_time_string, 2, 2, 0, DEFUN ("format-time-string", Fformat_time_string, Sformat_time_string, 1, 2, 0,
"Use FORMAT-STRING to format the time TIME.\n\ "Use FORMAT-STRING to format the time TIME.\n\
TIME is specified as (HIGH LOW . IGNORED) or (HIGH . LOW), as from\n\ TIME is specified as (HIGH LOW . IGNORED) or (HIGH . LOW), as from\n\
`current-time' and `file-attributes'.\n\ `current-time' and `file-attributes'.\n\
...@@ -700,7 +700,7 @@ ZONE is an integer indicating the number of seconds east of Greenwich.\n\ ...@@ -700,7 +700,7 @@ ZONE is an integer indicating the number of seconds east of Greenwich.\n\
} }
DEFUN ("encode-time", Fencode_time, Sencode_time, 6, 7, 0, DEFUN ("encode-time", Fencode_time, Sencode_time, 6, 7, 0,
"Convert SEC, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time.\n\ "Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time.\n\
This is the reverse operation of `decode-time', which see. ZONE defaults\n\ This is the reverse operation of `decode-time', which see. ZONE defaults\n\
to the current time zone rule if not specified; if specified, it can\n\ to the current time zone rule if not specified; if specified, it can\n\
be a string (as from `set-time-zone-rule'), or it can be a list\n\ 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,20 +710,20 @@ Out-of-range values for SEC, MINUTE, HOUR, DAY, or MONTH are allowed;\n\
for example, a DAY of 0 means the day preceding the given month.\n\ for example, a DAY of 0 means the day preceding the given month.\n\
Year numbers less than 100 are treated just like other year numbers.\n\ Year numbers less than 100 are treated just like other year numbers.\n\
If you want them to stand for years in this century, you must do that yourself.") If you want them to stand for years in this century, you must do that yourself.")
(sec, minute, hour, day, month, year, zone) (second, minute, hour, day, month, year, zone)
Lisp_Object sec, minute, hour, day, month, year, zone; Lisp_Object second, minute, hour, day, month, year, zone;
{ {
time_t time; time_t time;
struct tm tm; struct tm tm;
CHECK_NUMBER (sec, 0); CHECK_NUMBER (second, 0);
CHECK_NUMBER (minute, 1); CHECK_NUMBER (minute, 1);
CHECK_NUMBER (hour, 2); CHECK_NUMBER (hour, 2);
CHECK_NUMBER (day, 3); CHECK_NUMBER (day, 3);
CHECK_NUMBER (month, 4); CHECK_NUMBER (month, 4);
CHECK_NUMBER (year, 5); CHECK_NUMBER (year, 5);
tm.tm_sec = XINT (sec); tm.tm_sec = XINT (second);
tm.tm_min = XINT (minute); tm.tm_min = XINT (minute);
tm.tm_hour = XINT (hour); tm.tm_hour = XINT (hour);
tm.tm_mday = XINT (day); tm.tm_mday = XINT (day);
...@@ -1105,19 +1105,19 @@ Any other markers at the point of insertion also end up after the text.") ...@@ -1105,19 +1105,19 @@ Any other markers at the point of insertion also end up after the text.")
} }
DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0, DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0,
"Insert COUNT (second arg) copies of CHAR (first arg).\n\ "Insert COUNT (second arg) copies of CHARACTER (first arg).\n\
Point and all markers are affected as in the function `insert'.\n\ Point and all markers are affected as in the function `insert'.\n\
Both arguments are required.\n\ Both arguments are required.\n\
The optional third arg INHERIT, if non-nil, says to inherit text properties\n\ The optional third arg INHERIT, if non-nil, says to inherit text properties\n\
from adjoining text, if those properties are sticky.") from adjoining text, if those properties are sticky.")
(chr, count, inherit) (character, count, inherit)
Lisp_Object chr, count, inherit; Lisp_Object character, count, inherit;
{ {
register unsigned char *string; register unsigned char *string;
register int strlen; register int strlen;
register int i, n; register int i, n;
CHECK_NUMBER (chr, 0); CHECK_NUMBER (character, 0);
CHECK_NUMBER (count, 1); CHECK_NUMBER (count, 1);
n = XINT (count); n = XINT (count);
...@@ -1126,7 +1126,7 @@ from adjoining text, if those properties are sticky.") ...@@ -1126,7 +1126,7 @@ from adjoining text, if those properties are sticky.")
strlen = min (n, 256); strlen = min (n, 256);
string = (unsigned char *) alloca (strlen); string = (unsigned char *) alloca (strlen);
for (i = 0; i < strlen; i++) for (i = 0; i < strlen; i++)
string[i] = XFASTINT (chr); string[i] = XFASTINT (character);
while (n >= strlen) while (n >= strlen)
{ {
if (!NILP (inherit)) if (!NILP (inherit))
...@@ -1230,16 +1230,16 @@ DEFUN ("buffer-substring", Fbuffer_substring, Sbuffer_substring, 2, 2, 0, ...@@ -1230,16 +1230,16 @@ DEFUN ("buffer-substring", Fbuffer_substring, Sbuffer_substring, 2, 2, 0,
"Return the contents of part of the current buffer as a string.\n\ "Return the contents of part of the current buffer as a string.\n\
The two arguments START and END are character positions;\n\ The two arguments START and END are character positions;\n\
they can be in either order.") they can be in either order.")
(b, e) (start, end)
Lisp_Object b, e; Lisp_Object start, end;
{ {
register int beg, end; register int b, e;
validate_region (&b, &e); validate_region (&start, &end);
beg = XINT (b); b = XINT (start);
end = XINT (e); e = XINT (end);
return make_buffer_string (beg, end, 1); return make_buffer_string (b, e, 1);
} }
DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties, DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties,
...@@ -1247,16 +1247,16 @@ DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties, ...@@ -1247,16 +1247,16 @@ DEFUN ("buffer-substring-no-properties", Fbuffer_substring_no_properties,
"Return the characters of part of the buffer, without the text properties.\n\ "Return the characters of part of the buffer, without the text properties.\n\
The two arguments START and END are character positions;\n\ The two arguments START and END are character positions;\n\
they can be in either order.") they can be in either order.")
(b, e) (start, end)
Lisp_Object b, e; Lisp_Object start, end;
{ {
register int beg, end; register int b, e;
validate_region (&b, &e); validate_region (&start, &end);
beg = XINT (b); b = XINT (start);
end = XINT (e); e = XINT (end);
return make_buffer_string (beg, end, 0); return make_buffer_string (b, e, 0);
} }
DEFUN ("buffer-string", Fbuffer_string, Sbuffer_string, 0, 0, 0, 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,10 +1274,10 @@ DEFUN ("insert-buffer-substring", Finsert_buffer_substring, Sinsert_buffer_subst
BUFFER may be a buffer or a buffer name.\n\ BUFFER may be a buffer or a buffer name.\n\
Arguments START and END are character numbers specifying the substring.\n\ Arguments START and END are character numbers specifying the substring.\n\
They default to the beginning and the end of BUFFER.") They default to the beginning and the end of BUFFER.")
(buf, b, e) (buf, start, end)
Lisp_Object buf, b, e; Lisp_Object buf, start, end;
{ {
register int beg, end, temp; register int b, e, temp;
register struct buffer *bp, *obuf; register struct buffer *bp, *obuf;
Lisp_Object buffer; Lisp_Object buffer;
...@@ -1286,33 +1286,33 @@ They default to the beginning and the end of BUFFER.") ...@@ -1286,33 +1286,33 @@ They default to the beginning and the end of BUFFER.")
nsberror (buf); nsberror (buf);
bp = XBUFFER (buffer); bp = XBUFFER (buffer);
if (NILP (b)) if (NILP (start))
beg = BUF_BEGV (bp); b = BUF_BEGV (bp);
else else
{ {
CHECK_NUMBER_COERCE_MARKER (b, 0); CHECK_NUMBER_COERCE_MARKER (start, 0);
beg = XINT (b); b = XINT (start);
} }
if (NILP (e)) if (NILP (end))
end = BUF_ZV (bp); e = BUF_ZV (bp);
else else
{ {
CHECK_NUMBER_COERCE_MARKER (e, 1); CHECK_NUMBER_COERCE_MARKER (end, 1);
end = XINT (e); e = XINT (end);
} }
if (beg > end) if (b > e)
temp = beg, beg = end, end = temp; temp = b, b = e, e = temp;
if (!(BUF_BEGV (bp) <= beg && end <= BUF_ZV (bp))) if (!(BUF_BEGV (bp) <= b && e <= BUF_ZV (bp)))
args_out_of_range (b, e); args_out_of_range (start, end);
obuf = current_buffer; obuf = current_buffer;
set_buffer_internal_1 (bp); set_buffer_internal_1 (bp);
update_buffer_properties (beg, end); update_buffer_properties (b, e);
set_buffer_internal_1 (obuf); set_buffer_internal_1 (obuf);
insert_from_buffer (bp, beg, end - beg, 0); insert_from_buffer (bp, b, e - b, 0);
return Qnil; return Qnil;
} }
...@@ -1573,11 +1573,11 @@ DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r", ...@@ -1573,11 +1573,11 @@ DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r",
"Delete the text between point and mark.\n\ "Delete the text between point and mark.\n\
When called from a program, expects two arguments,\n\ When called from a program, expects two arguments,\n\
positions (integers or markers) specifying the stretch to be deleted.") positions (integers or markers) specifying the stretch to be deleted.")
(b, e) (start, end)
Lisp_Object b, e; Lisp_Object start, end;
{ {
validate_region (&b, &e); validate_region (&start, &end);
del_range (XINT (b), XINT (e)); del_range (XINT (start), XINT (end));
return Qnil; return Qnil;
} }
...@@ -1603,27 +1603,27 @@ See also `save-restriction'.\n\ ...@@ -1603,27 +1603,27 @@ See also `save-restriction'.\n\
\n\ \n\
When calling from a program, pass two arguments; positions (integers\n\ When calling from a program, pass two arguments; positions (integers\n\
or markers) bounding the text that should remain visible.") or markers) bounding the text that should remain visible.")
(b, e) (start, end)
register Lisp_Object b, e; register Lisp_Object start, end;
{ {
CHECK_NUMBER_COERCE_MARKER (b, 0); CHECK_NUMBER_COERCE_MARKER (start, 0);
CHECK_NUMBER_COERCE_MARKER (e, 1); CHECK_NUMBER_COERCE_MARKER (end, 1);
if (XINT (b) > XINT (e)) if (XINT (start) > XINT (end))
{ {
Lisp_Object tem; Lisp_Object tem;
tem = b; b = e; e = tem; tem = start; start = end; end = tem;
} }
if (!(BEG <= XINT (b) && XINT (b) <= XINT (e) && XINT (e) <= Z)) if (!(BEG <= XINT (start) && XINT (start) <= XINT (end) && XINT (end) <= Z))
args_out_of_range (b, e); args_out_of_range (start, end);
BEGV = XFASTINT (b); BEGV = XFASTINT (start);
SET_BUF_ZV (current_buffer, XFASTINT (e)); SET_BUF_ZV (current_buffer, XFASTINT (end));
if (point < XFASTINT (b)) if (point < XFASTINT (start))
SET_PT (XFASTINT (b)); SET_PT (XFASTINT (start));
if (point > XFASTINT (e)) if (point > XFASTINT (end))
SET_PT (XFASTINT (e)); SET_PT (XFASTINT (end));
current_buffer->clip_changed = 1; current_buffer->clip_changed = 1;
/* Changing the buffer bounds invalidates any recorded current column. */ /* Changing the buffer bounds invalidates any recorded current column. */
invalidate_current_column (); invalidate_current_column ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment