comparison src/editfns.c @ 40:7e54bd776075 r19-15b103

Import from CVS: tag r19-15b103
author cvs
date Mon, 13 Aug 2007 08:54:25 +0200
parents e04119814345
children 56c54cf7c5b6
comparison
equal deleted inserted replaced
39:06f275776fba 40:7e54bd776075
629 if (BUF_PT (b) == BUF_ZV (b) || BUF_FETCH_CHAR (b, BUF_PT (b)) == '\n') 629 if (BUF_PT (b) == BUF_ZV (b) || BUF_FETCH_CHAR (b, BUF_PT (b)) == '\n')
630 return Qt; 630 return Qt;
631 return Qnil; 631 return Qnil;
632 } 632 }
633 633
634 DEFUN ("char-after", Fchar_after, 1, 2, 0, /* 634 DEFUN ("char-after", Fchar_after, 0, 2, 0, /*
635 Return character in BUFFER at position POS. 635 Return character in BUFFER at position POS.
636 POS is an integer or a buffer pointer. 636 POS is an integer or a buffer pointer.
637 If POS is out of range, the value is nil. 637 If POS is out of range, the value is nil.
638 If BUFFER is nil, the current buffer is assumed. 638 If BUFFER is nil, the current buffer is assumed.
639 if POS is nil, the value of point is assumed.
639 */ 640 */
640 (pos, buffer)) 641 (pos, buffer))
641 { 642 {
642 struct buffer *b = decode_buffer (buffer, 1); 643 struct buffer *b = decode_buffer (buffer, 1);
643 Bufpos n = get_buffer_pos_char (b, pos, GB_NO_ERROR_IF_BAD); 644 Bufpos n = (NILP (pos) ? BUF_PT (b) :
645 get_buffer_pos_char (b, pos, GB_NO_ERROR_IF_BAD));
644 646
645 if (n < 0 || n == BUF_ZV (b)) 647 if (n < 0 || n == BUF_ZV (b))
646 return Qnil; 648 return Qnil;
647 return (make_char (BUF_FETCH_CHAR (b, n))); 649 return make_char (BUF_FETCH_CHAR (b, n));
650 }
651
652 DEFUN ("char-before", Fchar_before, 0, 2, 0, /*
653 Return character in BUFFER before position POS.
654 POS is an integer or a buffer pointer.
655 If POS is out of range, the value is nil.
656 If BUFFER is nil, the current buffer is assumed.
657 if POS is nil, the value of point is assumed.
658 */
659 (pos, buffer))
660 {
661 struct buffer *b = decode_buffer (buffer, 1);
662 Bufpos n = ((NILP (pos) ? BUF_PT (b) :
663 get_buffer_pos_char (b, pos, GB_NO_ERROR_IF_BAD)));
664
665 n--;
666
667 if (n < BUF_BEGV (b))
668 return Qnil;
669 return make_char (BUF_FETCH_CHAR (b, n));
648 } 670 }
649 671
650 672
651 DEFUN ("user-login-name", Fuser_login_name, 0, 1, 0, /* 673 DEFUN ("user-login-name", Fuser_login_name, 0, 1, 0, /*
652 Return the name under which the user logged in, as a string. 674 Return the name under which the user logged in, as a string.
2084 DEFSUBR (Fbolp); 2106 DEFSUBR (Fbolp);
2085 DEFSUBR (Feolp); 2107 DEFSUBR (Feolp);
2086 DEFSUBR (Ffollowing_char); 2108 DEFSUBR (Ffollowing_char);
2087 DEFSUBR (Fpreceding_char); 2109 DEFSUBR (Fpreceding_char);
2088 DEFSUBR (Fchar_after); 2110 DEFSUBR (Fchar_after);
2111 DEFSUBR (Fchar_before);
2089 DEFSUBR (Finsert); 2112 DEFSUBR (Finsert);
2090 DEFSUBR (Finsert_string); 2113 DEFSUBR (Finsert_string);
2091 DEFSUBR (Finsert_before_markers); 2114 DEFSUBR (Finsert_before_markers);
2092 DEFSUBR (Finsert_char); 2115 DEFSUBR (Finsert_char);
2093 2116