diff options
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 28 |
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 | ||
| 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\ |
| @@ -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 | ||
| 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\ |
| @@ -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 | { |