aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
authorRichard M. Stallman1997-06-15 02:41:59 +0000
committerRichard M. Stallman1997-06-15 02:41:59 +0000
commitfa1d3816e99d18df0c785b435b11642e3faa080d (patch)
treef9790a1f4e02205ede78365ddd21491c7e58c2ff /src/editfns.c
parent1be5a2845e50172a4a58a5930f3095af575b85e2 (diff)
downloademacs-fa1d3816e99d18df0c785b435b11642e3faa080d.tar.gz
emacs-fa1d3816e99d18df0c785b435b11642e3faa080d.zip
(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,
560 return Qnil; 560 return Qnil;
561} 561}
562 562
563DEFUN ("char-after", Fchar_after, Schar_after, 1, 1, 0, 563DEFUN ("char-after", Fchar_after, Schar_after, 0, 1, 0,
564 "Return character in current buffer at position POS.\n\ 564 "Return character in current buffer at position POS.\n\
565POS is an integer or a buffer pointer.\n\ 565POS is an integer or a buffer pointer.\n\
566If POS is out of range, the value is nil.\n\ 566If 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\
573 register Lisp_Object val; 573 register Lisp_Object val;
574 register int n; 574 register int n;
575 575
576 CHECK_NUMBER_COERCE_MARKER (pos, 0); 576 if (NILP (pos))
577 n = PT;
578 else
579 {
580 CHECK_NUMBER_COERCE_MARKER (pos, 0);
577 581
578 n = XINT (pos); 582 n = XINT (pos);
579 if (n < BEGV || n >= ZV) return Qnil; 583 if (n < BEGV || n >= ZV)
584 return Qnil;
585 }
580 586
581 XSETFASTINT (val, FETCH_CHAR (n)); 587 XSETFASTINT (val, FETCH_CHAR (n));
582 return val; 588 return val;
583} 589}
584 590
585DEFUN ("char-before", Fchar_before, Schar_before, 1, 1, 0, 591DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0,
586 "Return character in current buffer preceding position POS.\n\ 592 "Return character in current buffer preceding position POS.\n\
587POS is an integer or a buffer pointer.\n\ 593POS is an integer or a buffer pointer.\n\
588If POS is out of range, the value is nil.\n\ 594If POS is out of range, the value is nil.\n\
@@ -595,10 +601,16 @@ is returned as a character.")
595 register Lisp_Object val; 601 register Lisp_Object val;
596 register int n; 602 register int n;
597 603
598 CHECK_NUMBER_COERCE_MARKER (pos, 0); 604 if (NILP (pos))
605 n = PT;
606 else
607 {
608 CHECK_NUMBER_COERCE_MARKER (pos, 0);
599 609
600 n = XINT (pos); 610 n = XINT (pos);
601 if (n <= BEGV || n > ZV) return Qnil; 611 if (n < BEGV || n >= ZV)
612 return Qnil;
613 }
602 614
603 if (!NILP (current_buffer->enable_multibyte_characters)) 615 if (!NILP (current_buffer->enable_multibyte_characters))
604 { 616 {