comparison src/editfns.c @ 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 330dc0ca4edb
children 3090657a944b
comparison
equal deleted inserted replaced
18251:e0327e90d706 18252:9c4fb902b6eb
558 if (PT == ZV || FETCH_BYTE (PT) == '\n') 558 if (PT == ZV || FETCH_BYTE (PT) == '\n')
559 return Qt; 559 return Qt;
560 return Qnil; 560 return Qnil;
561 } 561 }
562 562
563 DEFUN ("char-after", Fchar_after, Schar_after, 1, 1, 0, 563 DEFUN ("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\
565 POS is an integer or a buffer pointer.\n\ 565 POS is an integer or a buffer pointer.\n\
566 If POS is out of range, the value is nil.\n\ 566 If POS is out of range, the value is nil.\n\
567 If `enable-multibyte-characters' is nil or POS is not at character boundary,\n\ 567 If `enable-multibyte-characters' is nil or POS is not at character boundary,\n\
568 multi-byte form is ignored, and only one byte at POS\n\ 568 multi-byte form is ignored, and only one byte at POS\n\
571 Lisp_Object pos; 571 Lisp_Object pos;
572 { 572 {
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 577 n = PT;
578 n = XINT (pos); 578 else
579 if (n < BEGV || n >= ZV) return Qnil; 579 {
580 CHECK_NUMBER_COERCE_MARKER (pos, 0);
581
582 n = XINT (pos);
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
585 DEFUN ("char-before", Fchar_before, Schar_before, 1, 1, 0, 591 DEFUN ("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\
587 POS is an integer or a buffer pointer.\n\ 593 POS is an integer or a buffer pointer.\n\
588 If POS is out of range, the value is nil.\n\ 594 If POS is out of range, the value is nil.\n\
589 If `enable-multibyte-characters' is nil or POS is not at character boundary,\n\ 595 If `enable-multibyte-characters' is nil or POS is not at character boundary,\n\
590 multi-byte form is ignored, and only one byte preceding POS\n\ 596 multi-byte form is ignored, and only one byte preceding POS\n\
593 Lisp_Object pos; 599 Lisp_Object pos;
594 { 600 {
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))
599 605 n = PT;
600 n = XINT (pos); 606 else
601 if (n <= BEGV || n > ZV) return Qnil; 607 {
608 CHECK_NUMBER_COERCE_MARKER (pos, 0);
609
610 n = XINT (pos);
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 {
605 DEC_POS (pos); 617 DEC_POS (pos);
606 XSETFASTINT (val, FETCH_CHAR (pos)); 618 XSETFASTINT (val, FETCH_CHAR (pos));