comparison src/editfns.c @ 434:9d177e8d4150 r21-2-25

Import from CVS: tag r21-2-25
author cvs
date Mon, 13 Aug 2007 11:30:53 +0200
parents 3ecd8885ac67
children 8de8e3f6228a
comparison
equal deleted inserted replaced
433:892ca416f0fb 434:9d177e8d4150
438 return make_int (BUF_SIZE (b)); 438 return make_int (BUF_SIZE (b));
439 } 439 }
440 440
441 DEFUN ("point-min", Fpoint_min, 0, 1, 0, /* 441 DEFUN ("point-min", Fpoint_min, 0, 1, 0, /*
442 Return the minimum permissible value of point in BUFFER. 442 Return the minimum permissible value of point in BUFFER.
443 This is 1, unless narrowing (a buffer restriction) is in effect. 443 This is 1, unless narrowing (a buffer restriction)
444 is in effect, in which case it may be greater.
444 If BUFFER is nil, the current buffer is assumed. 445 If BUFFER is nil, the current buffer is assumed.
445 */ 446 */
446 (buffer)) 447 (buffer))
447 { 448 {
448 struct buffer *b = decode_buffer (buffer, 1); 449 struct buffer *b = decode_buffer (buffer, 1);
449 return make_int (BUF_BEGV (b)); 450 return make_int (BUF_BEGV (b));
450 } 451 }
451 452
452 DEFUN ("point-min-marker", Fpoint_min_marker, 0, 1, 0, /* 453 DEFUN ("point-min-marker", Fpoint_min_marker, 0, 1, 0, /*
453 Return a marker to the minimum permissible value of point in BUFFER. 454 Return a marker to the minimum permissible value of point in BUFFER.
454 This is the beginning, unless narrowing (a buffer restriction) is in effect. 455 This is the beginning, unless narrowing (a buffer restriction)
456 is in effect, in which case it may be greater.
455 If BUFFER is nil, the current buffer is assumed. 457 If BUFFER is nil, the current buffer is assumed.
456 */ 458 */
457 (buffer)) 459 (buffer))
458 { 460 {
459 struct buffer *b = decode_buffer (buffer, 1); 461 struct buffer *b = decode_buffer (buffer, 1);
461 } 463 }
462 464
463 DEFUN ("point-max", Fpoint_max, 0, 1, 0, /* 465 DEFUN ("point-max", Fpoint_max, 0, 1, 0, /*
464 Return the maximum permissible value of point in BUFFER. 466 Return the maximum permissible value of point in BUFFER.
465 This is (1+ (buffer-size)), unless narrowing (a buffer restriction) 467 This is (1+ (buffer-size)), unless narrowing (a buffer restriction)
466 is in effect, in which case it is less. 468 is in effect, in which case it may be less.
467 If BUFFER is nil, the current buffer is assumed. 469 If BUFFER is nil, the current buffer is assumed.
468 */ 470 */
469 (buffer)) 471 (buffer))
470 { 472 {
471 struct buffer *b = decode_buffer (buffer, 1); 473 struct buffer *b = decode_buffer (buffer, 1);
472 return make_int (BUF_ZV (b)); 474 return make_int (BUF_ZV (b));
473 } 475 }
474 476
475 DEFUN ("point-max-marker", Fpoint_max_marker, 0, 1, 0, /* 477 DEFUN ("point-max-marker", Fpoint_max_marker, 0, 1, 0, /*
476 Return a marker to the maximum permissible value of point BUFFER. 478 Return a marker to the maximum permissible value of point in BUFFER.
477 This is (1+ (buffer-size)), unless narrowing (a buffer restriction) 479 This is (1+ (buffer-size)), unless narrowing (a buffer restriction)
478 is in effect, in which case it is less. 480 is in effect, in which case it may be less.
479 If BUFFER is nil, the current buffer is assumed. 481 If BUFFER is nil, the current buffer is assumed.
480 */ 482 */
481 (buffer)) 483 (buffer))
482 { 484 {
483 struct buffer *b = decode_buffer (buffer, 1); 485 struct buffer *b = decode_buffer (buffer, 1);
562 return (BUF_PT (b) == BUF_ZV (b) || BUF_FETCH_CHAR (b, BUF_PT (b)) == '\n') 564 return (BUF_PT (b) == BUF_ZV (b) || BUF_FETCH_CHAR (b, BUF_PT (b)) == '\n')
563 ? Qt : Qnil; 565 ? Qt : Qnil;
564 } 566 }
565 567
566 DEFUN ("char-after", Fchar_after, 0, 2, 0, /* 568 DEFUN ("char-after", Fchar_after, 0, 2, 0, /*
567 Return character in BUFFER at position POS. 569 Return the character at position POS in BUFFER.
568 POS is an integer or a buffer pointer. 570 POS is an integer or a marker.
569 If POS is out of range, the value is nil. 571 If POS is out of range, the value is nil.
572 if POS is nil, the value of point is assumed.
570 If BUFFER is nil, the current buffer is assumed. 573 If BUFFER is nil, the current buffer is assumed.
571 if POS is nil, the value of point is assumed.
572 */ 574 */
573 (pos, buffer)) 575 (pos, buffer))
574 { 576 {
575 struct buffer *b = decode_buffer (buffer, 1); 577 struct buffer *b = decode_buffer (buffer, 1);
576 Bufpos n = (NILP (pos) ? BUF_PT (b) : 578 Bufpos n = (NILP (pos) ? BUF_PT (b) :
580 return Qnil; 582 return Qnil;
581 return make_char (BUF_FETCH_CHAR (b, n)); 583 return make_char (BUF_FETCH_CHAR (b, n));
582 } 584 }
583 585
584 DEFUN ("char-before", Fchar_before, 0, 2, 0, /* 586 DEFUN ("char-before", Fchar_before, 0, 2, 0, /*
585 Return character in BUFFER before position POS. 587 Return the character preceding position POS in BUFFER.
586 POS is an integer or a buffer pointer. 588 POS is an integer or a marker.
587 If POS is out of range, the value is nil. 589 If POS is out of range, the value is nil.
590 if POS is nil, the value of point is assumed.
588 If BUFFER is nil, the current buffer is assumed. 591 If BUFFER is nil, the current buffer is assumed.
589 if POS is nil, the value of point is assumed.
590 */ 592 */
591 (pos, buffer)) 593 (pos, buffer))
592 { 594 {
593 struct buffer *b = decode_buffer (buffer, 1); 595 struct buffer *b = decode_buffer (buffer, 1);
594 Bufpos n = ((NILP (pos) ? BUF_PT (b) : 596 Bufpos n = (NILP (pos) ? BUF_PT (b) :
595 get_buffer_pos_char (b, pos, GB_NO_ERROR_IF_BAD))); 597 get_buffer_pos_char (b, pos, GB_NO_ERROR_IF_BAD));
596 598
597 n--; 599 n--;
598 600
599 if (n < BUF_BEGV (b)) 601 if (n < BUF_BEGV (b))
600 return Qnil; 602 return Qnil;
2229 ? DOWNCASE (b, x1) == DOWNCASE (b, x2) 2231 ? DOWNCASE (b, x1) == DOWNCASE (b, x2)
2230 : x1 == x2) 2232 : x1 == x2)
2231 ? Qt : Qnil; 2233 ? Qt : Qnil;
2232 } 2234 }
2233 2235
2234 DEFUN ("char=", Fchar_Equal, 2, 3, 0, /* 2236 DEFUN ("char=", Fchar_Equal, 2, 2, 0, /*
2235 Return t if two characters match, case is significant. 2237 Return t if two characters match, case is significant.
2236 Both arguments must be characters (i.e. NOT integers). 2238 Both arguments must be characters (i.e. NOT integers).
2237 The optional buffer argument is for symmetry and is ignored. 2239 */
2238 */ 2240 (c1, c2))
2239 (c1, c2, buffer))
2240 { 2241 {
2241 CHECK_CHAR_COERCE_INT (c1); 2242 CHECK_CHAR_COERCE_INT (c1);
2242 CHECK_CHAR_COERCE_INT (c2); 2243 CHECK_CHAR_COERCE_INT (c2);
2243 2244
2244 return XCHAR(c1) == XCHAR(c2) ? Qt : Qnil; 2245 return EQ (c1, c2) ? Qt : Qnil;
2245 } 2246 }
2246 2247
2247 #if 0 /* Undebugged FSFmacs code */ 2248 #if 0 /* Undebugged FSFmacs code */
2248 /* Transpose the markers in two regions of the current buffer, and 2249 /* Transpose the markers in two regions of the current buffer, and
2249 adjust the ones between them if necessary (i.e.: if the regions 2250 adjust the ones between them if necessary (i.e.: if the regions