summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-06-15 02:41:59 +0000
committerRichard M. Stallman <rms@gnu.org>1997-06-15 02:41:59 +0000
commitfebef0acbae231cb22d344dea938cb7db69b71e5 (patch)
treed179b1b18388f53b01218ea9ddfe74a956c9d6c6 /src/editfns.c
parent0020732e54308e2a74fd5a2386f2d642639f8b37 (diff)
downloademacs-febef0acbae231cb22d344dea938cb7db69b71e5.tar.gz
(Fchar_after, Fchar_before): Make arg optional.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 0661d0f8c86..ccd2e6fb367 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -560,7 +560,7 @@ DEFUN ("eolp", Feolp, Seolp, 0, 0, 0,
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 @@ If `enable-multibyte-characters' is nil or POS is not at character boundary,\n\
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 @@ is returned as a character.")
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))
{