diff options
| author | Kenichi Handa | 2012-07-17 07:09:08 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2012-07-17 07:09:08 +0900 |
| commit | 8c536f15bf95916d56bb50495d22b7da7e09fff9 (patch) | |
| tree | ac6f8bf5103bdbd1d6a75f05def9bc7aa9e96547 /src/buffer.c | |
| parent | 21a8caaa4af24f258e6c7f80c1fc913b00aee044 (diff) | |
| parent | c05cf3902ae658cc8bf413124245c9e1cdcca2d7 (diff) | |
| download | emacs-8c536f15bf95916d56bb50495d22b7da7e09fff9.tar.gz emacs-8c536f15bf95916d56bb50495d22b7da7e09fff9.zip | |
merge trunk
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 384 |
1 files changed, 203 insertions, 181 deletions
diff --git a/src/buffer.c b/src/buffer.c index 2ddbc699481..386d9a78153 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -154,7 +154,7 @@ Lisp_Object Qinsert_behind_hooks; | |||
| 154 | static void alloc_buffer_text (struct buffer *, ptrdiff_t); | 154 | static void alloc_buffer_text (struct buffer *, ptrdiff_t); |
| 155 | static void free_buffer_text (struct buffer *b); | 155 | static void free_buffer_text (struct buffer *b); |
| 156 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); | 156 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); |
| 157 | static void modify_overlay (struct buffer *, EMACS_INT, EMACS_INT); | 157 | static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 158 | static Lisp_Object buffer_lisp_local_variables (struct buffer *); | 158 | static Lisp_Object buffer_lisp_local_variables (struct buffer *); |
| 159 | 159 | ||
| 160 | /* For debugging; temporary. See set_buffer_internal. */ | 160 | /* For debugging; temporary. See set_buffer_internal. */ |
| @@ -418,7 +418,7 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list) | |||
| 418 | for (; list; list = list->next) | 418 | for (; list; list = list->next) |
| 419 | { | 419 | { |
| 420 | Lisp_Object overlay, start, end, old_overlay; | 420 | Lisp_Object overlay, start, end, old_overlay; |
| 421 | EMACS_INT charpos; | 421 | ptrdiff_t charpos; |
| 422 | 422 | ||
| 423 | XSETMISC (old_overlay, list); | 423 | XSETMISC (old_overlay, list); |
| 424 | charpos = marker_position (OVERLAY_START (old_overlay)); | 424 | charpos = marker_position (OVERLAY_START (old_overlay)); |
| @@ -852,8 +852,8 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) | |||
| 852 | (register Lisp_Object name, Lisp_Object ignore) | 852 | (register Lisp_Object name, Lisp_Object ignore) |
| 853 | { | 853 | { |
| 854 | register Lisp_Object gentemp, tem; | 854 | register Lisp_Object gentemp, tem; |
| 855 | EMACS_INT count; | 855 | ptrdiff_t count; |
| 856 | char number[INT_BUFSIZE_BOUND (EMACS_INT) + sizeof "<>"]; | 856 | char number[INT_BUFSIZE_BOUND (ptrdiff_t) + sizeof "<>"]; |
| 857 | 857 | ||
| 858 | CHECK_STRING (name); | 858 | CHECK_STRING (name); |
| 859 | 859 | ||
| @@ -867,7 +867,7 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) | |||
| 867 | count = 1; | 867 | count = 1; |
| 868 | while (1) | 868 | while (1) |
| 869 | { | 869 | { |
| 870 | sprintf (number, "<%"pI"d>", ++count); | 870 | sprintf (number, "<%"pD"d>", ++count); |
| 871 | gentemp = concat2 (name, build_string (number)); | 871 | gentemp = concat2 (name, build_string (number)); |
| 872 | tem = Fstring_equal (gentemp, ignore); | 872 | tem = Fstring_equal (gentemp, ignore); |
| 873 | if (!NILP (tem)) | 873 | if (!NILP (tem)) |
| @@ -933,6 +933,21 @@ If VARIABLE does not have a buffer-local binding in BUFFER, the value | |||
| 933 | is the default binding of the variable. */) | 933 | is the default binding of the variable. */) |
| 934 | (register Lisp_Object variable, register Lisp_Object buffer) | 934 | (register Lisp_Object variable, register Lisp_Object buffer) |
| 935 | { | 935 | { |
| 936 | register Lisp_Object result = buffer_local_value_1 (variable, buffer); | ||
| 937 | |||
| 938 | if (EQ (result, Qunbound)) | ||
| 939 | xsignal1 (Qvoid_variable, variable); | ||
| 940 | |||
| 941 | return result; | ||
| 942 | } | ||
| 943 | |||
| 944 | |||
| 945 | /* Like Fbuffer_local_value, but return Qunbound if the variable is | ||
| 946 | locally unbound. */ | ||
| 947 | |||
| 948 | Lisp_Object | ||
| 949 | buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer) | ||
| 950 | { | ||
| 936 | register struct buffer *buf; | 951 | register struct buffer *buf; |
| 937 | register Lisp_Object result; | 952 | register Lisp_Object result; |
| 938 | struct Lisp_Symbol *sym; | 953 | struct Lisp_Symbol *sym; |
| @@ -985,10 +1000,7 @@ is the default binding of the variable. */) | |||
| 985 | default: abort (); | 1000 | default: abort (); |
| 986 | } | 1001 | } |
| 987 | 1002 | ||
| 988 | if (!EQ (result, Qunbound)) | 1003 | return result; |
| 989 | return result; | ||
| 990 | |||
| 991 | xsignal1 (Qvoid_variable, variable); | ||
| 992 | } | 1004 | } |
| 993 | 1005 | ||
| 994 | /* Return an alist of the Lisp-level buffer-local bindings of | 1006 | /* Return an alist of the Lisp-level buffer-local bindings of |
| @@ -1475,7 +1487,7 @@ with SIGHUP. */) | |||
| 1475 | 1487 | ||
| 1476 | /* Run hooks with the buffer to be killed the current buffer. */ | 1488 | /* Run hooks with the buffer to be killed the current buffer. */ |
| 1477 | { | 1489 | { |
| 1478 | int count = SPECPDL_INDEX (); | 1490 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1479 | Lisp_Object arglist[1]; | 1491 | Lisp_Object arglist[1]; |
| 1480 | 1492 | ||
| 1481 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 1493 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| @@ -1751,7 +1763,7 @@ Use this function before selecting the buffer, since it may need to inspect | |||
| 1751 | the current buffer's major mode. */) | 1763 | the current buffer's major mode. */) |
| 1752 | (Lisp_Object buffer) | 1764 | (Lisp_Object buffer) |
| 1753 | { | 1765 | { |
| 1754 | int count; | 1766 | ptrdiff_t count; |
| 1755 | Lisp_Object function; | 1767 | Lisp_Object function; |
| 1756 | 1768 | ||
| 1757 | CHECK_BUFFER (buffer); | 1769 | CHECK_BUFFER (buffer); |
| @@ -1963,16 +1975,15 @@ validate_region (register Lisp_Object *b, register Lisp_Object *e) | |||
| 1963 | tem = *b; *b = *e; *e = tem; | 1975 | tem = *b; *b = *e; *e = tem; |
| 1964 | } | 1976 | } |
| 1965 | 1977 | ||
| 1966 | if (!(BEGV <= XINT (*b) && XINT (*b) <= XINT (*e) | 1978 | if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV)) |
| 1967 | && XINT (*e) <= ZV)) | ||
| 1968 | args_out_of_range (*b, *e); | 1979 | args_out_of_range (*b, *e); |
| 1969 | } | 1980 | } |
| 1970 | 1981 | ||
| 1971 | /* Advance BYTE_POS up to a character boundary | 1982 | /* Advance BYTE_POS up to a character boundary |
| 1972 | and return the adjusted position. */ | 1983 | and return the adjusted position. */ |
| 1973 | 1984 | ||
| 1974 | static EMACS_INT | 1985 | static ptrdiff_t |
| 1975 | advance_to_char_boundary (EMACS_INT byte_pos) | 1986 | advance_to_char_boundary (ptrdiff_t byte_pos) |
| 1976 | { | 1987 | { |
| 1977 | int c; | 1988 | int c; |
| 1978 | 1989 | ||
| @@ -1985,7 +1996,7 @@ advance_to_char_boundary (EMACS_INT byte_pos) | |||
| 1985 | { | 1996 | { |
| 1986 | /* We should advance BYTE_POS only when C is a constituent of a | 1997 | /* We should advance BYTE_POS only when C is a constituent of a |
| 1987 | multibyte sequence. */ | 1998 | multibyte sequence. */ |
| 1988 | EMACS_INT orig_byte_pos = byte_pos; | 1999 | ptrdiff_t orig_byte_pos = byte_pos; |
| 1989 | 2000 | ||
| 1990 | do | 2001 | do |
| 1991 | { | 2002 | { |
| @@ -2051,18 +2062,18 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2051 | eassert (current_buffer->text == ¤t_buffer->own_text); | 2062 | eassert (current_buffer->text == ¤t_buffer->own_text); |
| 2052 | eassert (other_buffer->text == &other_buffer->own_text); | 2063 | eassert (other_buffer->text == &other_buffer->own_text); |
| 2053 | #ifdef REL_ALLOC | 2064 | #ifdef REL_ALLOC |
| 2054 | r_alloc_reset_variable ((POINTER_TYPE **) ¤t_buffer->own_text.beg, | 2065 | r_alloc_reset_variable ((void **) ¤t_buffer->own_text.beg, |
| 2055 | (POINTER_TYPE **) &other_buffer->own_text.beg); | 2066 | (void **) &other_buffer->own_text.beg); |
| 2056 | r_alloc_reset_variable ((POINTER_TYPE **) &other_buffer->own_text.beg, | 2067 | r_alloc_reset_variable ((void **) &other_buffer->own_text.beg, |
| 2057 | (POINTER_TYPE **) ¤t_buffer->own_text.beg); | 2068 | (void **) ¤t_buffer->own_text.beg); |
| 2058 | #endif /* REL_ALLOC */ | 2069 | #endif /* REL_ALLOC */ |
| 2059 | 2070 | ||
| 2060 | swapfield (pt, EMACS_INT); | 2071 | swapfield (pt, ptrdiff_t); |
| 2061 | swapfield (pt_byte, EMACS_INT); | 2072 | swapfield (pt_byte, ptrdiff_t); |
| 2062 | swapfield (begv, EMACS_INT); | 2073 | swapfield (begv, ptrdiff_t); |
| 2063 | swapfield (begv_byte, EMACS_INT); | 2074 | swapfield (begv_byte, ptrdiff_t); |
| 2064 | swapfield (zv, EMACS_INT); | 2075 | swapfield (zv, ptrdiff_t); |
| 2065 | swapfield (zv_byte, EMACS_INT); | 2076 | swapfield (zv_byte, ptrdiff_t); |
| 2066 | eassert (!current_buffer->base_buffer); | 2077 | eassert (!current_buffer->base_buffer); |
| 2067 | eassert (!other_buffer->base_buffer); | 2078 | eassert (!other_buffer->base_buffer); |
| 2068 | current_buffer->clip_changed = 1; other_buffer->clip_changed = 1; | 2079 | current_buffer->clip_changed = 1; other_buffer->clip_changed = 1; |
| @@ -2072,7 +2083,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2072 | other_buffer->prevent_redisplay_optimizations_p = 1; | 2083 | other_buffer->prevent_redisplay_optimizations_p = 1; |
| 2073 | swapfield (overlays_before, struct Lisp_Overlay *); | 2084 | swapfield (overlays_before, struct Lisp_Overlay *); |
| 2074 | swapfield (overlays_after, struct Lisp_Overlay *); | 2085 | swapfield (overlays_after, struct Lisp_Overlay *); |
| 2075 | swapfield (overlay_center, EMACS_INT); | 2086 | swapfield (overlay_center, ptrdiff_t); |
| 2076 | swapfield_ (undo_list, Lisp_Object); | 2087 | swapfield_ (undo_list, Lisp_Object); |
| 2077 | swapfield_ (mark, Lisp_Object); | 2088 | swapfield_ (mark, Lisp_Object); |
| 2078 | swapfield_ (enable_multibyte_characters, Lisp_Object); | 2089 | swapfield_ (enable_multibyte_characters, Lisp_Object); |
| @@ -2155,7 +2166,7 @@ current buffer is cleared. */) | |||
| 2155 | { | 2166 | { |
| 2156 | struct Lisp_Marker *tail, *markers; | 2167 | struct Lisp_Marker *tail, *markers; |
| 2157 | struct buffer *other; | 2168 | struct buffer *other; |
| 2158 | EMACS_INT begv, zv; | 2169 | ptrdiff_t begv, zv; |
| 2159 | int narrowed = (BEG != BEGV || Z != ZV); | 2170 | int narrowed = (BEG != BEGV || Z != ZV); |
| 2160 | int modified_p = !NILP (Fbuffer_modified_p (Qnil)); | 2171 | int modified_p = !NILP (Fbuffer_modified_p (Qnil)); |
| 2161 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); | 2172 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); |
| @@ -2187,7 +2198,7 @@ current buffer is cleared. */) | |||
| 2187 | 2198 | ||
| 2188 | if (NILP (flag)) | 2199 | if (NILP (flag)) |
| 2189 | { | 2200 | { |
| 2190 | EMACS_INT pos, stop; | 2201 | ptrdiff_t pos, stop; |
| 2191 | unsigned char *p; | 2202 | unsigned char *p; |
| 2192 | 2203 | ||
| 2193 | /* Do this first, so it can use CHAR_TO_BYTE | 2204 | /* Do this first, so it can use CHAR_TO_BYTE |
| @@ -2251,8 +2262,8 @@ current buffer is cleared. */) | |||
| 2251 | } | 2262 | } |
| 2252 | else | 2263 | else |
| 2253 | { | 2264 | { |
| 2254 | EMACS_INT pt = PT; | 2265 | ptrdiff_t pt = PT; |
| 2255 | EMACS_INT pos, stop; | 2266 | ptrdiff_t pos, stop; |
| 2256 | unsigned char *p, *pend; | 2267 | unsigned char *p, *pend; |
| 2257 | 2268 | ||
| 2258 | /* Be sure not to have a multibyte sequence striding over the GAP. | 2269 | /* Be sure not to have a multibyte sequence striding over the GAP. |
| @@ -2268,7 +2279,7 @@ current buffer is cleared. */) | |||
| 2268 | while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--; | 2279 | while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--; |
| 2269 | if (LEADING_CODE_P (*q)) | 2280 | if (LEADING_CODE_P (*q)) |
| 2270 | { | 2281 | { |
| 2271 | EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - q); | 2282 | ptrdiff_t new_gpt = GPT_BYTE - (GPT_ADDR - q); |
| 2272 | 2283 | ||
| 2273 | move_gap_both (new_gpt, new_gpt); | 2284 | move_gap_both (new_gpt, new_gpt); |
| 2274 | } | 2285 | } |
| @@ -2352,8 +2363,8 @@ current buffer is cleared. */) | |||
| 2352 | ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; | 2363 | ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; |
| 2353 | 2364 | ||
| 2354 | { | 2365 | { |
| 2355 | EMACS_INT byte = advance_to_char_boundary (PT_BYTE); | 2366 | ptrdiff_t byte = advance_to_char_boundary (PT_BYTE); |
| 2356 | EMACS_INT position; | 2367 | ptrdiff_t position; |
| 2357 | 2368 | ||
| 2358 | if (byte > GPT_BYTE) | 2369 | if (byte > GPT_BYTE) |
| 2359 | position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT; | 2370 | position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT; |
| @@ -2517,20 +2528,20 @@ swap_out_buffer_local_variables (struct buffer *b) | |||
| 2517 | ptrdiff_t | 2528 | ptrdiff_t |
| 2518 | overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | 2529 | overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, |
| 2519 | ptrdiff_t *len_ptr, | 2530 | ptrdiff_t *len_ptr, |
| 2520 | EMACS_INT *next_ptr, EMACS_INT *prev_ptr, int change_req) | 2531 | ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, int change_req) |
| 2521 | { | 2532 | { |
| 2522 | Lisp_Object overlay, start, end; | 2533 | Lisp_Object overlay, start, end; |
| 2523 | struct Lisp_Overlay *tail; | 2534 | struct Lisp_Overlay *tail; |
| 2524 | ptrdiff_t idx = 0; | 2535 | ptrdiff_t idx = 0; |
| 2525 | ptrdiff_t len = *len_ptr; | 2536 | ptrdiff_t len = *len_ptr; |
| 2526 | Lisp_Object *vec = *vec_ptr; | 2537 | Lisp_Object *vec = *vec_ptr; |
| 2527 | EMACS_INT next = ZV; | 2538 | ptrdiff_t next = ZV; |
| 2528 | EMACS_INT prev = BEGV; | 2539 | ptrdiff_t prev = BEGV; |
| 2529 | int inhibit_storing = 0; | 2540 | int inhibit_storing = 0; |
| 2530 | 2541 | ||
| 2531 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2542 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2532 | { | 2543 | { |
| 2533 | EMACS_INT startpos, endpos; | 2544 | ptrdiff_t startpos, endpos; |
| 2534 | 2545 | ||
| 2535 | XSETMISC (overlay, tail); | 2546 | XSETMISC (overlay, tail); |
| 2536 | 2547 | ||
| @@ -2578,7 +2589,7 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | |||
| 2578 | 2589 | ||
| 2579 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 2590 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 2580 | { | 2591 | { |
| 2581 | EMACS_INT startpos, endpos; | 2592 | ptrdiff_t startpos, endpos; |
| 2582 | 2593 | ||
| 2583 | XSETMISC (overlay, tail); | 2594 | XSETMISC (overlay, tail); |
| 2584 | 2595 | ||
| @@ -2651,21 +2662,21 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | |||
| 2651 | static ptrdiff_t | 2662 | static ptrdiff_t |
| 2652 | overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | 2663 | overlays_in (EMACS_INT beg, EMACS_INT end, int extend, |
| 2653 | Lisp_Object **vec_ptr, ptrdiff_t *len_ptr, | 2664 | Lisp_Object **vec_ptr, ptrdiff_t *len_ptr, |
| 2654 | EMACS_INT *next_ptr, EMACS_INT *prev_ptr) | 2665 | ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr) |
| 2655 | { | 2666 | { |
| 2656 | Lisp_Object overlay, ostart, oend; | 2667 | Lisp_Object overlay, ostart, oend; |
| 2657 | struct Lisp_Overlay *tail; | 2668 | struct Lisp_Overlay *tail; |
| 2658 | ptrdiff_t idx = 0; | 2669 | ptrdiff_t idx = 0; |
| 2659 | ptrdiff_t len = *len_ptr; | 2670 | ptrdiff_t len = *len_ptr; |
| 2660 | Lisp_Object *vec = *vec_ptr; | 2671 | Lisp_Object *vec = *vec_ptr; |
| 2661 | EMACS_INT next = ZV; | 2672 | ptrdiff_t next = ZV; |
| 2662 | EMACS_INT prev = BEGV; | 2673 | ptrdiff_t prev = BEGV; |
| 2663 | int inhibit_storing = 0; | 2674 | int inhibit_storing = 0; |
| 2664 | int end_is_Z = end == Z; | 2675 | int end_is_Z = end == Z; |
| 2665 | 2676 | ||
| 2666 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2677 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2667 | { | 2678 | { |
| 2668 | EMACS_INT startpos, endpos; | 2679 | ptrdiff_t startpos, endpos; |
| 2669 | 2680 | ||
| 2670 | XSETMISC (overlay, tail); | 2681 | XSETMISC (overlay, tail); |
| 2671 | 2682 | ||
| @@ -2712,7 +2723,7 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | |||
| 2712 | 2723 | ||
| 2713 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 2724 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 2714 | { | 2725 | { |
| 2715 | EMACS_INT startpos, endpos; | 2726 | ptrdiff_t startpos, endpos; |
| 2716 | 2727 | ||
| 2717 | XSETMISC (overlay, tail); | 2728 | XSETMISC (overlay, tail); |
| 2718 | 2729 | ||
| @@ -2768,8 +2779,8 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | |||
| 2768 | int | 2779 | int |
| 2769 | mouse_face_overlay_overlaps (Lisp_Object overlay) | 2780 | mouse_face_overlay_overlaps (Lisp_Object overlay) |
| 2770 | { | 2781 | { |
| 2771 | EMACS_INT start = OVERLAY_POSITION (OVERLAY_START (overlay)); | 2782 | ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 2772 | EMACS_INT end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 2783 | ptrdiff_t end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 2773 | ptrdiff_t n, i, size; | 2784 | ptrdiff_t n, i, size; |
| 2774 | Lisp_Object *v, tem; | 2785 | Lisp_Object *v, tem; |
| 2775 | 2786 | ||
| @@ -2795,14 +2806,14 @@ mouse_face_overlay_overlaps (Lisp_Object overlay) | |||
| 2795 | 2806 | ||
| 2796 | /* Fast function to just test if we're at an overlay boundary. */ | 2807 | /* Fast function to just test if we're at an overlay boundary. */ |
| 2797 | int | 2808 | int |
| 2798 | overlay_touches_p (EMACS_INT pos) | 2809 | overlay_touches_p (ptrdiff_t pos) |
| 2799 | { | 2810 | { |
| 2800 | Lisp_Object overlay; | 2811 | Lisp_Object overlay; |
| 2801 | struct Lisp_Overlay *tail; | 2812 | struct Lisp_Overlay *tail; |
| 2802 | 2813 | ||
| 2803 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2814 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2804 | { | 2815 | { |
| 2805 | EMACS_INT endpos; | 2816 | ptrdiff_t endpos; |
| 2806 | 2817 | ||
| 2807 | XSETMISC (overlay ,tail); | 2818 | XSETMISC (overlay ,tail); |
| 2808 | if (!OVERLAYP (overlay)) | 2819 | if (!OVERLAYP (overlay)) |
| @@ -2817,7 +2828,7 @@ overlay_touches_p (EMACS_INT pos) | |||
| 2817 | 2828 | ||
| 2818 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 2829 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 2819 | { | 2830 | { |
| 2820 | EMACS_INT startpos; | 2831 | ptrdiff_t startpos; |
| 2821 | 2832 | ||
| 2822 | XSETMISC (overlay, tail); | 2833 | XSETMISC (overlay, tail); |
| 2823 | if (!OVERLAYP (overlay)) | 2834 | if (!OVERLAYP (overlay)) |
| @@ -2835,7 +2846,7 @@ overlay_touches_p (EMACS_INT pos) | |||
| 2835 | struct sortvec | 2846 | struct sortvec |
| 2836 | { | 2847 | { |
| 2837 | Lisp_Object overlay; | 2848 | Lisp_Object overlay; |
| 2838 | EMACS_INT beg, end; | 2849 | ptrdiff_t beg, end; |
| 2839 | EMACS_INT priority; | 2850 | EMACS_INT priority; |
| 2840 | }; | 2851 | }; |
| 2841 | 2852 | ||
| @@ -2958,7 +2969,7 @@ static void | |||
| 2958 | record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, | 2969 | record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, |
| 2959 | Lisp_Object str2, Lisp_Object pri, ptrdiff_t size) | 2970 | Lisp_Object str2, Lisp_Object pri, ptrdiff_t size) |
| 2960 | { | 2971 | { |
| 2961 | EMACS_INT nbytes; | 2972 | ptrdiff_t nbytes; |
| 2962 | 2973 | ||
| 2963 | if (ssl->used == ssl->size) | 2974 | if (ssl->used == ssl->size) |
| 2964 | ssl->buf = xpalloc (ssl->buf, &ssl->size, 5, -1, sizeof *ssl->buf); | 2975 | ssl->buf = xpalloc (ssl->buf, &ssl->size, 5, -1, sizeof *ssl->buf); |
| @@ -3008,12 +3019,12 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, | |||
| 3008 | PSTR, if that variable is non-null. The string may be overwritten by | 3019 | PSTR, if that variable is non-null. The string may be overwritten by |
| 3009 | subsequent calls. */ | 3020 | subsequent calls. */ |
| 3010 | 3021 | ||
| 3011 | EMACS_INT | 3022 | ptrdiff_t |
| 3012 | overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | 3023 | overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr) |
| 3013 | { | 3024 | { |
| 3014 | Lisp_Object overlay, window, str; | 3025 | Lisp_Object overlay, window, str; |
| 3015 | struct Lisp_Overlay *ov; | 3026 | struct Lisp_Overlay *ov; |
| 3016 | EMACS_INT startpos, endpos; | 3027 | ptrdiff_t startpos, endpos; |
| 3017 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 3028 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3018 | 3029 | ||
| 3019 | overlay_heads.used = overlay_heads.bytes = 0; | 3030 | overlay_heads.used = overlay_heads.bytes = 0; |
| @@ -3083,7 +3094,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3083 | if (overlay_heads.bytes || overlay_tails.bytes) | 3094 | if (overlay_heads.bytes || overlay_tails.bytes) |
| 3084 | { | 3095 | { |
| 3085 | Lisp_Object tem; | 3096 | Lisp_Object tem; |
| 3086 | EMACS_INT i; | 3097 | ptrdiff_t i; |
| 3087 | unsigned char *p; | 3098 | unsigned char *p; |
| 3088 | ptrdiff_t total; | 3099 | ptrdiff_t total; |
| 3089 | 3100 | ||
| @@ -3097,7 +3108,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3097 | p = overlay_str_buf; | 3108 | p = overlay_str_buf; |
| 3098 | for (i = overlay_tails.used; --i >= 0;) | 3109 | for (i = overlay_tails.used; --i >= 0;) |
| 3099 | { | 3110 | { |
| 3100 | EMACS_INT nbytes; | 3111 | ptrdiff_t nbytes; |
| 3101 | tem = overlay_tails.buf[i].string; | 3112 | tem = overlay_tails.buf[i].string; |
| 3102 | nbytes = copy_text (SDATA (tem), p, | 3113 | nbytes = copy_text (SDATA (tem), p, |
| 3103 | SBYTES (tem), | 3114 | SBYTES (tem), |
| @@ -3106,7 +3117,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3106 | } | 3117 | } |
| 3107 | for (i = 0; i < overlay_heads.used; ++i) | 3118 | for (i = 0; i < overlay_heads.used; ++i) |
| 3108 | { | 3119 | { |
| 3109 | EMACS_INT nbytes; | 3120 | ptrdiff_t nbytes; |
| 3110 | tem = overlay_heads.buf[i].string; | 3121 | tem = overlay_heads.buf[i].string; |
| 3111 | nbytes = copy_text (SDATA (tem), p, | 3122 | nbytes = copy_text (SDATA (tem), p, |
| 3112 | SBYTES (tem), | 3123 | SBYTES (tem), |
| @@ -3133,7 +3144,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3133 | /* Shift overlays in BUF's overlay lists, to center the lists at POS. */ | 3144 | /* Shift overlays in BUF's overlay lists, to center the lists at POS. */ |
| 3134 | 3145 | ||
| 3135 | void | 3146 | void |
| 3136 | recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) | 3147 | recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos) |
| 3137 | { | 3148 | { |
| 3138 | Lisp_Object overlay, beg, end; | 3149 | Lisp_Object overlay, beg, end; |
| 3139 | struct Lisp_Overlay *prev, *tail, *next; | 3150 | struct Lisp_Overlay *prev, *tail, *next; |
| @@ -3171,7 +3182,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) | |||
| 3171 | if (OVERLAY_POSITION (end) > pos) | 3182 | if (OVERLAY_POSITION (end) > pos) |
| 3172 | { | 3183 | { |
| 3173 | /* OVERLAY needs to be moved. */ | 3184 | /* OVERLAY needs to be moved. */ |
| 3174 | EMACS_INT where = OVERLAY_POSITION (beg); | 3185 | ptrdiff_t where = OVERLAY_POSITION (beg); |
| 3175 | struct Lisp_Overlay *other, *other_prev; | 3186 | struct Lisp_Overlay *other, *other_prev; |
| 3176 | 3187 | ||
| 3177 | /* Splice the cons cell TAIL out of overlays_before. */ | 3188 | /* Splice the cons cell TAIL out of overlays_before. */ |
| @@ -3244,7 +3255,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) | |||
| 3244 | if (OVERLAY_POSITION (end) <= pos) | 3255 | if (OVERLAY_POSITION (end) <= pos) |
| 3245 | { | 3256 | { |
| 3246 | /* OVERLAY needs to be moved. */ | 3257 | /* OVERLAY needs to be moved. */ |
| 3247 | EMACS_INT where = OVERLAY_POSITION (end); | 3258 | ptrdiff_t where = OVERLAY_POSITION (end); |
| 3248 | struct Lisp_Overlay *other, *other_prev; | 3259 | struct Lisp_Overlay *other, *other_prev; |
| 3249 | 3260 | ||
| 3250 | /* Splice the cons cell TAIL out of overlays_after. */ | 3261 | /* Splice the cons cell TAIL out of overlays_after. */ |
| @@ -3282,7 +3293,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) | |||
| 3282 | } | 3293 | } |
| 3283 | 3294 | ||
| 3284 | void | 3295 | void |
| 3285 | adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length) | 3296 | adjust_overlays_for_insert (ptrdiff_t pos, ptrdiff_t length) |
| 3286 | { | 3297 | { |
| 3287 | /* After an insertion, the lists are still sorted properly, | 3298 | /* After an insertion, the lists are still sorted properly, |
| 3288 | but we may need to update the value of the overlay center. */ | 3299 | but we may need to update the value of the overlay center. */ |
| @@ -3291,13 +3302,13 @@ adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length) | |||
| 3291 | } | 3302 | } |
| 3292 | 3303 | ||
| 3293 | void | 3304 | void |
| 3294 | adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length) | 3305 | adjust_overlays_for_delete (ptrdiff_t pos, ptrdiff_t length) |
| 3295 | { | 3306 | { |
| 3296 | if (current_buffer->overlay_center < pos) | 3307 | if (current_buffer->overlay_center < pos) |
| 3297 | /* The deletion was to our right. No change needed; the before- and | 3308 | /* The deletion was to our right. No change needed; the before- and |
| 3298 | after-lists are still consistent. */ | 3309 | after-lists are still consistent. */ |
| 3299 | ; | 3310 | ; |
| 3300 | else if (current_buffer->overlay_center > pos + length) | 3311 | else if (current_buffer->overlay_center - pos > length) |
| 3301 | /* The deletion was to our left. We need to adjust the center value | 3312 | /* The deletion was to our left. We need to adjust the center value |
| 3302 | to account for the change in position, but the lists are consistent | 3313 | to account for the change in position, but the lists are consistent |
| 3303 | given the new value. */ | 3314 | given the new value. */ |
| @@ -3316,7 +3327,7 @@ adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length) | |||
| 3316 | Such an overlay might even have negative size at this point. | 3327 | Such an overlay might even have negative size at this point. |
| 3317 | If so, we'll make the overlay empty. */ | 3328 | If so, we'll make the overlay empty. */ |
| 3318 | void | 3329 | void |
| 3319 | fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) | 3330 | fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end) |
| 3320 | { | 3331 | { |
| 3321 | Lisp_Object overlay; | 3332 | Lisp_Object overlay; |
| 3322 | struct Lisp_Overlay *before_list IF_LINT (= NULL); | 3333 | struct Lisp_Overlay *before_list IF_LINT (= NULL); |
| @@ -3329,7 +3340,7 @@ fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) | |||
| 3329 | current_buffer->overlays_before or overlays_after, depending | 3340 | current_buffer->overlays_before or overlays_after, depending |
| 3330 | which loop we're in. */ | 3341 | which loop we're in. */ |
| 3331 | struct Lisp_Overlay *tail, *parent; | 3342 | struct Lisp_Overlay *tail, *parent; |
| 3332 | EMACS_INT startpos, endpos; | 3343 | ptrdiff_t startpos, endpos; |
| 3333 | 3344 | ||
| 3334 | /* This algorithm shifts links around instead of consing and GCing. | 3345 | /* This algorithm shifts links around instead of consing and GCing. |
| 3335 | The loop invariant is that before_list (resp. after_list) is a | 3346 | The loop invariant is that before_list (resp. after_list) is a |
| @@ -3463,12 +3474,12 @@ fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) | |||
| 3463 | was at PREV, and now is at POS. */ | 3474 | was at PREV, and now is at POS. */ |
| 3464 | 3475 | ||
| 3465 | void | 3476 | void |
| 3466 | fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos) | 3477 | fix_overlays_before (struct buffer *bp, ptrdiff_t prev, ptrdiff_t pos) |
| 3467 | { | 3478 | { |
| 3468 | /* If parent is nil, replace overlays_before; otherwise, parent->next. */ | 3479 | /* If parent is nil, replace overlays_before; otherwise, parent->next. */ |
| 3469 | struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; | 3480 | struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; |
| 3470 | Lisp_Object tem; | 3481 | Lisp_Object tem; |
| 3471 | EMACS_INT end IF_LINT (= 0); | 3482 | ptrdiff_t end IF_LINT (= 0); |
| 3472 | 3483 | ||
| 3473 | /* After the insertion, the several overlays may be in incorrect | 3484 | /* After the insertion, the several overlays may be in incorrect |
| 3474 | order. The possibility is that, in the list `overlays_before', | 3485 | order. The possibility is that, in the list `overlays_before', |
| @@ -3626,11 +3637,11 @@ for the rear of the overlay advance when text is inserted there | |||
| 3626 | /* Mark a section of BUF as needing redisplay because of overlays changes. */ | 3637 | /* Mark a section of BUF as needing redisplay because of overlays changes. */ |
| 3627 | 3638 | ||
| 3628 | static void | 3639 | static void |
| 3629 | modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end) | 3640 | modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) |
| 3630 | { | 3641 | { |
| 3631 | if (start > end) | 3642 | if (start > end) |
| 3632 | { | 3643 | { |
| 3633 | EMACS_INT temp = start; | 3644 | ptrdiff_t temp = start; |
| 3634 | start = end; | 3645 | start = end; |
| 3635 | end = temp; | 3646 | end = temp; |
| 3636 | } | 3647 | } |
| @@ -3677,9 +3688,10 @@ If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current | |||
| 3677 | buffer. */) | 3688 | buffer. */) |
| 3678 | (Lisp_Object overlay, Lisp_Object beg, Lisp_Object end, Lisp_Object buffer) | 3689 | (Lisp_Object overlay, Lisp_Object beg, Lisp_Object end, Lisp_Object buffer) |
| 3679 | { | 3690 | { |
| 3680 | struct buffer *b, *ob; | 3691 | struct buffer *b, *ob = 0; |
| 3681 | Lisp_Object obuffer; | 3692 | Lisp_Object obuffer; |
| 3682 | int count = SPECPDL_INDEX (); | 3693 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3694 | ptrdiff_t n_beg, n_end, o_beg IF_LINT (= 0), o_end IF_LINT (= 0); | ||
| 3683 | 3695 | ||
| 3684 | CHECK_OVERLAY (overlay); | 3696 | CHECK_OVERLAY (overlay); |
| 3685 | if (NILP (buffer)) | 3697 | if (NILP (buffer)) |
| @@ -3688,6 +3700,9 @@ buffer. */) | |||
| 3688 | XSETBUFFER (buffer, current_buffer); | 3700 | XSETBUFFER (buffer, current_buffer); |
| 3689 | CHECK_BUFFER (buffer); | 3701 | CHECK_BUFFER (buffer); |
| 3690 | 3702 | ||
| 3703 | if (NILP (Fbuffer_live_p (buffer))) | ||
| 3704 | error ("Attempt to move overlay to a dead buffer"); | ||
| 3705 | |||
| 3691 | if (MARKERP (beg) | 3706 | if (MARKERP (beg) |
| 3692 | && ! EQ (Fmarker_buffer (beg), buffer)) | 3707 | && ! EQ (Fmarker_buffer (beg), buffer)) |
| 3693 | error ("Marker points into wrong buffer"); | 3708 | error ("Marker points into wrong buffer"); |
| @@ -3698,9 +3713,6 @@ buffer. */) | |||
| 3698 | CHECK_NUMBER_COERCE_MARKER (beg); | 3713 | CHECK_NUMBER_COERCE_MARKER (beg); |
| 3699 | CHECK_NUMBER_COERCE_MARKER (end); | 3714 | CHECK_NUMBER_COERCE_MARKER (end); |
| 3700 | 3715 | ||
| 3701 | if (XINT (beg) == XINT (end) && ! NILP (Foverlay_get (overlay, Qevaporate))) | ||
| 3702 | return Fdelete_overlay (overlay); | ||
| 3703 | |||
| 3704 | if (XINT (beg) > XINT (end)) | 3716 | if (XINT (beg) > XINT (end)) |
| 3705 | { | 3717 | { |
| 3706 | Lisp_Object temp; | 3718 | Lisp_Object temp; |
| @@ -3711,61 +3723,57 @@ buffer. */) | |||
| 3711 | 3723 | ||
| 3712 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); | 3724 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); |
| 3713 | b = XBUFFER (buffer); | 3725 | b = XBUFFER (buffer); |
| 3714 | ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0; | 3726 | |
| 3727 | if (!NILP (obuffer)) | ||
| 3728 | { | ||
| 3729 | ob = XBUFFER (obuffer); | ||
| 3730 | |||
| 3731 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); | ||
| 3732 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); | ||
| 3733 | |||
| 3734 | ob->overlays_before = | ||
| 3735 | unchain_overlay (ob->overlays_before, XOVERLAY (overlay)); | ||
| 3736 | ob->overlays_after = | ||
| 3737 | unchain_overlay (ob->overlays_after, XOVERLAY (overlay)); | ||
| 3738 | eassert (XOVERLAY (overlay)->next == NULL); | ||
| 3739 | } | ||
| 3740 | |||
| 3741 | /* Set the overlay boundaries, which may clip them. */ | ||
| 3742 | Fset_marker (OVERLAY_START (overlay), beg, buffer); | ||
| 3743 | Fset_marker (OVERLAY_END (overlay), end, buffer); | ||
| 3744 | |||
| 3745 | n_beg = marker_position (OVERLAY_START (overlay)); | ||
| 3746 | n_end = marker_position (OVERLAY_END (overlay)); | ||
| 3715 | 3747 | ||
| 3716 | /* If the overlay has changed buffers, do a thorough redisplay. */ | 3748 | /* If the overlay has changed buffers, do a thorough redisplay. */ |
| 3717 | if (!EQ (buffer, obuffer)) | 3749 | if (!EQ (buffer, obuffer)) |
| 3718 | { | 3750 | { |
| 3719 | /* Redisplay where the overlay was. */ | 3751 | /* Redisplay where the overlay was. */ |
| 3720 | if (!NILP (obuffer)) | 3752 | if (ob) |
| 3721 | { | 3753 | modify_overlay (ob, o_beg, o_end); |
| 3722 | EMACS_INT o_beg; | ||
| 3723 | EMACS_INT o_end; | ||
| 3724 | |||
| 3725 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); | ||
| 3726 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); | ||
| 3727 | |||
| 3728 | modify_overlay (ob, o_beg, o_end); | ||
| 3729 | } | ||
| 3730 | 3754 | ||
| 3731 | /* Redisplay where the overlay is going to be. */ | 3755 | /* Redisplay where the overlay is going to be. */ |
| 3732 | modify_overlay (b, XINT (beg), XINT (end)); | 3756 | modify_overlay (b, n_beg, n_end); |
| 3733 | } | 3757 | } |
| 3734 | else | 3758 | else |
| 3735 | /* Redisplay the area the overlay has just left, or just enclosed. */ | 3759 | /* Redisplay the area the overlay has just left, or just enclosed. */ |
| 3736 | { | 3760 | { |
| 3737 | EMACS_INT o_beg, o_end; | 3761 | if (o_beg == n_beg) |
| 3738 | 3762 | modify_overlay (b, o_end, n_end); | |
| 3739 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); | 3763 | else if (o_end == n_end) |
| 3740 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 3764 | modify_overlay (b, o_beg, n_beg); |
| 3741 | |||
| 3742 | if (o_beg == XINT (beg)) | ||
| 3743 | modify_overlay (b, o_end, XINT (end)); | ||
| 3744 | else if (o_end == XINT (end)) | ||
| 3745 | modify_overlay (b, o_beg, XINT (beg)); | ||
| 3746 | else | 3765 | else |
| 3747 | { | 3766 | modify_overlay (b, min (o_beg, n_beg), max (o_end, n_end)); |
| 3748 | if (XINT (beg) < o_beg) o_beg = XINT (beg); | ||
| 3749 | if (XINT (end) > o_end) o_end = XINT (end); | ||
| 3750 | modify_overlay (b, o_beg, o_end); | ||
| 3751 | } | ||
| 3752 | } | 3767 | } |
| 3753 | 3768 | ||
| 3754 | if (!NILP (obuffer)) | 3769 | /* Delete the overlay if it is empty after clipping and has the |
| 3755 | { | 3770 | evaporate property. */ |
| 3756 | ob->overlays_before | 3771 | if (n_beg == n_end && !NILP (Foverlay_get (overlay, Qevaporate))) |
| 3757 | = unchain_overlay (ob->overlays_before, XOVERLAY (overlay)); | 3772 | return unbind_to (count, Fdelete_overlay (overlay)); |
| 3758 | ob->overlays_after | ||
| 3759 | = unchain_overlay (ob->overlays_after, XOVERLAY (overlay)); | ||
| 3760 | eassert (XOVERLAY (overlay)->next == NULL); | ||
| 3761 | } | ||
| 3762 | |||
| 3763 | Fset_marker (OVERLAY_START (overlay), beg, buffer); | ||
| 3764 | Fset_marker (OVERLAY_END (overlay), end, buffer); | ||
| 3765 | 3773 | ||
| 3766 | /* Put the overlay on the wrong list. */ | 3774 | /* Put the overlay into the new buffer's overlay lists, first on the |
| 3767 | end = OVERLAY_END (overlay); | 3775 | wrong list. */ |
| 3768 | if (OVERLAY_POSITION (end) < b->overlay_center) | 3776 | if (n_end < b->overlay_center) |
| 3769 | { | 3777 | { |
| 3770 | XOVERLAY (overlay)->next = b->overlays_after; | 3778 | XOVERLAY (overlay)->next = b->overlays_after; |
| 3771 | b->overlays_after = XOVERLAY (overlay); | 3779 | b->overlays_after = XOVERLAY (overlay); |
| @@ -3788,7 +3796,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, | |||
| 3788 | { | 3796 | { |
| 3789 | Lisp_Object buffer; | 3797 | Lisp_Object buffer; |
| 3790 | struct buffer *b; | 3798 | struct buffer *b; |
| 3791 | int count = SPECPDL_INDEX (); | 3799 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3792 | 3800 | ||
| 3793 | CHECK_OVERLAY (overlay); | 3801 | CHECK_OVERLAY (overlay); |
| 3794 | 3802 | ||
| @@ -3799,9 +3807,12 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, | |||
| 3799 | b = XBUFFER (buffer); | 3807 | b = XBUFFER (buffer); |
| 3800 | specbind (Qinhibit_quit, Qt); | 3808 | specbind (Qinhibit_quit, Qt); |
| 3801 | 3809 | ||
| 3802 | b->overlays_before = unchain_overlay (b->overlays_before,XOVERLAY (overlay)); | 3810 | b->overlays_before |
| 3803 | b->overlays_after = unchain_overlay (b->overlays_after, XOVERLAY (overlay)); | 3811 | = unchain_overlay (b->overlays_before, XOVERLAY (overlay)); |
| 3812 | b->overlays_after | ||
| 3813 | = unchain_overlay (b->overlays_after, XOVERLAY (overlay)); | ||
| 3804 | eassert (XOVERLAY (overlay)->next == NULL); | 3814 | eassert (XOVERLAY (overlay)->next == NULL); |
| 3815 | |||
| 3805 | modify_overlay (b, | 3816 | modify_overlay (b, |
| 3806 | marker_position (OVERLAY_START (overlay)), | 3817 | marker_position (OVERLAY_START (overlay)), |
| 3807 | marker_position (OVERLAY_END (overlay))); | 3818 | marker_position (OVERLAY_END (overlay))); |
| @@ -3879,7 +3890,7 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | |||
| 3879 | /* Put all the overlays we want in a vector in overlay_vec. | 3890 | /* Put all the overlays we want in a vector in overlay_vec. |
| 3880 | Store the length in len. */ | 3891 | Store the length in len. */ |
| 3881 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 3892 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 3882 | (EMACS_INT *) 0, (EMACS_INT *) 0, 0); | 3893 | 0, 0, 0); |
| 3883 | 3894 | ||
| 3884 | /* Make a list of them all. */ | 3895 | /* Make a list of them all. */ |
| 3885 | result = Flist (noverlays, overlay_vec); | 3896 | result = Flist (noverlays, overlay_vec); |
| @@ -3927,7 +3938,7 @@ the value is (point-max). */) | |||
| 3927 | (Lisp_Object pos) | 3938 | (Lisp_Object pos) |
| 3928 | { | 3939 | { |
| 3929 | ptrdiff_t i, len, noverlays; | 3940 | ptrdiff_t i, len, noverlays; |
| 3930 | EMACS_INT endpos; | 3941 | ptrdiff_t endpos; |
| 3931 | Lisp_Object *overlay_vec; | 3942 | Lisp_Object *overlay_vec; |
| 3932 | 3943 | ||
| 3933 | CHECK_NUMBER_COERCE_MARKER (pos); | 3944 | CHECK_NUMBER_COERCE_MARKER (pos); |
| @@ -3939,14 +3950,14 @@ the value is (point-max). */) | |||
| 3939 | Store the length in len. | 3950 | Store the length in len. |
| 3940 | endpos gets the position where the next overlay starts. */ | 3951 | endpos gets the position where the next overlay starts. */ |
| 3941 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 3952 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 3942 | &endpos, (EMACS_INT *) 0, 1); | 3953 | &endpos, 0, 1); |
| 3943 | 3954 | ||
| 3944 | /* If any of these overlays ends before endpos, | 3955 | /* If any of these overlays ends before endpos, |
| 3945 | use its ending point instead. */ | 3956 | use its ending point instead. */ |
| 3946 | for (i = 0; i < noverlays; i++) | 3957 | for (i = 0; i < noverlays; i++) |
| 3947 | { | 3958 | { |
| 3948 | Lisp_Object oend; | 3959 | Lisp_Object oend; |
| 3949 | EMACS_INT oendpos; | 3960 | ptrdiff_t oendpos; |
| 3950 | 3961 | ||
| 3951 | oend = OVERLAY_END (overlay_vec[i]); | 3962 | oend = OVERLAY_END (overlay_vec[i]); |
| 3952 | oendpos = OVERLAY_POSITION (oend); | 3963 | oendpos = OVERLAY_POSITION (oend); |
| @@ -3965,7 +3976,7 @@ If there are no overlay boundaries from (point-min) to POS, | |||
| 3965 | the value is (point-min). */) | 3976 | the value is (point-min). */) |
| 3966 | (Lisp_Object pos) | 3977 | (Lisp_Object pos) |
| 3967 | { | 3978 | { |
| 3968 | EMACS_INT prevpos; | 3979 | ptrdiff_t prevpos; |
| 3969 | Lisp_Object *overlay_vec; | 3980 | Lisp_Object *overlay_vec; |
| 3970 | ptrdiff_t len; | 3981 | ptrdiff_t len; |
| 3971 | 3982 | ||
| @@ -3983,7 +3994,7 @@ the value is (point-min). */) | |||
| 3983 | Store the length in len. | 3994 | Store the length in len. |
| 3984 | prevpos gets the position of the previous change. */ | 3995 | prevpos gets the position of the previous change. */ |
| 3985 | overlays_at (XINT (pos), 1, &overlay_vec, &len, | 3996 | overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 3986 | (EMACS_INT *) 0, &prevpos, 1); | 3997 | 0, &prevpos, 1); |
| 3987 | 3998 | ||
| 3988 | xfree (overlay_vec); | 3999 | xfree (overlay_vec); |
| 3989 | return make_number (prevpos); | 4000 | return make_number (prevpos); |
| @@ -4021,9 +4032,11 @@ That makes overlay lookup faster for positions near POS (but perhaps slower | |||
| 4021 | for positions far away from POS). */) | 4032 | for positions far away from POS). */) |
| 4022 | (Lisp_Object pos) | 4033 | (Lisp_Object pos) |
| 4023 | { | 4034 | { |
| 4035 | ptrdiff_t p; | ||
| 4024 | CHECK_NUMBER_COERCE_MARKER (pos); | 4036 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 4025 | 4037 | ||
| 4026 | recenter_overlay_lists (current_buffer, XINT (pos)); | 4038 | p = clip_to_bounds (PTRDIFF_MIN, XINT (pos), PTRDIFF_MAX); |
| 4039 | recenter_overlay_lists (current_buffer, p); | ||
| 4027 | return Qnil; | 4040 | return Qnil; |
| 4028 | } | 4041 | } |
| 4029 | 4042 | ||
| @@ -4090,7 +4103,7 @@ VALUE will be returned.*/) | |||
| 4090 | static Lisp_Object last_overlay_modification_hooks; | 4103 | static Lisp_Object last_overlay_modification_hooks; |
| 4091 | 4104 | ||
| 4092 | /* Number of elements actually used in last_overlay_modification_hooks. */ | 4105 | /* Number of elements actually used in last_overlay_modification_hooks. */ |
| 4093 | static int last_overlay_modification_hooks_used; | 4106 | static ptrdiff_t last_overlay_modification_hooks_used; |
| 4094 | 4107 | ||
| 4095 | /* Add one functionlist/overlay pair | 4108 | /* Add one functionlist/overlay pair |
| 4096 | to the end of last_overlay_modification_hooks. */ | 4109 | to the end of last_overlay_modification_hooks. */ |
| @@ -4098,11 +4111,11 @@ static int last_overlay_modification_hooks_used; | |||
| 4098 | static void | 4111 | static void |
| 4099 | add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) | 4112 | add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) |
| 4100 | { | 4113 | { |
| 4101 | int oldsize = ASIZE (last_overlay_modification_hooks); | 4114 | ptrdiff_t oldsize = ASIZE (last_overlay_modification_hooks); |
| 4102 | 4115 | ||
| 4103 | if (last_overlay_modification_hooks_used == oldsize) | 4116 | if (oldsize - 1 <= last_overlay_modification_hooks_used) |
| 4104 | last_overlay_modification_hooks = larger_vector | 4117 | last_overlay_modification_hooks = |
| 4105 | (last_overlay_modification_hooks, oldsize * 2, Qnil); | 4118 | larger_vector (last_overlay_modification_hooks, 2, -1); |
| 4106 | ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used, | 4119 | ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used, |
| 4107 | functionlist); last_overlay_modification_hooks_used++; | 4120 | functionlist); last_overlay_modification_hooks_used++; |
| 4108 | ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used, | 4121 | ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used, |
| @@ -4151,7 +4164,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | |||
| 4151 | last_overlay_modification_hooks_used = 0; | 4164 | last_overlay_modification_hooks_used = 0; |
| 4152 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 4165 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 4153 | { | 4166 | { |
| 4154 | EMACS_INT startpos, endpos; | 4167 | ptrdiff_t startpos, endpos; |
| 4155 | Lisp_Object ostart, oend; | 4168 | Lisp_Object ostart, oend; |
| 4156 | 4169 | ||
| 4157 | XSETMISC (overlay, tail); | 4170 | XSETMISC (overlay, tail); |
| @@ -4188,7 +4201,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | |||
| 4188 | 4201 | ||
| 4189 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 4202 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 4190 | { | 4203 | { |
| 4191 | EMACS_INT startpos, endpos; | 4204 | ptrdiff_t startpos, endpos; |
| 4192 | Lisp_Object ostart, oend; | 4205 | Lisp_Object ostart, oend; |
| 4193 | 4206 | ||
| 4194 | XSETMISC (overlay, tail); | 4207 | XSETMISC (overlay, tail); |
| @@ -4229,9 +4242,9 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | |||
| 4229 | /* Call the functions recorded in last_overlay_modification_hooks. | 4242 | /* Call the functions recorded in last_overlay_modification_hooks. |
| 4230 | First copy the vector contents, in case some of these hooks | 4243 | First copy the vector contents, in case some of these hooks |
| 4231 | do subsequent modification of the buffer. */ | 4244 | do subsequent modification of the buffer. */ |
| 4232 | int size = last_overlay_modification_hooks_used; | 4245 | ptrdiff_t size = last_overlay_modification_hooks_used; |
| 4233 | Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); | 4246 | Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); |
| 4234 | int i; | 4247 | ptrdiff_t i; |
| 4235 | 4248 | ||
| 4236 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, | 4249 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, |
| 4237 | size * sizeof (Lisp_Object)); | 4250 | size * sizeof (Lisp_Object)); |
| @@ -4271,7 +4284,7 @@ call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after, | |||
| 4271 | /* Delete any zero-sized overlays at position POS, if the `evaporate' | 4284 | /* Delete any zero-sized overlays at position POS, if the `evaporate' |
| 4272 | property is set. */ | 4285 | property is set. */ |
| 4273 | void | 4286 | void |
| 4274 | evaporate_overlays (EMACS_INT pos) | 4287 | evaporate_overlays (ptrdiff_t pos) |
| 4275 | { | 4288 | { |
| 4276 | Lisp_Object overlay, hit_list; | 4289 | Lisp_Object overlay, hit_list; |
| 4277 | struct Lisp_Overlay *tail; | 4290 | struct Lisp_Overlay *tail; |
| @@ -4280,7 +4293,7 @@ evaporate_overlays (EMACS_INT pos) | |||
| 4280 | if (pos <= current_buffer->overlay_center) | 4293 | if (pos <= current_buffer->overlay_center) |
| 4281 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 4294 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 4282 | { | 4295 | { |
| 4283 | EMACS_INT endpos; | 4296 | ptrdiff_t endpos; |
| 4284 | XSETMISC (overlay, tail); | 4297 | XSETMISC (overlay, tail); |
| 4285 | endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); | 4298 | endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 4286 | if (endpos < pos) | 4299 | if (endpos < pos) |
| @@ -4292,7 +4305,7 @@ evaporate_overlays (EMACS_INT pos) | |||
| 4292 | else | 4305 | else |
| 4293 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 4306 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 4294 | { | 4307 | { |
| 4295 | EMACS_INT startpos; | 4308 | ptrdiff_t startpos; |
| 4296 | XSETMISC (overlay, tail); | 4309 | XSETMISC (overlay, tail); |
| 4297 | startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); | 4310 | startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 4298 | if (startpos > pos) | 4311 | if (startpos > pos) |
| @@ -4383,7 +4396,7 @@ struct mmap_region | |||
| 4383 | /* Pointer to the location holding the address of the memory | 4396 | /* Pointer to the location holding the address of the memory |
| 4384 | allocated with the mmap'd block. The variable actually points | 4397 | allocated with the mmap'd block. The variable actually points |
| 4385 | after this structure. */ | 4398 | after this structure. */ |
| 4386 | POINTER_TYPE **var; | 4399 | void **var; |
| 4387 | 4400 | ||
| 4388 | /* Next and previous in list of all mmap'd regions. */ | 4401 | /* Next and previous in list of all mmap'd regions. */ |
| 4389 | struct mmap_region *next, *prev; | 4402 | struct mmap_region *next, *prev; |
| @@ -4430,7 +4443,7 @@ static int mmap_initialized_p; | |||
| 4430 | to the start of the user-visible part of the region. */ | 4443 | to the start of the user-visible part of the region. */ |
| 4431 | 4444 | ||
| 4432 | #define MMAP_USER_AREA(P) \ | 4445 | #define MMAP_USER_AREA(P) \ |
| 4433 | ((POINTER_TYPE *) ((char *) (P) + MMAP_REGION_STRUCT_SIZE)) | 4446 | ((void *) ((char *) (P) + MMAP_REGION_STRUCT_SIZE)) |
| 4434 | 4447 | ||
| 4435 | #define MEM_ALIGN sizeof (double) | 4448 | #define MEM_ALIGN sizeof (double) |
| 4436 | 4449 | ||
| @@ -4479,7 +4492,7 @@ mmap_init (void) | |||
| 4479 | is at END - 1. */ | 4492 | is at END - 1. */ |
| 4480 | 4493 | ||
| 4481 | static struct mmap_region * | 4494 | static struct mmap_region * |
| 4482 | mmap_find (POINTER_TYPE *start, POINTER_TYPE *end) | 4495 | mmap_find (void *start, void *end) |
| 4483 | { | 4496 | { |
| 4484 | struct mmap_region *r; | 4497 | struct mmap_region *r; |
| 4485 | char *s = (char *) start, *e = (char *) end; | 4498 | char *s = (char *) start, *e = (char *) end; |
| @@ -4517,7 +4530,7 @@ mmap_free_1 (struct mmap_region *r) | |||
| 4517 | else | 4530 | else |
| 4518 | mmap_regions = r->next; | 4531 | mmap_regions = r->next; |
| 4519 | 4532 | ||
| 4520 | if (munmap ((POINTER_TYPE *) r, r->nbytes_mapped) == -1) | 4533 | if (munmap (r, r->nbytes_mapped) == -1) |
| 4521 | { | 4534 | { |
| 4522 | fprintf (stderr, "munmap: %s\n", emacs_strerror (errno)); | 4535 | fprintf (stderr, "munmap: %s\n", emacs_strerror (errno)); |
| 4523 | return 0; | 4536 | return 0; |
| @@ -4559,13 +4572,13 @@ mmap_enlarge (struct mmap_region *r, int npages) | |||
| 4559 | I'm not sure this is worth doing, let's see. */ | 4572 | I'm not sure this is worth doing, let's see. */ |
| 4560 | if (!MMAP_ALLOCATED_P (region_end, region_end + nbytes)) | 4573 | if (!MMAP_ALLOCATED_P (region_end, region_end + nbytes)) |
| 4561 | { | 4574 | { |
| 4562 | POINTER_TYPE *p; | 4575 | void *p; |
| 4563 | 4576 | ||
| 4564 | p = mmap (region_end, nbytes, PROT_READ | PROT_WRITE, | 4577 | p = mmap (region_end, nbytes, PROT_READ | PROT_WRITE, |
| 4565 | MAP_ANON | MAP_PRIVATE | MAP_FIXED, mmap_fd, 0); | 4578 | MAP_ANON | MAP_PRIVATE | MAP_FIXED, mmap_fd, 0); |
| 4566 | if (p == MAP_FAILED) | 4579 | if (p == MAP_FAILED) |
| 4567 | ; /* fprintf (stderr, "mmap: %s\n", emacs_strerror (errno)); */ | 4580 | ; /* fprintf (stderr, "mmap: %s\n", emacs_strerror (errno)); */ |
| 4568 | else if (p != (POINTER_TYPE *) region_end) | 4581 | else if (p != region_end) |
| 4569 | { | 4582 | { |
| 4570 | /* Kernels are free to choose a different address. In | 4583 | /* Kernels are free to choose a different address. In |
| 4571 | that case, unmap what we've mapped above; we have | 4584 | that case, unmap what we've mapped above; we have |
| @@ -4627,8 +4640,8 @@ mmap_set_vars (int restore_p) | |||
| 4627 | If we can't allocate the necessary memory, set *VAR to null, and | 4640 | If we can't allocate the necessary memory, set *VAR to null, and |
| 4628 | return null. */ | 4641 | return null. */ |
| 4629 | 4642 | ||
| 4630 | static POINTER_TYPE * | 4643 | static void * |
| 4631 | mmap_alloc (POINTER_TYPE **var, size_t nbytes) | 4644 | mmap_alloc (void **var, size_t nbytes) |
| 4632 | { | 4645 | { |
| 4633 | void *p; | 4646 | void *p; |
| 4634 | size_t map; | 4647 | size_t map; |
| @@ -4669,7 +4682,7 @@ mmap_alloc (POINTER_TYPE **var, size_t nbytes) | |||
| 4669 | PTR. Store 0 in *PTR to show there's no block allocated. */ | 4682 | PTR. Store 0 in *PTR to show there's no block allocated. */ |
| 4670 | 4683 | ||
| 4671 | static void | 4684 | static void |
| 4672 | mmap_free (POINTER_TYPE **var) | 4685 | mmap_free (void **var) |
| 4673 | { | 4686 | { |
| 4674 | mmap_init (); | 4687 | mmap_init (); |
| 4675 | 4688 | ||
| @@ -4686,10 +4699,10 @@ mmap_free (POINTER_TYPE **var) | |||
| 4686 | and return this value. If more memory cannot be allocated, then | 4699 | and return this value. If more memory cannot be allocated, then |
| 4687 | leave *VAR unchanged, and return null. */ | 4700 | leave *VAR unchanged, and return null. */ |
| 4688 | 4701 | ||
| 4689 | static POINTER_TYPE * | 4702 | static void * |
| 4690 | mmap_realloc (POINTER_TYPE **var, size_t nbytes) | 4703 | mmap_realloc (void **var, size_t nbytes) |
| 4691 | { | 4704 | { |
| 4692 | POINTER_TYPE *result; | 4705 | void *result; |
| 4693 | 4706 | ||
| 4694 | mmap_init (); | 4707 | mmap_init (); |
| 4695 | 4708 | ||
| @@ -4708,7 +4721,7 @@ mmap_realloc (POINTER_TYPE **var, size_t nbytes) | |||
| 4708 | if (room < nbytes) | 4721 | if (room < nbytes) |
| 4709 | { | 4722 | { |
| 4710 | /* Must enlarge. */ | 4723 | /* Must enlarge. */ |
| 4711 | POINTER_TYPE *old_ptr = *var; | 4724 | void *old_ptr = *var; |
| 4712 | 4725 | ||
| 4713 | /* Try to map additional pages at the end of the region. | 4726 | /* Try to map additional pages at the end of the region. |
| 4714 | If that fails, allocate a new region, copy data | 4727 | If that fails, allocate a new region, copy data |
| @@ -4770,13 +4783,13 @@ mmap_realloc (POINTER_TYPE **var, size_t nbytes) | |||
| 4770 | static void | 4783 | static void |
| 4771 | alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | 4784 | alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) |
| 4772 | { | 4785 | { |
| 4773 | POINTER_TYPE *p; | 4786 | void *p; |
| 4774 | 4787 | ||
| 4775 | BLOCK_INPUT; | 4788 | BLOCK_INPUT; |
| 4776 | #if defined USE_MMAP_FOR_BUFFERS | 4789 | #if defined USE_MMAP_FOR_BUFFERS |
| 4777 | p = mmap_alloc ((POINTER_TYPE **) &b->text->beg, nbytes); | 4790 | p = mmap_alloc ((void **) &b->text->beg, nbytes); |
| 4778 | #elif defined REL_ALLOC | 4791 | #elif defined REL_ALLOC |
| 4779 | p = r_alloc ((POINTER_TYPE **) &b->text->beg, nbytes); | 4792 | p = r_alloc ((void **) &b->text->beg, nbytes); |
| 4780 | #else | 4793 | #else |
| 4781 | p = xmalloc (nbytes); | 4794 | p = xmalloc (nbytes); |
| 4782 | #endif | 4795 | #endif |
| @@ -4795,16 +4808,16 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | |||
| 4795 | shrink it. */ | 4808 | shrink it. */ |
| 4796 | 4809 | ||
| 4797 | void | 4810 | void |
| 4798 | enlarge_buffer_text (struct buffer *b, EMACS_INT delta) | 4811 | enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) |
| 4799 | { | 4812 | { |
| 4800 | POINTER_TYPE *p; | 4813 | void *p; |
| 4801 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 | 4814 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 |
| 4802 | + delta); | 4815 | + delta); |
| 4803 | BLOCK_INPUT; | 4816 | BLOCK_INPUT; |
| 4804 | #if defined USE_MMAP_FOR_BUFFERS | 4817 | #if defined USE_MMAP_FOR_BUFFERS |
| 4805 | p = mmap_realloc ((POINTER_TYPE **) &b->text->beg, nbytes); | 4818 | p = mmap_realloc ((void **) &b->text->beg, nbytes); |
| 4806 | #elif defined REL_ALLOC | 4819 | #elif defined REL_ALLOC |
| 4807 | p = r_re_alloc ((POINTER_TYPE **) &b->text->beg, nbytes); | 4820 | p = r_re_alloc ((void **) &b->text->beg, nbytes); |
| 4808 | #else | 4821 | #else |
| 4809 | p = xrealloc (b->text->beg, nbytes); | 4822 | p = xrealloc (b->text->beg, nbytes); |
| 4810 | #endif | 4823 | #endif |
| @@ -4828,9 +4841,9 @@ free_buffer_text (struct buffer *b) | |||
| 4828 | BLOCK_INPUT; | 4841 | BLOCK_INPUT; |
| 4829 | 4842 | ||
| 4830 | #if defined USE_MMAP_FOR_BUFFERS | 4843 | #if defined USE_MMAP_FOR_BUFFERS |
| 4831 | mmap_free ((POINTER_TYPE **) &b->text->beg); | 4844 | mmap_free ((void **) &b->text->beg); |
| 4832 | #elif defined REL_ALLOC | 4845 | #elif defined REL_ALLOC |
| 4833 | r_alloc_free ((POINTER_TYPE **) &b->text->beg); | 4846 | r_alloc_free ((void **) &b->text->beg); |
| 4834 | #else | 4847 | #else |
| 4835 | xfree (b->text->beg); | 4848 | xfree (b->text->beg); |
| 4836 | #endif | 4849 | #endif |
| @@ -5328,31 +5341,40 @@ the mode line appears at the bottom. */); | |||
| 5328 | DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format), | 5341 | DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format), |
| 5329 | Qnil, | 5342 | Qnil, |
| 5330 | doc: /* Template for displaying mode line for current buffer. | 5343 | doc: /* Template for displaying mode line for current buffer. |
| 5331 | Each buffer has its own value of this variable. | 5344 | |
| 5332 | Value may be nil, a string, a symbol or a list or cons cell. | 5345 | The value may be nil, a string, a symbol or a list. |
| 5346 | |||
| 5333 | A value of nil means don't display a mode line. | 5347 | A value of nil means don't display a mode line. |
| 5334 | For a symbol, its value is used (but it is ignored if t or nil). | 5348 | |
| 5335 | A string appearing directly as the value of a symbol is processed verbatim | 5349 | For any symbol other than t or nil, the symbol's value is processed as |
| 5336 | in that the %-constructs below are not recognized. | 5350 | a mode line construct. As a special exception, if that value is a |
| 5337 | Note that unless the symbol is marked as a `risky-local-variable', all | 5351 | string, the string is processed verbatim, without handling any |
| 5338 | properties in any strings, as well as all :eval and :propertize forms | 5352 | %-constructs (see below). Also, unless the symbol has a non-nil |
| 5339 | in the value of that symbol will be ignored. | 5353 | `risky-local-variable' property, all properties in any strings, as |
| 5340 | For a list of the form `(:eval FORM)', FORM is evaluated and the result | 5354 | well as all :eval and :propertize forms in the value, are ignored. |
| 5341 | is used as a mode line element. Be careful--FORM should not load any files, | 5355 | |
| 5342 | because that can cause an infinite recursion. | 5356 | A list whose car is a string or list is processed by processing each |
| 5343 | For a list of the form `(:propertize ELT PROPS...)', ELT is displayed | 5357 | of the list elements recursively, as separate mode line constructs, |
| 5344 | with the specified properties PROPS applied. | 5358 | and concatenating the results. |
| 5345 | For a list whose car is a symbol, the symbol's value is taken, | 5359 | |
| 5346 | and if that is non-nil, the cadr of the list is processed recursively. | 5360 | A list of the form `(:eval FORM)' is processed by evaluating FORM and |
| 5347 | Otherwise, the caddr of the list (if there is one) is processed. | 5361 | using the result as a mode line construct. Be careful--FORM should |
| 5348 | For a list whose car is a string or list, each element is processed | 5362 | not load any files, because that can cause an infinite recursion. |
| 5349 | recursively and the results are effectively concatenated. | 5363 | |
| 5350 | For a list whose car is an integer, the cdr of the list is processed | 5364 | A list of the form `(:propertize ELT PROPS...)' is processed by |
| 5351 | and padded (if the number is positive) or truncated (if negative) | 5365 | processing ELT as the mode line construct, and adding the text |
| 5352 | to the width specified by that number. | 5366 | properties PROPS to the result. |
| 5367 | |||
| 5368 | A list whose car is a symbol is processed by examining the symbol's | ||
| 5369 | value, and, if that value is non-nil, processing the cadr of the list | ||
| 5370 | recursively; and if that value is nil, processing the caddr of the | ||
| 5371 | list recursively. | ||
| 5372 | |||
| 5373 | A list whose car is an integer is processed by processing the cadr of | ||
| 5374 | the list, and padding (if the number is positive) or truncating (if | ||
| 5375 | negative) to the width specified by that number. | ||
| 5376 | |||
| 5353 | A string is printed verbatim in the mode line except for %-constructs: | 5377 | A string is printed verbatim in the mode line except for %-constructs: |
| 5354 | (%-constructs are allowed when the string is the entire mode-line-format | ||
| 5355 | or when it is found in a cons-cell or a list) | ||
| 5356 | %b -- print buffer name. %f -- print visited file name. | 5378 | %b -- print buffer name. %f -- print visited file name. |
| 5357 | %F -- print frame name. | 5379 | %F -- print frame name. |
| 5358 | %* -- print %, * or hyphen. %+ -- print *, % or hyphen. | 5380 | %* -- print %, * or hyphen. %+ -- print *, % or hyphen. |