Mercurial > emacs
changeset 18252:9c4fb902b6eb
(Fchar_after, Fchar_before): Make arg optional.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 15 Jun 1997 02:41:59 +0000 |
parents | e0327e90d706 |
children | 0c8339d10beb |
files | src/editfns.c |
diffstat | 1 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/editfns.c Sun Jun 15 02:37:58 1997 +0000 +++ b/src/editfns.c Sun Jun 15 02:41:59 1997 +0000 @@ -560,7 +560,7 @@ return Qnil; } -DEFUN ("char-after", Fchar_after, Schar_after, 1, 1, 0, +DEFUN ("char-after", Fchar_after, Schar_after, 0, 1, 0, "Return character in current buffer at position POS.\n\ POS is an integer or a buffer pointer.\n\ If POS is out of range, the value is nil.\n\ @@ -573,16 +573,22 @@ register Lisp_Object val; register int n; - CHECK_NUMBER_COERCE_MARKER (pos, 0); + if (NILP (pos)) + n = PT; + else + { + CHECK_NUMBER_COERCE_MARKER (pos, 0); - n = XINT (pos); - if (n < BEGV || n >= ZV) return Qnil; + n = XINT (pos); + if (n < BEGV || n >= ZV) + return Qnil; + } XSETFASTINT (val, FETCH_CHAR (n)); return val; } -DEFUN ("char-before", Fchar_before, Schar_before, 1, 1, 0, +DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0, "Return character in current buffer preceding position POS.\n\ POS is an integer or a buffer pointer.\n\ If POS is out of range, the value is nil.\n\ @@ -595,10 +601,16 @@ register Lisp_Object val; register int n; - CHECK_NUMBER_COERCE_MARKER (pos, 0); + if (NILP (pos)) + n = PT; + else + { + CHECK_NUMBER_COERCE_MARKER (pos, 0); - n = XINT (pos); - if (n <= BEGV || n > ZV) return Qnil; + n = XINT (pos); + if (n < BEGV || n >= ZV) + return Qnil; + } if (!NILP (current_buffer->enable_multibyte_characters)) {