aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2004-09-29 07:22:20 +0000
committerMiles Bader2004-09-29 07:22:20 +0000
commit93952a2d5b2ba718f9d688dda216fed8621ec21e (patch)
treec4cda2097cdc4b8d07260702c7325b0fa1f6e30d /src
parent4148c3c9425939c1639f349b20a33b71fea72b8e (diff)
parentc1d7d28589c020b2b72d795638e100eda852d6aa (diff)
downloademacs-93952a2d5b2ba718f9d688dda216fed8621ec21e.tar.gz
emacs-93952a2d5b2ba718f9d688dda216fed8621ec21e.zip
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-47
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-571 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-572 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-574 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-575 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-576 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-579 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-580 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-31 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-33 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-34 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-35 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-37 Update from CVS
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog38
-rw-r--r--src/buffer.c22
-rw-r--r--src/config.in2
-rw-r--r--src/dispextern.h2
-rw-r--r--src/fringe.c286
-rw-r--r--src/xdisp.c6
6 files changed, 256 insertions, 100 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f7e62c1ce21..b71bffc5bce 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,41 @@
12004-09-29 Kim F. Storm <storm@cua.dk>
2
3 * dispextern.h (valid_fringe_bitmap_p): Fix prototype.
4
5 * fringe.c (Vfringe_bitmaps): New variable.
6 (syms_of_fringe): DEFVAR_LISP it.
7 (valid_fringe_bitmap_p): Rename from valid_fringe_bitmap_id_p.
8 Change arg to Lisp_Object and fail if not an integer.
9 (get_fringe_bitmap_name, resolve_fringe_bitmap)
10 (destroy_fringe_bitmap): New functions.
11 (Fdestroy_fringe_bitmap): Change arg to bitmap symbol. Use
12 destroy_fringe_bitmap. Remove symbol from Vfringe_bitmaps and
13 clear its fringe property.
14 (init_fringe_bitmap): Use destroy_fringe_bitmap instead of
15 Fdestroy_fringe_bitmap.
16 (Fdefine_fringe_bitmap): Add BITMAP arg specifying new or existing
17 bitmap symbol; remove WHICH arg. Add symbol to Vfringe_bitmaps
18 and set fringe property. Signal error if no free slots.
19 (Fset_fringe_bitmap_face): Change arg to bitmap symbol.
20 (Ffringe_bitmaps_at_pos): Return bitmap symbols instead of numbers.
21
22 * xdisp.c (handle_single_display_prop): Fringe bitmaps are now
23 symbols with a fringe property.
24
252004-09-27 Kim F. Storm <storm@cua.dk>
26
27 * buffer.c (syms_of_buffer) <indicate-buffer-boundaries>:
28 Doc fix. Format may now be a symbol or alist, not a cons.
29
30 * fringe.c (update_window_fringes): Handle new formats of
31 indicate-buffer-boundaries (symbol or alist). No longer
32 allow a simple cons.
33 (Ffringe_bitmaps_at_pos): Use nil value for no bitmap.
34
352004-09-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
36
37 * config.in: Rebuild
38
12004-09-24 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 392004-09-24 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
2 40
3 * config.in: Rebuild. 41 * config.in: Rebuild.
diff --git a/src/buffer.c b/src/buffer.c
index 75339c4fc85..b8aefcdbcca 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5698,16 +5698,20 @@ If non-nil, the first and last line of the buffer are marked in the fringe
5698of a window on window-systems with angle bitmaps, or if the window can be 5698of a window on window-systems with angle bitmaps, or if the window can be
5699scrolled, the top and bottom line of the window are marked with up and down 5699scrolled, the top and bottom line of the window are marked with up and down
5700arrow bitmaps. 5700arrow bitmaps.
5701If value is `left' or `right', both angle and arrow bitmaps are displayed in 5701
5702the left or right fringe, resp. Any other non-nil value causes the 5702If value is a symbol `left' or `right', both angle and arrow bitmaps
5703bitmap on the top line to be displayed in the left fringe, and the 5703are displayed in the left or right fringe, resp.
5704bitmap on the bottom line in the right fringe. 5704
5705If value is a cons (ANGLES . ARROWS), the car specifies the position 5705If value is an alist, each element (INDICATOR . POSITION) specifies
5706of the angle bitmaps, and the cdr specifies the position of the arrow 5706the position of one of the indicators. INDICATOR is one of `top',
5707bitmaps. For example, (t . right) places the top angle bitmap in left 5707`bottom', `up', `down', or t, which specifies the default position,
5708fringe, the bottom angle bitmap in right fringe, and both arrow 5708and POSITION is one of `left', `right', or nil, meaning do not show
5709this indicator.
5710
5711For example, ((top . left) (t . right)) places the top angle bitmap in
5712left fringe, the bottom angle bitmap in right fringe, and both arrow
5709bitmaps in right fringe. To show just the angle bitmaps in the left 5713bitmaps in right fringe. To show just the angle bitmaps in the left
5710fringe, but no arrow bitmaps, use (left . nil). */); 5714fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */);
5711 5715
5712 DEFVAR_PER_BUFFER ("scroll-up-aggressively", 5716 DEFVAR_PER_BUFFER ("scroll-up-aggressively",
5713 &current_buffer->scroll_up_aggressively, Qnil, 5717 &current_buffer->scroll_up_aggressively, Qnil,
diff --git a/src/config.in b/src/config.in
index fac26db0a84..d87d235fe55 100644
--- a/src/config.in
+++ b/src/config.in
@@ -136,7 +136,7 @@ Boston, MA 02111-1307, USA. */
136/* Define to 1 if you have the `euidaccess' function. */ 136/* Define to 1 if you have the `euidaccess' function. */
137#undef HAVE_EUIDACCESS 137#undef HAVE_EUIDACCESS
138 138
139/* Define to 1 if this OS has exec shield. */ 139/* Define to 1 if this OS has exec shield and we can handle it. */
140#undef HAVE_EXECSHIELD 140#undef HAVE_EXECSHIELD
141 141
142/* Define to 1 if you have the <fcntl.h> header file. */ 142/* Define to 1 if you have the <fcntl.h> header file. */
diff --git a/src/dispextern.h b/src/dispextern.h
index 43ebe5c24d0..47454d5ba5a 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2634,7 +2634,7 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *,
2634 2634
2635/* Defined in fringe.c */ 2635/* Defined in fringe.c */
2636 2636
2637int valid_fringe_bitmap_id_p (int); 2637int valid_fringe_bitmap_p (Lisp_Object);
2638void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); 2638void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int));
2639void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); 2639void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *));
2640void draw_window_fringes P_ ((struct window *)); 2640void draw_window_fringes P_ ((struct window *));
diff --git a/src/fringe.c b/src/fringe.c
index 3f040699009..d731bf5eaa6 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -31,12 +31,22 @@ Boston, MA 02111-1307, USA. */
31 31
32#ifdef HAVE_WINDOW_SYSTEM 32#ifdef HAVE_WINDOW_SYSTEM
33 33
34extern Lisp_Object Qfringe;
34extern Lisp_Object Qtop, Qbottom, Qcenter; 35extern Lisp_Object Qtop, Qbottom, Qcenter;
36extern Lisp_Object Qup, Qdown, Qleft, Qright;
35 37
36/* Non-nil means that newline may flow into the right fringe. */ 38/* Non-nil means that newline may flow into the right fringe. */
37 39
38Lisp_Object Voverflow_newline_into_fringe; 40Lisp_Object Voverflow_newline_into_fringe;
39 41
42/* List of known fringe bitmap symbols.
43
44 The fringe bitmap number is stored in the `fringe' property on
45 those symbols. Names for the built-in bitmaps are installed by
46 loading fringe.el.
47 */
48
49Lisp_Object Vfringe_bitmaps;
40 50
41enum fringe_bitmap_type 51enum fringe_bitmap_type
42{ 52{
@@ -443,15 +453,90 @@ static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
443/* Return 1 if FRINGE_ID is a valid fringe bitmap id. */ 453/* Return 1 if FRINGE_ID is a valid fringe bitmap id. */
444 454
445int 455int
446valid_fringe_bitmap_id_p (fringe_id) 456valid_fringe_bitmap_p (bitmap)
447 int fringe_id; 457 Lisp_Object bitmap;
458{
459 int bn;
460
461 if (!INTEGERP (bitmap))
462 return 0;
463
464 bn = XINT (bitmap);
465 return (bn >= NO_FRINGE_BITMAP
466 && bn < max_used_fringe_bitmap
467 && (bn < MAX_STANDARD_FRINGE_BITMAPS
468 || fringe_bitmaps[bn] != NULL));
469}
470
471/* Get fringe bitmap name for bitmap number BN.
472
473 Found by traversing Vfringe_bitmaps comparing BN to the
474 fringe property for each symbol.
475
476 Return BN if not found in Vfringe_bitmaps. */
477
478static Lisp_Object
479get_fringe_bitmap_name (bn)
480 int bn;
481{
482 Lisp_Object bitmaps;
483 Lisp_Object num;
484
485 /* Zero means no bitmap -- return nil. */
486 if (bn <= 0)
487 return Qnil;
488
489 bitmaps = Vfringe_bitmaps;
490 num = make_number (bn);
491
492 while (CONSP (bitmaps))
493 {
494 Lisp_Object bitmap = XCAR (bitmaps);
495 if (EQ (num, Fget (bitmap, Qfringe)))
496 return bitmap;
497 bitmaps = XCDR (bitmaps);
498 }
499
500 return num;
501}
502
503
504/* Resolve a BITMAP parameter.
505
506 An INTEGER, corresponding to a bitmap number.
507 A STRING which is interned to a symbol.
508 A SYMBOL which has a fringe property which is a bitmap number.
509*/
510
511static int
512resolve_fringe_bitmap (bitmap, namep)
513 Lisp_Object bitmap;
514 Lisp_Object *namep;
448{ 515{
449 return (fringe_id >= NO_FRINGE_BITMAP 516 if (namep)
450 && fringe_id < max_used_fringe_bitmap 517 *namep = Qnil;
451 && (fringe_id < MAX_STANDARD_FRINGE_BITMAPS 518
452 || fringe_bitmaps[fringe_id] != NULL)); 519 if (STRINGP (bitmap))
520 bitmap = intern (SDATA (bitmap));
521
522 if (SYMBOLP (bitmap))
523 {
524 if (namep)
525 *namep = bitmap;
526 bitmap = Fget (bitmap, Qfringe);
527 }
528
529 if (valid_fringe_bitmap_p (bitmap))
530 {
531 if (namep && NILP (*namep))
532 *namep = get_fringe_bitmap_name (XINT (bitmap));
533 return XINT (bitmap);
534 }
535
536 return -1;
453} 537}
454 538
539
455/* Draw the bitmap WHICH in one of the left or right fringes of 540/* Draw the bitmap WHICH in one of the left or right fringes of
456 window W. ROW is the glyph row for which to display the bitmap; it 541 window W. ROW is the glyph row for which to display the bitmap; it
457 determines the vertical position at which the bitmap has to be 542 determines the vertical position at which the bitmap has to be
@@ -706,9 +791,10 @@ update_window_fringes (w, force_p)
706 int rn, nrows = w->current_matrix->nrows; 791 int rn, nrows = w->current_matrix->nrows;
707 int y; 792 int y;
708 int redraw_p = 0; 793 int redraw_p = 0;
709 Lisp_Object ind; 794 Lisp_Object boundary_top = Qnil, boundary_bot = Qnil;
710 int boundary_pos = 0, arrow_pos = 0; 795 Lisp_Object arrow_top = Qnil, arrow_bot = Qnil;
711 int empty_pos = 0; 796 Lisp_Object empty_pos;
797 Lisp_Object ind = Qnil;
712 798
713 if (w->pseudo_window_p) 799 if (w->pseudo_window_p)
714 return 0; 800 return 0;
@@ -716,23 +802,29 @@ update_window_fringes (w, force_p)
716 if (!MINI_WINDOW_P (w) 802 if (!MINI_WINDOW_P (w)
717 && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind))) 803 && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind)))
718 { 804 {
719 int do_eob = 1, do_bob = 1; 805 if (EQ (ind, Qleft) || EQ (ind, Qright))
720 Lisp_Object arrows; 806 boundary_top = boundary_bot = arrow_top = arrow_bot = ind;
721 807 else if (CONSP (ind) && CONSP (XCAR (ind)))
722 if (CONSP (ind)) 808 {
723 arrows = XCDR (ind), ind = XCAR (ind); 809 Lisp_Object pos;
810 if (pos = Fassq (Qt, ind), !NILP (pos))
811 boundary_top = boundary_bot = arrow_top = arrow_bot = XCDR (pos);
812 if (pos = Fassq (Qtop, ind), !NILP (pos))
813 boundary_top = XCDR (pos);
814 if (pos = Fassq (Qbottom, ind), !NILP (pos))
815 boundary_bot = XCDR (pos);
816 if (pos = Fassq (Qup, ind), !NILP (pos))
817 arrow_top = XCDR (pos);
818 if (pos = Fassq (Qdown, ind), !NILP (pos))
819 arrow_bot = XCDR (pos);
820 }
724 else 821 else
725 arrows = ind; 822 ind = Qnil;
726 823 }
727 if (EQ (ind, Qleft))
728 boundary_pos = -1;
729 else if (EQ (ind, Qright))
730 boundary_pos = 1;
731 824
732 if (EQ (arrows, Qleft)) 825 if (!NILP (ind))
733 arrow_pos = -1; 826 {
734 else if (EQ (arrows, Qright)) 827 int do_eob = 1, do_bob = 1;
735 arrow_pos = 1;
736 828
737 for (y = 0, rn = 0; 829 for (y = 0, rn = 0;
738 y < yb && rn < nrows; 830 y < yb && rn < nrows;
@@ -753,17 +845,17 @@ update_window_fringes (w, force_p)
753 row->indicate_bob_p = row->indicate_top_line_p = 0; 845 row->indicate_bob_p = row->indicate_top_line_p = 0;
754 row->indicate_eob_p = row->indicate_bottom_line_p = 0; 846 row->indicate_eob_p = row->indicate_bottom_line_p = 0;
755 847
756 if (!NILP (ind) 848 if (!NILP (boundary_top)
757 && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer))) 849 && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)))
758 row->indicate_bob_p = do_bob, do_bob = 0; 850 row->indicate_bob_p = do_bob, do_bob = 0;
759 else if (!NILP (arrows) 851 else if (!NILP (arrow_top)
760 && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn) 852 && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn)
761 row->indicate_top_line_p = 1; 853 row->indicate_top_line_p = 1;
762 854
763 if (!NILP (ind) 855 if (!NILP (boundary_bot)
764 && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer))) 856 && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
765 row->indicate_eob_p = do_eob, do_eob = 0; 857 row->indicate_eob_p = do_eob, do_eob = 0;
766 else if (!NILP (arrows) 858 else if (!NILP (arrow_bot)
767 && y + row->height >= yb) 859 && y + row->height >= yb)
768 row->indicate_bottom_line_p = 1; 860 row->indicate_bottom_line_p = 1;
769 861
@@ -775,10 +867,9 @@ update_window_fringes (w, force_p)
775 } 867 }
776 } 868 }
777 869
778 if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qright)) 870 empty_pos = XBUFFER (w->buffer)->indicate_empty_lines;
779 empty_pos = 1; 871 if (!NILP (empty_pos) && !EQ (empty_pos, Qright))
780 else if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qleft)) 872 empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft;
781 empty_pos = -1;
782 873
783 for (y = 0, rn = 0; 874 for (y = 0, rn = 0;
784 y < yb && rn < nrows; 875 y < yb && rn < nrows;
@@ -802,20 +893,20 @@ update_window_fringes (w, force_p)
802 left = row->left_user_fringe_bitmap; 893 left = row->left_user_fringe_bitmap;
803 left_face_id = row->left_user_fringe_face_id; 894 left_face_id = row->left_user_fringe_face_id;
804 } 895 }
805 else if (row->indicate_bob_p && boundary_pos <= 0) 896 else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
806 left = ((row->indicate_eob_p && boundary_pos < 0) 897 left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft))
807 ? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP); 898 ? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP);
808 else if (row->indicate_eob_p && boundary_pos < 0) 899 else if (row->indicate_eob_p && EQ (boundary_bot, Qleft))
809 left = BOTTOM_LEFT_ANGLE_BITMAP; 900 left = BOTTOM_LEFT_ANGLE_BITMAP;
810 else if (row->truncated_on_left_p) 901 else if (row->truncated_on_left_p)
811 left = LEFT_TRUNCATION_BITMAP; 902 left = LEFT_TRUNCATION_BITMAP;
812 else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) 903 else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
813 left = CONTINUATION_LINE_BITMAP; 904 left = CONTINUATION_LINE_BITMAP;
814 else if (row->indicate_empty_line_p && empty_pos <= 0) 905 else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
815 left = ZV_LINE_BITMAP; 906 left = ZV_LINE_BITMAP;
816 else if (row->indicate_top_line_p && arrow_pos <= 0) 907 else if (row->indicate_top_line_p && EQ (arrow_top, Qleft))
817 left = UP_ARROW_BITMAP; 908 left = UP_ARROW_BITMAP;
818 else if (row->indicate_bottom_line_p && arrow_pos < 0) 909 else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qleft))
819 left = DOWN_ARROW_BITMAP; 910 left = DOWN_ARROW_BITMAP;
820 else 911 else
821 left = NO_FRINGE_BITMAP; 912 left = NO_FRINGE_BITMAP;
@@ -828,22 +919,20 @@ update_window_fringes (w, force_p)
828 right = row->right_user_fringe_bitmap; 919 right = row->right_user_fringe_bitmap;
829 right_face_id = row->right_user_fringe_face_id; 920 right_face_id = row->right_user_fringe_face_id;
830 } 921 }
831 else if (row->indicate_bob_p && boundary_pos > 0) 922 else if (row->indicate_bob_p && EQ (boundary_top, Qright))
832 right = ((row->indicate_eob_p && boundary_pos >= 0) 923 right = ((row->indicate_eob_p && EQ (boundary_bot, Qright))
833 ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP); 924 ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP);
834 else if (row->indicate_eob_p && boundary_pos >= 0) 925 else if (row->indicate_eob_p && EQ (boundary_bot, Qright))
835 right = BOTTOM_RIGHT_ANGLE_BITMAP; 926 right = BOTTOM_RIGHT_ANGLE_BITMAP;
836 else if (row->truncated_on_right_p) 927 else if (row->truncated_on_right_p)
837 right = RIGHT_TRUNCATION_BITMAP; 928 right = RIGHT_TRUNCATION_BITMAP;
838 else if (row->continued_p) 929 else if (row->continued_p)
839 right = CONTINUED_LINE_BITMAP; 930 right = CONTINUED_LINE_BITMAP;
840 else if (row->indicate_top_line_p && arrow_pos > 0) 931 else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
841 right = UP_ARROW_BITMAP; 932 right = UP_ARROW_BITMAP;
842 else if (row->indicate_bottom_line_p && arrow_pos >= 0) 933 else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qright))
843 right = DOWN_ARROW_BITMAP; 934 right = DOWN_ARROW_BITMAP;
844 else if (row->indicate_empty_line_p 935 else if (row->indicate_empty_line_p && EQ (empty_pos, Qright))
845 && (empty_pos > 0
846 || (WINDOW_LEFT_FRINGE_WIDTH (w) == 0 && empty_pos == 0)))
847 right = ZV_LINE_BITMAP; 936 right = ZV_LINE_BITMAP;
848 else 937 else
849 right = NO_FRINGE_BITMAP; 938 right = NO_FRINGE_BITMAP;
@@ -978,20 +1067,13 @@ compute_fringe_widths (f, redraw)
978 redraw_frame (f); 1067 redraw_frame (f);
979} 1068}
980 1069
981DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, Sdestroy_fringe_bitmap, 1070
982 1, 1, 0, 1071void
983 doc: /* Destroy fringe bitmap WHICH. 1072destroy_fringe_bitmap (n)
984If WHICH overrides a standard fringe bitmap, the original bitmap is restored. */) 1073 int n;
985 (which)
986 Lisp_Object which;
987{ 1074{
988 int n;
989 struct fringe_bitmap **fbp; 1075 struct fringe_bitmap **fbp;
990 1076
991 CHECK_NUMBER (which);
992 if (n = XINT (which), n >= max_used_fringe_bitmap)
993 return Qnil;
994
995 fringe_faces[n] = FRINGE_FACE_ID; 1077 fringe_faces[n] = FRINGE_FACE_ID;
996 1078
997 fbp = &fringe_bitmaps[n]; 1079 fbp = &fringe_bitmaps[n];
@@ -1006,7 +1088,31 @@ If WHICH overrides a standard fringe bitmap, the original bitmap is restored. *
1006 while (max_used_fringe_bitmap > MAX_STANDARD_FRINGE_BITMAPS 1088 while (max_used_fringe_bitmap > MAX_STANDARD_FRINGE_BITMAPS
1007 && fringe_bitmaps[max_used_fringe_bitmap - 1] == NULL) 1089 && fringe_bitmaps[max_used_fringe_bitmap - 1] == NULL)
1008 max_used_fringe_bitmap--; 1090 max_used_fringe_bitmap--;
1091}
1092
1009 1093
1094DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, Sdestroy_fringe_bitmap,
1095 1, 1, 0,
1096 doc: /* Destroy fringe bitmap BITMAP.
1097If BITMAP overrides a standard fringe bitmap, the original bitmap is restored. */)
1098 (bitmap)
1099 Lisp_Object bitmap;
1100{
1101 int n;
1102 Lisp_Object sym;
1103
1104 n = resolve_fringe_bitmap (bitmap, &sym);
1105 if (n < 0)
1106 return Qnil;
1107
1108 destroy_fringe_bitmap (n);
1109
1110 if (SYMBOLP (sym))
1111 {
1112 Vfringe_bitmaps = Fdelq (sym, Vfringe_bitmaps);
1113 /* It would be better to remove the fringe property. */
1114 Fput (sym, Qfringe, Qnil);
1115 }
1010 return Qnil; 1116 return Qnil;
1011} 1117}
1012 1118
@@ -1077,7 +1183,7 @@ init_fringe_bitmap (which, fb, once_p)
1077 1183
1078 if (!once_p) 1184 if (!once_p)
1079 { 1185 {
1080 Fdestroy_fringe_bitmap (make_number (which)); 1186 destroy_fringe_bitmap (which);
1081 1187
1082 if (rif->define_fringe_bitmap) 1188 if (rif->define_fringe_bitmap)
1083 rif->define_fringe_bitmap (which, fb->bits, fb->height, fb->width); 1189 rif->define_fringe_bitmap (which, fb->bits, fb->height, fb->width);
@@ -1090,26 +1196,32 @@ init_fringe_bitmap (which, fb, once_p)
1090 1196
1091 1197
1092DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap, 1198DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap,
1093 1, 5, 0, 1199 2, 5, 0,
1094 doc: /* Define a fringe bitmap from BITS of height HEIGHT and width WIDTH. 1200 doc: /* Define fringe bitmap BITMAP from BITS of size HEIGHT x WIDTH.
1201BITMAP is a symbol or string naming the new fringe bitmap.
1095BITS is either a string or a vector of integers. 1202BITS is either a string or a vector of integers.
1096HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS. 1203HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS.
1097WIDTH must be an integer between 1 and 16, or nil which defaults to 8. 1204WIDTH must be an integer between 1 and 16, or nil which defaults to 8.
1098Optional fourth arg ALIGN may be one of `top', `center', or `bottom', 1205Optional fifth arg ALIGN may be one of `top', `center', or `bottom',
1099indicating the positioning of the bitmap relative to the rows where it 1206indicating the positioning of the bitmap relative to the rows where it
1100is used; the default is to center the bitmap. Fourth arg may also be a 1207is used; the default is to center the bitmap. Fourth arg may also be a
1101list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap 1208list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap
1102should be repeated. 1209should be repeated.
1103Optional fifth argument WHICH is bitmap number to redefine. 1210If BITMAP already exists, the existing definition is replaced. */)
1104Return new bitmap number, or nil of no more free bitmap slots. */) 1211 (bitmap, bits, height, width, align)
1105 (bits, height, width, align, which) 1212 Lisp_Object bitmap, bits, height, width, align;
1106 Lisp_Object bits, height, width, align, which;
1107{ 1213{
1108 Lisp_Object len; 1214 Lisp_Object len;
1109 int n, h, i, j; 1215 int n, h, i, j;
1110 unsigned short *b; 1216 unsigned short *b;
1111 struct fringe_bitmap fb, *xfb; 1217 struct fringe_bitmap fb, *xfb;
1112 int fill1 = 0, fill2 = 0; 1218 int fill1 = 0, fill2 = 0;
1219 Lisp_Object sym;
1220
1221 n = resolve_fringe_bitmap (bitmap, &sym);
1222
1223 if (NILP (sym) || INTEGERP (sym))
1224 sym = wrong_type_argument (Qsymbolp, bitmap);
1113 1225
1114 if (!STRINGP (bits) && !VECTORP (bits)) 1226 if (!STRINGP (bits) && !VECTORP (bits))
1115 bits = wrong_type_argument (Qstringp, bits); 1227 bits = wrong_type_argument (Qstringp, bits);
@@ -1162,7 +1274,7 @@ Return new bitmap number, or nil of no more free bitmap slots. */)
1162 else if (!NILP (align) && !EQ (align, Qcenter)) 1274 else if (!NILP (align) && !EQ (align, Qcenter))
1163 error ("Bad align argument"); 1275 error ("Bad align argument");
1164 1276
1165 if (NILP (which)) 1277 if (n < 0)
1166 { 1278 {
1167 if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS) 1279 if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS)
1168 n = max_used_fringe_bitmap++; 1280 n = max_used_fringe_bitmap++;
@@ -1174,16 +1286,11 @@ Return new bitmap number, or nil of no more free bitmap slots. */)
1174 if (fringe_bitmaps[n] == NULL) 1286 if (fringe_bitmaps[n] == NULL)
1175 break; 1287 break;
1176 if (n == MAX_FRINGE_BITMAPS) 1288 if (n == MAX_FRINGE_BITMAPS)
1177 return Qnil; 1289 error ("Cannot define more fringe bitmaps");
1178 } 1290 }
1179 which = make_number (n); 1291
1180 } 1292 Vfringe_bitmaps = Fcons (sym, Vfringe_bitmaps);
1181 else 1293 Fput (sym, Qfringe, make_number (n));
1182 {
1183 CHECK_NUMBER (which);
1184 n = XINT (which);
1185 if (n <= NO_FRINGE_BITMAP || n >= MAX_FRINGE_BITMAPS)
1186 error ("Invalid fringe bitmap number");
1187 } 1294 }
1188 1295
1189 fb.dynamic = 1; 1296 fb.dynamic = 1;
@@ -1211,21 +1318,22 @@ Return new bitmap number, or nil of no more free bitmap slots. */)
1211 1318
1212 init_fringe_bitmap (n, xfb, 0); 1319 init_fringe_bitmap (n, xfb, 0);
1213 1320
1214 return which; 1321 return sym;
1215} 1322}
1216 1323
1217DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face, 1324DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face,
1218 1, 2, 0, 1325 1, 2, 0,
1219 doc: /* Set face for fringe bitmap FRINGE-ID to FACE. 1326 doc: /* Set face for fringe bitmap BITMAP to FACE.
1220If FACE is nil, reset face to default fringe face. */) 1327If FACE is nil, reset face to default fringe face. */)
1221 (fringe_id, face) 1328 (bitmap, face)
1222 Lisp_Object fringe_id, face; 1329 Lisp_Object bitmap, face;
1223{ 1330{
1331 int bn;
1224 int face_id; 1332 int face_id;
1225 1333
1226 CHECK_NUMBER (fringe_id); 1334 bn = resolve_fringe_bitmap (bitmap, 0);
1227 if (!valid_fringe_bitmap_id_p (XINT (fringe_id))) 1335 if (bn < 0)
1228 error ("Invalid fringe id"); 1336 error ("Undefined fringe bitmap");
1229 1337
1230 if (!NILP (face)) 1338 if (!NILP (face))
1231 { 1339 {
@@ -1236,7 +1344,7 @@ If FACE is nil, reset face to default fringe face. */)
1236 else 1344 else
1237 face_id = FRINGE_FACE_ID; 1345 face_id = FRINGE_FACE_ID;
1238 1346
1239 fringe_faces [XINT (fringe_id)] = face_id; 1347 fringe_faces [bn] = face_id;
1240 1348
1241 return Qnil; 1349 return Qnil;
1242} 1350}
@@ -1247,7 +1355,8 @@ DEFUN ("fringe-bitmaps-at-pos", Ffringe_bitmaps_at_pos, Sfringe_bitmaps_at_pos,
1247If WINDOW is nil, use selected window. If POS is nil, use value of point 1355If WINDOW is nil, use selected window. If POS is nil, use value of point
1248in that window. Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT 1356in that window. Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT
1249are the fringe bitmap numbers for the bitmaps in the left and right fringe, 1357are the fringe bitmap numbers for the bitmaps in the left and right fringe,
1250resp. Return nil if POS is not visible in WINDOW. */) 1358resp. If left or right fringe is empty, the corresponding element is nil.
1359Return nil if POS is not visible in WINDOW. */)
1251 (pos, window) 1360 (pos, window)
1252 Lisp_Object pos, window; 1361 Lisp_Object pos, window;
1253{ 1362{
@@ -1274,8 +1383,8 @@ resp. Return nil if POS is not visible in WINDOW. */)
1274 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 1383 row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
1275 row = row_containing_pos (w, textpos, row, NULL, 0); 1384 row = row_containing_pos (w, textpos, row, NULL, 0);
1276 if (row) 1385 if (row)
1277 return Fcons (make_number (row->left_fringe_bitmap), 1386 return Fcons (get_fringe_bitmap_name (row->left_fringe_bitmap),
1278 make_number (row->right_fringe_bitmap)); 1387 get_fringe_bitmap_name (row->right_fringe_bitmap));
1279 else 1388 else
1280 return Qnil; 1389 return Qnil;
1281} 1390}
@@ -1288,7 +1397,6 @@ resp. Return nil if POS is not visible in WINDOW. */)
1288void 1397void
1289syms_of_fringe () 1398syms_of_fringe ()
1290{ 1399{
1291
1292 defsubr (&Sdestroy_fringe_bitmap); 1400 defsubr (&Sdestroy_fringe_bitmap);
1293 defsubr (&Sdefine_fringe_bitmap); 1401 defsubr (&Sdefine_fringe_bitmap);
1294 defsubr (&Sfringe_bitmaps_at_pos); 1402 defsubr (&Sfringe_bitmaps_at_pos);
@@ -1303,6 +1411,10 @@ is at the final newline, the cursor is shown in the right fringe.
1303If nil, also continue lines which are exactly as wide as the window. */); 1411If nil, also continue lines which are exactly as wide as the window. */);
1304 Voverflow_newline_into_fringe = Qt; 1412 Voverflow_newline_into_fringe = Qt;
1305 1413
1414 DEFVAR_LISP ("fringe-bitmaps", &Vfringe_bitmaps,
1415 doc: /* List of fringe bitmap symbols.
1416You must (require 'fringe) to use fringe bitmap symbols in your programs." */);
1417 Vfringe_bitmaps = Qnil;
1306} 1418}
1307 1419
1308/* Initialize this module when Emacs starts. */ 1420/* Initialize this module when Emacs starts. */
diff --git a/src/xdisp.c b/src/xdisp.c
index d8166a30df5..353a72f65b6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -308,6 +308,7 @@ extern Lisp_Object Qheight;
308extern Lisp_Object QCwidth, QCheight, QCascent; 308extern Lisp_Object QCwidth, QCheight, QCascent;
309extern Lisp_Object Qscroll_bar; 309extern Lisp_Object Qscroll_bar;
310extern Lisp_Object Qcursor; 310extern Lisp_Object Qcursor;
311extern Lisp_Object Qfringe;
311 312
312/* Non-nil means highlight trailing whitespace. */ 313/* Non-nil means highlight trailing whitespace. */
313 314
@@ -3581,8 +3582,9 @@ handle_single_display_prop (it, prop, object, position,
3581 3582
3582#ifdef HAVE_WINDOW_SYSTEM 3583#ifdef HAVE_WINDOW_SYSTEM
3583 value = XCAR (XCDR (prop)); 3584 value = XCAR (XCDR (prop));
3584 if (!NUMBERP (value) 3585 if (!SYMBOLP (value)
3585 || !valid_fringe_bitmap_id_p (XINT (value))) 3586 || (value = Fget (value, Qfringe),
3587 !valid_fringe_bitmap_p (value)))
3586 return 0; 3588 return 0;
3587 3589
3588 if (CONSP (XCDR (XCDR (prop)))) 3590 if (CONSP (XCDR (XCDR (prop))))