aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2004-10-03 13:08:55 +0000
committerKaroly Lorentey2004-10-03 13:08:55 +0000
commit04ccca970d4a21222cd1f58c7c41983461f009fc (patch)
treeae6c3a37beb6a32881b80c42981b891138dd194f /src
parent181bb49001b52ee593c852377951f8f7b3cf4f38 (diff)
parent972a542d5b1101a143ef930f62090fa3feab49f1 (diff)
downloademacs-04ccca970d4a21222cd1f58c7c41983461f009fc.tar.gz
emacs-04ccca970d4a21222cd1f58c7c41983461f009fc.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-581 Fix exec-shield autoconf test * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-582 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-583 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-584 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-585 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-586 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-587 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-588 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-589 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-590 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-591 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-592 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-38 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-39 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-40 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-41 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-252
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog50
-rw-r--r--src/callproc.c2
-rw-r--r--src/coding.c20
-rw-r--r--src/dispextern.h28
-rw-r--r--src/fileio.c3
-rw-r--r--src/fringe.c157
-rw-r--r--src/process.c1
-rw-r--r--src/w32term.c17
-rw-r--r--src/xdisp.c9
9 files changed, 185 insertions, 102 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b71bffc5bce..73fb09883eb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,55 @@
12004-09-30 Kenichi Handa <handa@m17n.org>
2
3 * process.c (send_process): Free composition data.
4
5 * fileio.c (Finsert_file_contents): Free composition data.
6
7 * coding.c (code_convert_region): Don't skip ASCIIs if there are
8 compositions to encode.
9 (encode_coding_string): Likewise. Free composition data.
10
112004-09-30 Florian Weimer <fw@deneb.enyo.de> (tiny change)
12
13 * coding.c (code_convert_region): Free composition data.
14
12004-09-29 Kim F. Storm <storm@cua.dk> 152004-09-29 Kim F. Storm <storm@cua.dk>
2 16
17 * fringe.c: Remove limit on number of bitmaps.
18 (fringe_bitmaps, fringe_faces): Change to pointers.
19 (max_fringe_bitmaps): New var.
20 (Fdefine_fringe_bitmap): Expand fringe_bitmaps and fringe_faces.
21 (init_fringe): Allocate fringe_bitmaps and fringe_faces.
22
23 * dispextern.h (FRINGE_ID_BITS): Increase to 16 bits (64K bitmaps).
24 (struct glyph_row): Reorder fringe_bitmap related fields.
25 (struct it): Likewise.
26
27 * w32term.c (fringe_bmp): Change to pointer.
28 (max_fringe_bmp): New var.
29 (w32_define_fringe_bitmap): Expand fringe_bmp.
30 (w32_draw_fringe_bitmap): Check max_fringe_bmp.
31 (w32_destroy_fringe_bitmap): Likewise.
32
332004-09-29 Kim F. Storm <storm@cua.dk>
34
35 * fringe.c: Simplify last change.
36 (lookup_fringe_bitmap): New function.
37 (valid_fringe_bitmap_p, resolve_fringe_bitmap): Remove.
38 (Fdestroy_fringe_bitmap): Use lookup_fringe_bitmap.
39 Keep standard bitmaps in Vfringe_bitmaps.
40 (Fdefine_fringe_bitmap): Use lookup_fringe_bitmap.
41 (Fset_fringe_bitmap_face): Likewise.
42
43 * dispextern.h (lookup_fringe_bitmap): Add prototype.
44 (valid_fringe_bitmap_p): Remove prototype.
45
46 * xdisp.c (handle_single_display_prop): Use lookup_fringe_bitmap.
47
482004-09-29 Kim F. Storm <storm@cua.dk>
49
50 * fringe.c (destroy_fringe_bitmap, init_fringe_bitmap)
51 (w32_init_fringe, w32_reset_fringes): Fix bootstrap (NULL rif).
52
3 * dispextern.h (valid_fringe_bitmap_p): Fix prototype. 53 * dispextern.h (valid_fringe_bitmap_p): Fix prototype.
4 54
5 * fringe.c (Vfringe_bitmaps): New variable. 55 * fringe.c (Vfringe_bitmaps): New variable.
diff --git a/src/callproc.c b/src/callproc.c
index c3345eb3707..effd7ecbb14 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -807,6 +807,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
807 { 807 {
808 detect_coding (&process_coding, bufptr, nread); 808 detect_coding (&process_coding, bufptr, nread);
809 if (process_coding.composing != COMPOSITION_DISABLED) 809 if (process_coding.composing != COMPOSITION_DISABLED)
810 /* We have not yet allocated the composition
811 data because the coding type was undecided. */
810 coding_allocate_composition_data (&process_coding, PT); 812 coding_allocate_composition_data (&process_coding, PT);
811 } 813 }
812 if (process_coding.cmp_data) 814 if (process_coding.cmp_data)
diff --git a/src/coding.c b/src/coding.c
index 1257771d3ed..58fc587570a 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5646,8 +5646,11 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
5646 coding_allocate_composition_data (coding, from); 5646 coding_allocate_composition_data (coding, from);
5647 } 5647 }
5648 5648
5649 /* Try to skip the heading and tailing ASCIIs. */ 5649 /* Try to skip the heading and tailing ASCIIs. We can't skip them
5650 if (coding->type != coding_type_ccl) 5650 if we must run CCL program or there are compositions to
5651 encode. */
5652 if (coding->type != coding_type_ccl
5653 && (! coding->cmp_data || coding->cmp_data->used == 0))
5651 { 5654 {
5652 int from_byte_orig = from_byte, to_byte_orig = to_byte; 5655 int from_byte_orig = from_byte, to_byte_orig = to_byte;
5653 5656
@@ -5663,6 +5666,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
5663 if (!replace) 5666 if (!replace)
5664 /* We must record and adjust for this new text now. */ 5667 /* We must record and adjust for this new text now. */
5665 adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len); 5668 adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len);
5669 coding_free_composition_data (coding);
5666 return 0; 5670 return 0;
5667 } 5671 }
5668 5672
@@ -6293,13 +6297,19 @@ encode_coding_string (str, coding, nocopy)
6293 if (coding->composing != COMPOSITION_DISABLED) 6297 if (coding->composing != COMPOSITION_DISABLED)
6294 coding_save_composition (coding, from, to, str); 6298 coding_save_composition (coding, from, to, str);
6295 6299
6296 /* Try to skip the heading and tailing ASCIIs. */ 6300 /* Try to skip the heading and tailing ASCIIs. We can't skip them
6297 if (coding->type != coding_type_ccl) 6301 if we must run CCL program or there are compositions to
6302 encode. */
6303 if (coding->type != coding_type_ccl
6304 && (! coding->cmp_data || coding->cmp_data->used == 0))
6298 { 6305 {
6299 SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str), 6306 SHRINK_CONVERSION_REGION (&from, &to_byte, coding, SDATA (str),
6300 1); 6307 1);
6301 if (from == to_byte) 6308 if (from == to_byte)
6302 return (nocopy ? str : Fcopy_sequence (str)); 6309 {
6310 coding_free_composition_data (coding);
6311 return (nocopy ? str : Fcopy_sequence (str));
6312 }
6303 shrinked_bytes = from + (SBYTES (str) - to_byte); 6313 shrinked_bytes = from + (SBYTES (str) - to_byte);
6304 } 6314 }
6305 6315
diff --git a/src/dispextern.h b/src/dispextern.h
index 440c127508e..7bf3149e1b9 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -104,7 +104,7 @@ enum window_part
104}; 104};
105 105
106/* Number of bits allocated to store fringe bitmap numbers. */ 106/* Number of bits allocated to store fringe bitmap numbers. */
107#define FRINGE_ID_BITS 8 107#define FRINGE_ID_BITS 16
108 108
109 109
110 110
@@ -714,24 +714,24 @@ struct glyph_row
714 /* Left fringe bitmap number (enum fringe_bitmap_type). */ 714 /* Left fringe bitmap number (enum fringe_bitmap_type). */
715 unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; 715 unsigned left_user_fringe_bitmap : FRINGE_ID_BITS;
716 716
717 /* Face of the left fringe glyph. */
718 unsigned left_user_fringe_face_id : FACE_ID_BITS;
719
720 /* Right fringe bitmap number (enum fringe_bitmap_type). */ 717 /* Right fringe bitmap number (enum fringe_bitmap_type). */
721 unsigned right_user_fringe_bitmap : FRINGE_ID_BITS; 718 unsigned right_user_fringe_bitmap : FRINGE_ID_BITS;
722 719
723 /* Face of the right fringe glyph. */
724 unsigned right_user_fringe_face_id : FACE_ID_BITS;
725
726 /* Left fringe bitmap number (enum fringe_bitmap_type). */ 720 /* Left fringe bitmap number (enum fringe_bitmap_type). */
727 unsigned left_fringe_bitmap : FRINGE_ID_BITS; 721 unsigned left_fringe_bitmap : FRINGE_ID_BITS;
728 722
729 /* Face of the left fringe glyph. */
730 unsigned left_fringe_face_id : FACE_ID_BITS;
731
732 /* Right fringe bitmap number (enum fringe_bitmap_type). */ 723 /* Right fringe bitmap number (enum fringe_bitmap_type). */
733 unsigned right_fringe_bitmap : FRINGE_ID_BITS; 724 unsigned right_fringe_bitmap : FRINGE_ID_BITS;
734 725
726 /* Face of the left fringe glyph. */
727 unsigned left_user_fringe_face_id : FACE_ID_BITS;
728
729 /* Face of the right fringe glyph. */
730 unsigned right_user_fringe_face_id : FACE_ID_BITS;
731
732 /* Face of the left fringe glyph. */
733 unsigned left_fringe_face_id : FACE_ID_BITS;
734
735 /* Face of the right fringe glyph. */ 735 /* Face of the right fringe glyph. */
736 unsigned right_fringe_face_id : FACE_ID_BITS; 736 unsigned right_fringe_face_id : FACE_ID_BITS;
737 737
@@ -2043,12 +2043,12 @@ struct it
2043 /* Left fringe bitmap number (enum fringe_bitmap_type). */ 2043 /* Left fringe bitmap number (enum fringe_bitmap_type). */
2044 unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; 2044 unsigned left_user_fringe_bitmap : FRINGE_ID_BITS;
2045 2045
2046 /* Face of the left fringe glyph. */
2047 unsigned left_user_fringe_face_id : FACE_ID_BITS;
2048
2049 /* Right fringe bitmap number (enum fringe_bitmap_type). */ 2046 /* Right fringe bitmap number (enum fringe_bitmap_type). */
2050 unsigned right_user_fringe_bitmap : FRINGE_ID_BITS; 2047 unsigned right_user_fringe_bitmap : FRINGE_ID_BITS;
2051 2048
2049 /* Face of the left fringe glyph. */
2050 unsigned left_user_fringe_face_id : FACE_ID_BITS;
2051
2052 /* Face of the right fringe glyph. */ 2052 /* Face of the right fringe glyph. */
2053 unsigned right_user_fringe_face_id : FACE_ID_BITS; 2053 unsigned right_user_fringe_face_id : FACE_ID_BITS;
2054}; 2054};
@@ -2630,7 +2630,7 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *,
2630 2630
2631/* Defined in fringe.c */ 2631/* Defined in fringe.c */
2632 2632
2633int valid_fringe_bitmap_p (Lisp_Object); 2633int lookup_fringe_bitmap (Lisp_Object);
2634void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); 2634void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int));
2635void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); 2635void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *));
2636void draw_window_fringes P_ ((struct window *)); 2636void draw_window_fringes P_ ((struct window *));
diff --git a/src/fileio.c b/src/fileio.c
index 9e86b6a9189..0cfea99b469 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4262,7 +4262,7 @@ actually used. */)
4262 if (how_much < 0) 4262 if (how_much < 0)
4263 { 4263 {
4264 xfree (conversion_buffer); 4264 xfree (conversion_buffer);
4265 4265 coding_free_composition_data (&coding);
4266 if (how_much == -1) 4266 if (how_much == -1)
4267 error ("IO error reading %s: %s", 4267 error ("IO error reading %s: %s",
4268 SDATA (orig_filename), emacs_strerror (errno)); 4268 SDATA (orig_filename), emacs_strerror (errno));
@@ -4284,6 +4284,7 @@ actually used. */)
4284 if (bufpos == inserted) 4284 if (bufpos == inserted)
4285 { 4285 {
4286 xfree (conversion_buffer); 4286 xfree (conversion_buffer);
4287 coding_free_composition_data (&coding);
4287 emacs_close (fd); 4288 emacs_close (fd);
4288 specpdl_ptr--; 4289 specpdl_ptr--;
4289 /* Truncate the buffer to the size of the file. */ 4290 /* Truncate the buffer to the size of the file. */
diff --git a/src/fringe.c b/src/fringe.c
index 24a7bcb083a..529004c7ed8 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -446,27 +446,34 @@ struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] =
446 { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 }, 446 { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 },
447}; 447};
448 448
449static struct fringe_bitmap *fringe_bitmaps[MAX_FRINGE_BITMAPS]; 449static struct fringe_bitmap **fringe_bitmaps;
450static unsigned fringe_faces[MAX_FRINGE_BITMAPS]; 450static unsigned *fringe_faces;
451static int max_fringe_bitmaps;
451 452
452static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; 453static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
453 454
454/* Return 1 if FRINGE_ID is a valid fringe bitmap id. */ 455
456/* Lookup bitmap number for symbol BITMAP.
457 Return 0 if not a bitmap. */
455 458
456int 459int
457valid_fringe_bitmap_p (bitmap) 460lookup_fringe_bitmap (bitmap)
458 Lisp_Object bitmap; 461 Lisp_Object bitmap;
459{ 462{
460 int bn; 463 int bn;
461 464
465 bitmap = Fget (bitmap, Qfringe);
462 if (!INTEGERP (bitmap)) 466 if (!INTEGERP (bitmap))
463 return 0; 467 return 0;
464 468
465 bn = XINT (bitmap); 469 bn = XINT (bitmap);
466 return (bn >= NO_FRINGE_BITMAP 470 if (bn > NO_FRINGE_BITMAP
467 && bn < max_used_fringe_bitmap 471 && bn < max_used_fringe_bitmap
468 && (bn < MAX_STANDARD_FRINGE_BITMAPS 472 && (bn < MAX_STANDARD_FRINGE_BITMAPS
469 || fringe_bitmaps[bn] != NULL)); 473 || fringe_bitmaps[bn] != NULL))
474 return bn;
475
476 return 0;
470} 477}
471 478
472/* Get fringe bitmap name for bitmap number BN. 479/* Get fringe bitmap name for bitmap number BN.
@@ -502,42 +509,6 @@ get_fringe_bitmap_name (bn)
502} 509}
503 510
504 511
505/* Resolve a BITMAP parameter.
506
507 An INTEGER, corresponding to a bitmap number.
508 A STRING which is interned to a symbol.
509 A SYMBOL which has a fringe property which is a bitmap number.
510*/
511
512static int
513resolve_fringe_bitmap (bitmap, namep)
514 Lisp_Object bitmap;
515 Lisp_Object *namep;
516{
517 if (namep)
518 *namep = Qnil;
519
520 if (STRINGP (bitmap))
521 bitmap = intern (SDATA (bitmap));
522
523 if (SYMBOLP (bitmap))
524 {
525 if (namep)
526 *namep = bitmap;
527 bitmap = Fget (bitmap, Qfringe);
528 }
529
530 if (valid_fringe_bitmap_p (bitmap))
531 {
532 if (namep && NILP (*namep))
533 *namep = get_fringe_bitmap_name (XINT (bitmap));
534 return XINT (bitmap);
535 }
536
537 return -1;
538}
539
540
541/* Draw the bitmap WHICH in one of the left or right fringes of 512/* Draw the bitmap WHICH in one of the left or right fringes of
542 window W. ROW is the glyph row for which to display the bitmap; it 513 window W. ROW is the glyph row for which to display the bitmap; it
543 determines the vertical position at which the bitmap has to be 514 determines the vertical position at which the bitmap has to be
@@ -1069,7 +1040,9 @@ compute_fringe_widths (f, redraw)
1069} 1040}
1070 1041
1071 1042
1072void 1043/* Free resources used by a user-defined bitmap. */
1044
1045int
1073destroy_fringe_bitmap (n) 1046destroy_fringe_bitmap (n)
1074 int n; 1047 int n;
1075{ 1048{
@@ -1081,8 +1054,9 @@ destroy_fringe_bitmap (n)
1081 if (*fbp && (*fbp)->dynamic) 1054 if (*fbp && (*fbp)->dynamic)
1082 { 1055 {
1083 /* XXX Is SELECTED_FRAME OK here? */ 1056 /* XXX Is SELECTED_FRAME OK here? */
1084 if (FRAME_RIF (SELECTED_FRAME ())->destroy_fringe_bitmap) 1057 struct redisplay_interface *rif = FRAME_RIF (SELECTED_FRAME ());
1085 FRAME_RIF (SELECTED_FRAME ())->destroy_fringe_bitmap (n); 1058 if (rif && rif->destroy_fringe_bitmap)
1059 rif->destroy_fringe_bitmap (n);
1086 xfree (*fbp); 1060 xfree (*fbp);
1087 *fbp = NULL; 1061 *fbp = NULL;
1088 } 1062 }
@@ -1101,20 +1075,21 @@ If BITMAP overrides a standard fringe bitmap, the original bitmap is restored.
1101 Lisp_Object bitmap; 1075 Lisp_Object bitmap;
1102{ 1076{
1103 int n; 1077 int n;
1104 Lisp_Object sym;
1105 1078
1106 n = resolve_fringe_bitmap (bitmap, &sym); 1079 CHECK_SYMBOL (bitmap);
1107 if (n < 0) 1080 n = lookup_fringe_bitmap (bitmap);
1081 if (!n)
1108 return Qnil; 1082 return Qnil;
1109 1083
1110 destroy_fringe_bitmap (n); 1084 destroy_fringe_bitmap (n);
1111 1085
1112 if (SYMBOLP (sym)) 1086 if (n >= MAX_STANDARD_FRINGE_BITMAPS)
1113 { 1087 {
1114 Vfringe_bitmaps = Fdelq (sym, Vfringe_bitmaps); 1088 Vfringe_bitmaps = Fdelq (bitmap, Vfringe_bitmaps);
1115 /* It would be better to remove the fringe property. */ 1089 /* It would be better to remove the fringe property. */
1116 Fput (sym, Qfringe, Qnil); 1090 Fput (bitmap, Qfringe, Qnil);
1117 } 1091 }
1092
1118 return Qnil; 1093 return Qnil;
1119} 1094}
1120 1095
@@ -1188,8 +1163,9 @@ init_fringe_bitmap (which, fb, once_p)
1188 destroy_fringe_bitmap (which); 1163 destroy_fringe_bitmap (which);
1189 1164
1190 /* XXX Is SELECTED_FRAME OK here? */ 1165 /* XXX Is SELECTED_FRAME OK here? */
1191 if (FRAME_RIF (SELECTED_FRAME ())->define_fringe_bitmap) 1166 struct redisplay_interface *rif = FRAME_RIF (SELECTED_FRAME ());
1192 FRAME_RIF (SELECTED_FRAME ())->define_fringe_bitmap (which, fb->bits, fb->height, fb->width); 1167 if (rif && rif->define_fringe_bitmap)
1168 rif->define_fringe_bitmap (which, fb->bits, fb->height, fb->width);
1193 1169
1194 fringe_bitmaps[which] = fb; 1170 fringe_bitmaps[which] = fb;
1195 if (which >= max_used_fringe_bitmap) 1171 if (which >= max_used_fringe_bitmap)
@@ -1219,12 +1195,8 @@ If BITMAP already exists, the existing definition is replaced. */)
1219 unsigned short *b; 1195 unsigned short *b;
1220 struct fringe_bitmap fb, *xfb; 1196 struct fringe_bitmap fb, *xfb;
1221 int fill1 = 0, fill2 = 0; 1197 int fill1 = 0, fill2 = 0;
1222 Lisp_Object sym;
1223
1224 n = resolve_fringe_bitmap (bitmap, &sym);
1225 1198
1226 if (NILP (sym) || INTEGERP (sym)) 1199 CHECK_SYMBOL (bitmap);
1227 sym = wrong_type_argument (Qsymbolp, bitmap);
1228 1200
1229 if (!STRINGP (bits) && !VECTORP (bits)) 1201 if (!STRINGP (bits) && !VECTORP (bits))
1230 bits = wrong_type_argument (Qstringp, bits); 1202 bits = wrong_type_argument (Qstringp, bits);
@@ -1277,23 +1249,42 @@ If BITMAP already exists, the existing definition is replaced. */)
1277 else if (!NILP (align) && !EQ (align, Qcenter)) 1249 else if (!NILP (align) && !EQ (align, Qcenter))
1278 error ("Bad align argument"); 1250 error ("Bad align argument");
1279 1251
1280 if (n < 0) 1252 n = lookup_fringe_bitmap (bitmap);
1253 if (!n)
1281 { 1254 {
1282 if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS) 1255 if (max_used_fringe_bitmap < max_fringe_bitmaps)
1283 n = max_used_fringe_bitmap++; 1256 n = max_used_fringe_bitmap++;
1284 else 1257 else
1285 { 1258 {
1286 for (n = MAX_STANDARD_FRINGE_BITMAPS; 1259 for (n = MAX_STANDARD_FRINGE_BITMAPS;
1287 n < MAX_FRINGE_BITMAPS; 1260 n < max_fringe_bitmaps;
1288 n++) 1261 n++)
1289 if (fringe_bitmaps[n] == NULL) 1262 if (fringe_bitmaps[n] == NULL)
1290 break; 1263 break;
1291 if (n == MAX_FRINGE_BITMAPS) 1264
1292 error ("Cannot define more fringe bitmaps"); 1265 if (n == max_fringe_bitmaps)
1266 {
1267 if ((max_fringe_bitmaps + 20) > MAX_FRINGE_BITMAPS)
1268 error ("No free fringe bitmap slots");
1269
1270 i = max_fringe_bitmaps;
1271 max_fringe_bitmaps += 20;
1272 fringe_bitmaps
1273 = ((struct fringe_bitmap **)
1274 xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *)));
1275 fringe_faces
1276 = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (unsigned));
1277
1278 for (; i < max_fringe_bitmaps; i++)
1279 {
1280 fringe_bitmaps[i] = NULL;
1281 fringe_faces[i] = FRINGE_FACE_ID;
1282 }
1283 }
1293 } 1284 }
1294 1285
1295 Vfringe_bitmaps = Fcons (sym, Vfringe_bitmaps); 1286 Vfringe_bitmaps = Fcons (bitmap, Vfringe_bitmaps);
1296 Fput (sym, Qfringe, make_number (n)); 1287 Fput (bitmap, Qfringe, make_number (n));
1297 } 1288 }
1298 1289
1299 fb.dynamic = 1; 1290 fb.dynamic = 1;
@@ -1321,7 +1312,7 @@ If BITMAP already exists, the existing definition is replaced. */)
1321 1312
1322 init_fringe_bitmap (n, xfb, 0); 1313 init_fringe_bitmap (n, xfb, 0);
1323 1314
1324 return sym; 1315 return bitmap;
1325} 1316}
1326 1317
1327DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face, 1318DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face,
@@ -1331,11 +1322,12 @@ If FACE is nil, reset face to default fringe face. */)
1331 (bitmap, face) 1322 (bitmap, face)
1332 Lisp_Object bitmap, face; 1323 Lisp_Object bitmap, face;
1333{ 1324{
1334 int bn; 1325 int n;
1335 int face_id; 1326 int face_id;
1336 1327
1337 bn = resolve_fringe_bitmap (bitmap, 0); 1328 CHECK_SYMBOL (bitmap);
1338 if (bn < 0) 1329 n = lookup_fringe_bitmap (bitmap);
1330 if (!n)
1339 error ("Undefined fringe bitmap"); 1331 error ("Undefined fringe bitmap");
1340 1332
1341 if (!NILP (face)) 1333 if (!NILP (face))
@@ -1347,7 +1339,7 @@ If FACE is nil, reset face to default fringe face. */)
1347 else 1339 else
1348 face_id = FRINGE_FACE_ID; 1340 face_id = FRINGE_FACE_ID;
1349 1341
1350 fringe_faces [bn] = face_id; 1342 fringe_faces[n] = face_id;
1351 1343
1352 return Qnil; 1344 return Qnil;
1353} 1345}
@@ -1435,9 +1427,18 @@ init_fringe ()
1435{ 1427{
1436 int i; 1428 int i;
1437 1429
1438 bzero (fringe_bitmaps, sizeof fringe_bitmaps); 1430 max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
1439 for (i = 0; i < MAX_FRINGE_BITMAPS; i++) 1431
1440 fringe_faces[i] = FRINGE_FACE_ID; 1432 fringe_bitmaps
1433 = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
1434 fringe_faces
1435 = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned));
1436
1437 for (i = 0; i < max_fringe_bitmaps; i++)
1438 {
1439 fringe_bitmaps[i] = NULL;
1440 fringe_faces[i] = FRINGE_FACE_ID;
1441 }
1441} 1442}
1442 1443
1443#ifdef HAVE_NTGUI 1444#ifdef HAVE_NTGUI
@@ -1447,6 +1448,9 @@ w32_init_fringe ()
1447{ 1448{
1448 enum fringe_bitmap_type bt; 1449 enum fringe_bitmap_type bt;
1449 1450
1451 if (!rif)
1452 return;
1453
1450 for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++) 1454 for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++)
1451 { 1455 {
1452 struct fringe_bitmap *fb = &standard_bitmaps[bt]; 1456 struct fringe_bitmap *fb = &standard_bitmaps[bt];
@@ -1460,6 +1464,9 @@ w32_reset_fringes ()
1460 /* Destroy row bitmaps. */ 1464 /* Destroy row bitmaps. */
1461 int bt; 1465 int bt;
1462 1466
1467 if (!rif)
1468 return;
1469
1463 for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++) 1470 for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++)
1464 rif->destroy_fringe_bitmap (bt); 1471 rif->destroy_fringe_bitmap (bt);
1465} 1472}
diff --git a/src/process.c b/src/process.c
index dab7bdc3198..9638c2875da 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5203,6 +5203,7 @@ send_process (proc, buf, len, object)
5203 object = p->encoding_buf; 5203 object = p->encoding_buf;
5204 encode_coding (coding, (char *) buf, SDATA (object), 5204 encode_coding (coding, (char *) buf, SDATA (object),
5205 len, SBYTES (object)); 5205 len, SBYTES (object));
5206 coding_free_composition_data (coding);
5206 len = coding->produced; 5207 len = coding->produced;
5207 buf = SDATA (object); 5208 buf = SDATA (object);
5208 } 5209 }
diff --git a/src/w32term.c b/src/w32term.c
index 0614522a178..7e36845eaf3 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -62,7 +62,8 @@ Boston, MA 02111-1307, USA. */
62 62
63/* Fringe bitmaps. */ 63/* Fringe bitmaps. */
64 64
65static HBITMAP fringe_bmp[MAX_FRINGE_BITMAPS]; 65static int max_fringe_bmp = 0;
66static HBITMAP *fringe_bmp = 0;
66 67
67/* Non-nil means Emacs uses toolkit scroll bars. */ 68/* Non-nil means Emacs uses toolkit scroll bars. */
68 69
@@ -704,7 +705,7 @@ w32_draw_fringe_bitmap (w, row, p)
704 p->bx, p->by, p->nx, p->ny); 705 p->bx, p->by, p->nx, p->ny);
705 } 706 }
706 707
707 if (p->which) 708 if (p->which && p->which < max_fringe_bmp)
708 { 709 {
709 HBITMAP pixmap = fringe_bmp[p->which]; 710 HBITMAP pixmap = fringe_bmp[p->which];
710 HDC compat_hdc; 711 HDC compat_hdc;
@@ -767,6 +768,15 @@ w32_define_fringe_bitmap (which, bits, h, wd)
767 unsigned short *bits; 768 unsigned short *bits;
768 int h, wd; 769 int h, wd;
769{ 770{
771 if (which >= max_fringe_bmp)
772 {
773 int i = max_fringe_bmp;
774 max_fringe_bmp = which + 20;
775 fringe_bmp = (HBITMAP *) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (HBITMAP));
776 while (i < max_fringe_bmp)
777 fringe_bmp[i++] = 0;
778 }
779
770 fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits); 780 fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits);
771} 781}
772 782
@@ -774,6 +784,9 @@ static void
774w32_destroy_fringe_bitmap (which) 784w32_destroy_fringe_bitmap (which)
775 int which; 785 int which;
776{ 786{
787 if (which >= max_fringe_bmp)
788 return;
789
777 if (fringe_bmp[which]) 790 if (fringe_bmp[which])
778 DeleteObject (fringe_bmp[which]); 791 DeleteObject (fringe_bmp[which]);
779 fringe_bmp[which] = 0; 792 fringe_bmp[which] = 0;
diff --git a/src/xdisp.c b/src/xdisp.c
index 2820bbb3883..3d52e60c12f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -307,7 +307,6 @@ extern Lisp_Object Qheight;
307extern Lisp_Object QCwidth, QCheight, QCascent; 307extern Lisp_Object QCwidth, QCheight, QCascent;
308extern Lisp_Object Qscroll_bar; 308extern Lisp_Object Qscroll_bar;
309extern Lisp_Object Qcursor; 309extern Lisp_Object Qcursor;
310extern Lisp_Object Qfringe;
311 310
312/* Non-nil means highlight trailing whitespace. */ 311/* Non-nil means highlight trailing whitespace. */
313 312
@@ -3565,6 +3564,7 @@ handle_single_display_prop (it, prop, object, position,
3565 && CONSP (XCDR (prop))) 3564 && CONSP (XCDR (prop)))
3566 { 3565 {
3567 unsigned face_id = DEFAULT_FACE_ID; 3566 unsigned face_id = DEFAULT_FACE_ID;
3567 int fringe_bitmap;
3568 3568
3569 /* Save current settings of IT so that we can restore them 3569 /* Save current settings of IT so that we can restore them
3570 when we are finished with the glyph property value. */ 3570 when we are finished with the glyph property value. */
@@ -3576,8 +3576,7 @@ handle_single_display_prop (it, prop, object, position,
3576#ifdef HAVE_WINDOW_SYSTEM 3576#ifdef HAVE_WINDOW_SYSTEM
3577 value = XCAR (XCDR (prop)); 3577 value = XCAR (XCDR (prop));
3578 if (!SYMBOLP (value) 3578 if (!SYMBOLP (value)
3579 || (value = Fget (value, Qfringe), 3579 || !(fringe_bitmap = lookup_fringe_bitmap (value)))
3580 !valid_fringe_bitmap_p (value)))
3581 return 0; 3580 return 0;
3582 3581
3583 if (CONSP (XCDR (XCDR (prop)))) 3582 if (CONSP (XCDR (XCDR (prop))))
@@ -3606,12 +3605,12 @@ handle_single_display_prop (it, prop, object, position,
3606 3605
3607 if (EQ (XCAR (prop), Qleft_fringe)) 3606 if (EQ (XCAR (prop), Qleft_fringe))
3608 { 3607 {
3609 it->left_user_fringe_bitmap = XINT (value); 3608 it->left_user_fringe_bitmap = fringe_bitmap;
3610 it->left_user_fringe_face_id = face_id; 3609 it->left_user_fringe_face_id = face_id;
3611 } 3610 }
3612 else 3611 else
3613 { 3612 {
3614 it->right_user_fringe_bitmap = XINT (value); 3613 it->right_user_fringe_bitmap = fringe_bitmap;
3615 it->right_user_fringe_face_id = face_id; 3614 it->right_user_fringe_face_id = face_id;
3616 } 3615 }
3617#endif /* HAVE_WINDOW_SYSTEM */ 3616#endif /* HAVE_WINDOW_SYSTEM */