diff options
| author | Karoly Lorentey | 2006-10-14 16:56:21 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-10-14 16:56:21 +0000 |
| commit | 3f87f67ee215ffeecbd2f53bd7f342cdf03f47df (patch) | |
| tree | 16f2af9111af08a94d608d96a957f5c3ec5effcc /src/editfns.c | |
| parent | 350e4fb815d7413ef6d339dd664014706f742927 (diff) | |
| parent | 7a210b69c7f92650c524766d1b9d3f3eefdd67c7 (diff) | |
| download | emacs-3f87f67ee215ffeecbd2f53bd7f342cdf03f47df.tar.gz emacs-3f87f67ee215ffeecbd2f53bd7f342cdf03f47df.zip | |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-371
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-372
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-373
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-374
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-375
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-376
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-377
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-378
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-379
Merge from erc--emacs--21
* emacs@sv.gnu.org/emacs--devo--0--patch-380
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-381
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-382
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-383
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-384
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-385
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-386
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-387
Fix ERC bug introduced in last patch
* emacs@sv.gnu.org/emacs--devo--0--patch-388
Update from erc--emacs--22
* emacs@sv.gnu.org/emacs--devo--0--patch-389
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-390
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-391
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-392
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-393
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-394
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-395
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-396
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-397
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-398
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-399
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-400
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-401
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-402
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-403
Rcirc update from Ryan Yeske
* emacs@sv.gnu.org/emacs--devo--0--patch-404
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-405
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-406
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-407
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-408
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-409
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-410
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-411
Miscellaneous tq-related fixes.
* emacs@sv.gnu.org/emacs--devo--0--patch-412
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-121
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-122
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-123
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-124
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-125
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-126
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-127
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-581
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 67 |
1 files changed, 30 insertions, 37 deletions
diff --git a/src/editfns.c b/src/editfns.c index aea044db068..c43528c4863 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -629,10 +629,7 @@ find_field (pos, merge_at_boundary, beg_limit, beg, end_limit, end) | |||
| 629 | DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0, | 629 | DEFUN ("delete-field", Fdelete_field, Sdelete_field, 0, 1, 0, |
| 630 | doc: /* Delete the field surrounding POS. | 630 | doc: /* Delete the field surrounding POS. |
| 631 | A field is a region of text with the same `field' property. | 631 | A field is a region of text with the same `field' property. |
| 632 | If POS is nil, the value of point is used for POS. | 632 | If POS is nil, the value of point is used for POS. */) |
| 633 | |||
| 634 | An `args-out-of-range' error is signaled if POS is outside the | ||
| 635 | buffer's accessible portion. */) | ||
| 636 | (pos) | 633 | (pos) |
| 637 | Lisp_Object pos; | 634 | Lisp_Object pos; |
| 638 | { | 635 | { |
| @@ -646,10 +643,7 @@ buffer's accessible portion. */) | |||
| 646 | DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0, | 643 | DEFUN ("field-string", Ffield_string, Sfield_string, 0, 1, 0, |
| 647 | doc: /* Return the contents of the field surrounding POS as a string. | 644 | doc: /* Return the contents of the field surrounding POS as a string. |
| 648 | A field is a region of text with the same `field' property. | 645 | A field is a region of text with the same `field' property. |
| 649 | If POS is nil, the value of point is used for POS. | 646 | If POS is nil, the value of point is used for POS. */) |
| 650 | |||
| 651 | An `args-out-of-range' error is signaled if POS is outside the | ||
| 652 | buffer's accessible portion. */) | ||
| 653 | (pos) | 647 | (pos) |
| 654 | Lisp_Object pos; | 648 | Lisp_Object pos; |
| 655 | { | 649 | { |
| @@ -661,10 +655,7 @@ buffer's accessible portion. */) | |||
| 661 | DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0, | 655 | DEFUN ("field-string-no-properties", Ffield_string_no_properties, Sfield_string_no_properties, 0, 1, 0, |
| 662 | doc: /* Return the contents of the field around POS, without text-properties. | 656 | doc: /* Return the contents of the field around POS, without text-properties. |
| 663 | A field is a region of text with the same `field' property. | 657 | A field is a region of text with the same `field' property. |
| 664 | If POS is nil, the value of point is used for POS. | 658 | If POS is nil, the value of point is used for POS. */) |
| 665 | |||
| 666 | An `args-out-of-range' error is signaled if POS is outside the | ||
| 667 | buffer's accessible portion. */) | ||
| 668 | (pos) | 659 | (pos) |
| 669 | Lisp_Object pos; | 660 | Lisp_Object pos; |
| 670 | { | 661 | { |
| @@ -680,10 +671,7 @@ If POS is nil, the value of point is used for POS. | |||
| 680 | If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its | 671 | If ESCAPE-FROM-EDGE is non-nil and POS is at the beginning of its |
| 681 | field, then the beginning of the *previous* field is returned. | 672 | field, then the beginning of the *previous* field is returned. |
| 682 | If LIMIT is non-nil, it is a buffer position; if the beginning of the field | 673 | If LIMIT is non-nil, it is a buffer position; if the beginning of the field |
| 683 | is before LIMIT, then LIMIT will be returned instead. | 674 | is before LIMIT, then LIMIT will be returned instead. */) |
| 684 | |||
| 685 | An `args-out-of-range' error is signaled if POS is outside the | ||
| 686 | buffer's accessible portion. */) | ||
| 687 | (pos, escape_from_edge, limit) | 675 | (pos, escape_from_edge, limit) |
| 688 | Lisp_Object pos, escape_from_edge, limit; | 676 | Lisp_Object pos, escape_from_edge, limit; |
| 689 | { | 677 | { |
| @@ -699,10 +687,7 @@ If POS is nil, the value of point is used for POS. | |||
| 699 | If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field, | 687 | If ESCAPE-FROM-EDGE is non-nil and POS is at the end of its field, |
| 700 | then the end of the *following* field is returned. | 688 | then the end of the *following* field is returned. |
| 701 | If LIMIT is non-nil, it is a buffer position; if the end of the field | 689 | If LIMIT is non-nil, it is a buffer position; if the end of the field |
| 702 | is after LIMIT, then LIMIT will be returned instead. | 690 | is after LIMIT, then LIMIT will be returned instead. */) |
| 703 | |||
| 704 | An `args-out-of-range' error is signaled if POS is outside the | ||
| 705 | buffer's accessible portion. */) | ||
| 706 | (pos, escape_from_edge, limit) | 691 | (pos, escape_from_edge, limit) |
| 707 | Lisp_Object pos, escape_from_edge, limit; | 692 | Lisp_Object pos, escape_from_edge, limit; |
| 708 | { | 693 | { |
| @@ -1450,14 +1435,11 @@ resolution finer than a second. */) | |||
| 1450 | () | 1435 | () |
| 1451 | { | 1436 | { |
| 1452 | EMACS_TIME t; | 1437 | EMACS_TIME t; |
| 1453 | Lisp_Object result[3]; | ||
| 1454 | 1438 | ||
| 1455 | EMACS_GET_TIME (t); | 1439 | EMACS_GET_TIME (t); |
| 1456 | XSETINT (result[0], (EMACS_SECS (t) >> 16) & 0xffff); | 1440 | return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff), |
| 1457 | XSETINT (result[1], (EMACS_SECS (t) >> 0) & 0xffff); | 1441 | make_number ((EMACS_SECS (t) >> 0) & 0xffff), |
| 1458 | XSETINT (result[2], EMACS_USECS (t)); | 1442 | make_number (EMACS_USECS (t))); |
| 1459 | |||
| 1460 | return Flist (3, result); | ||
| 1461 | } | 1443 | } |
| 1462 | 1444 | ||
| 1463 | DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time, | 1445 | DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time, |
| @@ -1475,7 +1457,6 @@ systems that do not provide resolution finer than a second. */) | |||
| 1475 | { | 1457 | { |
| 1476 | #ifdef HAVE_GETRUSAGE | 1458 | #ifdef HAVE_GETRUSAGE |
| 1477 | struct rusage usage; | 1459 | struct rusage usage; |
| 1478 | Lisp_Object result[3]; | ||
| 1479 | int secs, usecs; | 1460 | int secs, usecs; |
| 1480 | 1461 | ||
| 1481 | if (getrusage (RUSAGE_SELF, &usage) < 0) | 1462 | if (getrusage (RUSAGE_SELF, &usage) < 0) |
| @@ -1491,11 +1472,9 @@ systems that do not provide resolution finer than a second. */) | |||
| 1491 | secs++; | 1472 | secs++; |
| 1492 | } | 1473 | } |
| 1493 | 1474 | ||
| 1494 | XSETINT (result[0], (secs >> 16) & 0xffff); | 1475 | return list3 (make_number ((secs >> 16) & 0xffff), |
| 1495 | XSETINT (result[1], (secs >> 0) & 0xffff); | 1476 | make_number ((secs >> 0) & 0xffff), |
| 1496 | XSETINT (result[2], usecs); | 1477 | make_number (usecs)); |
| 1497 | |||
| 1498 | return Flist (3, result); | ||
| 1499 | #else | 1478 | #else |
| 1500 | return Fcurrent_time (); | 1479 | return Fcurrent_time (); |
| 1501 | #endif | 1480 | #endif |
| @@ -2706,6 +2685,10 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2706 | Lisp_Object start, end, fromchar, tochar, noundo; | 2685 | Lisp_Object start, end, fromchar, tochar, noundo; |
| 2707 | { | 2686 | { |
| 2708 | register int pos, pos_byte, stop, i, len, end_byte; | 2687 | register int pos, pos_byte, stop, i, len, end_byte; |
| 2688 | /* Keep track of the first change in the buffer: | ||
| 2689 | if 0 we haven't found it yet. | ||
| 2690 | if < 0 we've found it and we've run the before-change-function. | ||
| 2691 | if > 0 we've actually performed it and the value is its position. */ | ||
| 2709 | int changed = 0; | 2692 | int changed = 0; |
| 2710 | unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH]; | 2693 | unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH]; |
| 2711 | unsigned char *p; | 2694 | unsigned char *p; |
| @@ -2718,6 +2701,8 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2718 | int last_changed = 0; | 2701 | int last_changed = 0; |
| 2719 | int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); | 2702 | int multibyte_p = !NILP (current_buffer->enable_multibyte_characters); |
| 2720 | 2703 | ||
| 2704 | restart: | ||
| 2705 | |||
| 2721 | validate_region (&start, &end); | 2706 | validate_region (&start, &end); |
| 2722 | CHECK_NUMBER (fromchar); | 2707 | CHECK_NUMBER (fromchar); |
| 2723 | CHECK_NUMBER (tochar); | 2708 | CHECK_NUMBER (tochar); |
| @@ -2755,7 +2740,7 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2755 | That's faster than getting rid of things, | 2740 | That's faster than getting rid of things, |
| 2756 | and it prevents even the entry for a first change. | 2741 | and it prevents even the entry for a first change. |
| 2757 | Also inhibit locking the file. */ | 2742 | Also inhibit locking the file. */ |
| 2758 | if (!NILP (noundo)) | 2743 | if (!changed && !NILP (noundo)) |
| 2759 | { | 2744 | { |
| 2760 | record_unwind_protect (subst_char_in_region_unwind, | 2745 | record_unwind_protect (subst_char_in_region_unwind, |
| 2761 | current_buffer->undo_list); | 2746 | current_buffer->undo_list); |
| @@ -2789,10 +2774,14 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2789 | && (len == 2 || (p[2] == fromstr[2] | 2774 | && (len == 2 || (p[2] == fromstr[2] |
| 2790 | && (len == 3 || p[3] == fromstr[3])))))) | 2775 | && (len == 3 || p[3] == fromstr[3])))))) |
| 2791 | { | 2776 | { |
| 2792 | if (! changed) | 2777 | if (changed < 0) |
| 2778 | /* We've already seen this and run the before-change-function; | ||
| 2779 | this time we only need to record the actual position. */ | ||
| 2780 | changed = pos; | ||
| 2781 | else if (!changed) | ||
| 2793 | { | 2782 | { |
| 2794 | changed = pos; | 2783 | changed = -1; |
| 2795 | modify_region (current_buffer, changed, XINT (end)); | 2784 | modify_region (current_buffer, pos, XINT (end)); |
| 2796 | 2785 | ||
| 2797 | if (! NILP (noundo)) | 2786 | if (! NILP (noundo)) |
| 2798 | { | 2787 | { |
| @@ -2801,6 +2790,10 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2801 | if (MODIFF - 1 == current_buffer->auto_save_modified) | 2790 | if (MODIFF - 1 == current_buffer->auto_save_modified) |
| 2802 | current_buffer->auto_save_modified++; | 2791 | current_buffer->auto_save_modified++; |
| 2803 | } | 2792 | } |
| 2793 | |||
| 2794 | /* The before-change-function may have moved the gap | ||
| 2795 | or even modified the buffer so we should start over. */ | ||
| 2796 | goto restart; | ||
| 2804 | } | 2797 | } |
| 2805 | 2798 | ||
| 2806 | /* Take care of the case where the new character | 2799 | /* Take care of the case where the new character |
| @@ -2853,7 +2846,7 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2853 | pos++; | 2846 | pos++; |
| 2854 | } | 2847 | } |
| 2855 | 2848 | ||
| 2856 | if (changed) | 2849 | if (changed > 0) |
| 2857 | { | 2850 | { |
| 2858 | signal_after_change (changed, | 2851 | signal_after_change (changed, |
| 2859 | last_changed - changed, last_changed - changed); | 2852 | last_changed - changed, last_changed - changed); |