comparison src/editfns.c @ 114:8619ce7e4c50 r20-1b9

Import from CVS: tag r20-1b9
author cvs
date Mon, 13 Aug 2007 09:21:54 +0200
parents fe104dbd9147
children 538048ae2ab8
comparison
equal deleted inserted replaced
113:2ec2fe4a4c89 114:8619ce7e4c50
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.
2102 DEFSUBR (Fbolp); 2124 DEFSUBR (Fbolp);
2103 DEFSUBR (Feolp); 2125 DEFSUBR (Feolp);
2104 DEFSUBR (Ffollowing_char); 2126 DEFSUBR (Ffollowing_char);
2105 DEFSUBR (Fpreceding_char); 2127 DEFSUBR (Fpreceding_char);
2106 DEFSUBR (Fchar_after); 2128 DEFSUBR (Fchar_after);
2129 DEFSUBR (Fchar_before);
2107 DEFSUBR (Finsert); 2130 DEFSUBR (Finsert);
2108 DEFSUBR (Finsert_string); 2131 DEFSUBR (Finsert_string);
2109 DEFSUBR (Finsert_before_markers); 2132 DEFSUBR (Finsert_before_markers);
2110 DEFSUBR (Finsert_char); 2133 DEFSUBR (Finsert_char);
2111 2134