emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/fringe.c [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/fringe.c [lexbind]
Date: Wed, 06 Oct 2004 01:42:54 -0400

Index: emacs/src/fringe.c
diff -c emacs/src/fringe.c:1.2.2.4 emacs/src/fringe.c:1.2.2.5
*** emacs/src/fringe.c:1.2.2.4  Fri Mar 19 23:27:38 2004
--- emacs/src/fringe.c  Wed Oct  6 05:23:55 2004
***************
*** 31,42 ****
--- 31,52 ----
  
  #ifdef HAVE_WINDOW_SYSTEM
  
+ extern Lisp_Object Qfringe;
  extern Lisp_Object Qtop, Qbottom, Qcenter;
+ extern Lisp_Object Qup, Qdown, Qleft, Qright;
  
  /* Non-nil means that newline may flow into the right fringe.  */
  
  Lisp_Object Voverflow_newline_into_fringe;
  
+ /* List of known fringe bitmap symbols.
+ 
+    The fringe bitmap number is stored in the `fringe' property on
+    those symbols.  Names for the built-in bitmaps are installed by
+    loading fringe.el.
+  */
+ 
+ Lisp_Object Vfringe_bitmaps;
  
  enum fringe_bitmap_type
  {
***************
*** 435,457 ****
    { FRBITS (zv_bits),                 8, 3, ALIGN_BITMAP_TOP,    0 },
  };
  
! static struct fringe_bitmap *fringe_bitmaps[MAX_FRINGE_BITMAPS];
! static unsigned fringe_faces[MAX_FRINGE_BITMAPS];
  
  static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
  
! /* Return 1 if FRINGE_ID is a valid fringe bitmap id.  */
  
  int
! valid_fringe_bitmap_id_p (fringe_id)
!      int fringe_id;
  {
!   return (fringe_id >= NO_FRINGE_BITMAP
!         && fringe_id < max_used_fringe_bitmap
!         && (fringe_id < MAX_STANDARD_FRINGE_BITMAPS
!             || fringe_bitmaps[fringe_id] != NULL));
  }
  
  /* Draw the bitmap WHICH in one of the left or right fringes of
     window W.  ROW is the glyph row for which to display the bitmap; it
     determines the vertical position at which the bitmap has to be
--- 445,513 ----
    { FRBITS (zv_bits),                 8, 3, ALIGN_BITMAP_TOP,    0 },
  };
  
! static struct fringe_bitmap **fringe_bitmaps;
! static unsigned *fringe_faces;
! static int max_fringe_bitmaps;
  
  static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
  
! 
! /* Lookup bitmap number for symbol BITMAP.
!    Return 0 if not a bitmap.  */
  
  int
! lookup_fringe_bitmap (bitmap)
!      Lisp_Object bitmap;
  {
!   int bn;
! 
!   bitmap = Fget (bitmap, Qfringe);
!   if (!INTEGERP (bitmap))
!     return 0;
! 
!   bn = XINT (bitmap);
!   if (bn > NO_FRINGE_BITMAP
!       && bn < max_used_fringe_bitmap
!       && (bn < MAX_STANDARD_FRINGE_BITMAPS
!         || fringe_bitmaps[bn] != NULL))
!     return bn;
! 
!   return 0;
! }
! 
! /* Get fringe bitmap name for bitmap number BN.
! 
!    Found by traversing Vfringe_bitmaps comparing BN to the
!    fringe property for each symbol.
! 
!    Return BN if not found in Vfringe_bitmaps.  */
! 
! static Lisp_Object
! get_fringe_bitmap_name (bn)
!      int bn;
! {
!   Lisp_Object bitmaps;
!   Lisp_Object num;
! 
!   /* Zero means no bitmap -- return nil.  */
!   if (bn <= 0)
!     return Qnil;
! 
!   bitmaps = Vfringe_bitmaps;
!   num = make_number (bn);
! 
!   while (CONSP (bitmaps))
!     {
!       Lisp_Object bitmap = XCAR (bitmaps);
!       if (EQ (num, Fget (bitmap, Qfringe)))
!       return bitmap;
!       bitmaps = XCDR (bitmaps);
!     }
! 
!   return num;
  }
  
+ 
  /* Draw the bitmap WHICH in one of the left or right fringes of
     window W.  ROW is the glyph row for which to display the bitmap; it
     determines the vertical position at which the bitmap has to be
***************
*** 706,714 ****
    int rn, nrows = w->current_matrix->nrows;
    int y;
    int redraw_p = 0;
!   Lisp_Object ind;
!   int boundary_pos = 0, arrow_pos = 0;
!   int empty_pos = 0;
  
    if (w->pseudo_window_p)
      return 0;
--- 762,771 ----
    int rn, nrows = w->current_matrix->nrows;
    int y;
    int redraw_p = 0;
!   Lisp_Object boundary_top = Qnil, boundary_bot = Qnil;
!   Lisp_Object arrow_top = Qnil, arrow_bot = Qnil;
!   Lisp_Object empty_pos;
!   Lisp_Object ind = Qnil;
  
    if (w->pseudo_window_p)
      return 0;
***************
*** 716,738 ****
    if (!MINI_WINDOW_P (w)
        && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind)))
      {
!       int do_eob = 1, do_bob = 1;
!       Lisp_Object arrows;
! 
!       if (CONSP (ind))
!       arrows = XCDR (ind), ind = XCAR (ind);
        else
!       arrows = ind;
  
!       if (EQ (ind, Qleft))
!       boundary_pos = -1;
!       else if (EQ (ind, Qright))
!       boundary_pos = 1;
! 
!       if (EQ (arrows, Qleft))
!       arrow_pos = -1;
!       else if (EQ (arrows, Qright))
!       arrow_pos = 1;
  
        for (y = 0, rn = 0;
           y < yb && rn < nrows;
--- 773,801 ----
    if (!MINI_WINDOW_P (w)
        && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind)))
      {
!       if (EQ (ind, Qleft) || EQ (ind, Qright))
!       boundary_top = boundary_bot = arrow_top = arrow_bot = ind;
!       else if (CONSP (ind) && CONSP (XCAR (ind)))
!       {
!         Lisp_Object pos;
!         if (pos = Fassq (Qt, ind), !NILP (pos))
!           boundary_top = boundary_bot = arrow_top = arrow_bot = XCDR (pos);
!         if (pos = Fassq (Qtop, ind), !NILP (pos))
!           boundary_top = XCDR (pos);
!         if (pos = Fassq (Qbottom, ind), !NILP (pos))
!           boundary_bot = XCDR (pos);
!         if (pos = Fassq (Qup, ind), !NILP (pos))
!           arrow_top = XCDR (pos);
!         if (pos = Fassq (Qdown, ind), !NILP (pos))
!           arrow_bot = XCDR (pos);
!       }
        else
!       ind = Qnil;
!     }
  
!   if (!NILP (ind))
!     {
!       int do_eob = 1, do_bob = 1;
  
        for (y = 0, rn = 0;
           y < yb && rn < nrows;
***************
*** 753,769 ****
          row->indicate_bob_p = row->indicate_top_line_p = 0;
          row->indicate_eob_p = row->indicate_bottom_line_p = 0;
  
!         if (!NILP (ind)
              && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER 
(w->buffer)))
            row->indicate_bob_p = do_bob, do_bob = 0;
!         else if (!NILP (arrows)
                   && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn)
            row->indicate_top_line_p = 1;
  
!         if (!NILP (ind)
              && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
            row->indicate_eob_p = do_eob, do_eob = 0;
!         else if (!NILP (arrows)
                   && y + row->height >= yb)
            row->indicate_bottom_line_p = 1;
  
--- 816,832 ----
          row->indicate_bob_p = row->indicate_top_line_p = 0;
          row->indicate_eob_p = row->indicate_bottom_line_p = 0;
  
!         if (!NILP (boundary_top)
              && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER 
(w->buffer)))
            row->indicate_bob_p = do_bob, do_bob = 0;
!         else if (!NILP (arrow_top)
                   && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn)
            row->indicate_top_line_p = 1;
  
!         if (!NILP (boundary_bot)
              && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
            row->indicate_eob_p = do_eob, do_eob = 0;
!         else if (!NILP (arrow_bot)
                   && y + row->height >= yb)
            row->indicate_bottom_line_p = 1;
  
***************
*** 775,784 ****
        }
      }
  
!   if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qright))
!     empty_pos = 1;
!   else if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qleft))
!     empty_pos = -1;
  
    for (y = 0, rn = 0;
         y < yb && rn < nrows;
--- 838,846 ----
        }
      }
  
!   empty_pos = XBUFFER (w->buffer)->indicate_empty_lines;
!   if (!NILP (empty_pos) && !EQ (empty_pos, Qright))
!     empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft;
  
    for (y = 0, rn = 0;
         y < yb && rn < nrows;
***************
*** 802,821 ****
          left = row->left_user_fringe_bitmap;
          left_face_id = row->left_user_fringe_face_id;
        }
!       else if (row->indicate_bob_p && boundary_pos <= 0)
!       left = ((row->indicate_eob_p && boundary_pos < 0)
                ? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP);
!       else if (row->indicate_eob_p && boundary_pos < 0)
        left = BOTTOM_LEFT_ANGLE_BITMAP;
        else if (row->truncated_on_left_p)
        left = LEFT_TRUNCATION_BITMAP;
        else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
        left = CONTINUATION_LINE_BITMAP;
!       else if (row->indicate_empty_line_p && empty_pos <= 0)
        left = ZV_LINE_BITMAP;
!       else if (row->indicate_top_line_p && arrow_pos <= 0)
        left = UP_ARROW_BITMAP;
!       else if (row->indicate_bottom_line_p && arrow_pos < 0)
        left = DOWN_ARROW_BITMAP;
        else
        left = NO_FRINGE_BITMAP;
--- 864,883 ----
          left = row->left_user_fringe_bitmap;
          left_face_id = row->left_user_fringe_face_id;
        }
!       else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
!       left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft))
                ? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP);
!       else if (row->indicate_eob_p && EQ (boundary_bot, Qleft))
        left = BOTTOM_LEFT_ANGLE_BITMAP;
        else if (row->truncated_on_left_p)
        left = LEFT_TRUNCATION_BITMAP;
        else if (MATRIX_ROW_CONTINUATION_LINE_P (row))
        left = CONTINUATION_LINE_BITMAP;
!       else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft))
        left = ZV_LINE_BITMAP;
!       else if (row->indicate_top_line_p && EQ (arrow_top, Qleft))
        left = UP_ARROW_BITMAP;
!       else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qleft))
        left = DOWN_ARROW_BITMAP;
        else
        left = NO_FRINGE_BITMAP;
***************
*** 828,849 ****
          right = row->right_user_fringe_bitmap;
          right_face_id = row->right_user_fringe_face_id;
        }
!       else if (row->indicate_bob_p && boundary_pos > 0)
!       right = ((row->indicate_eob_p && boundary_pos >= 0)
                 ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP);
!       else if (row->indicate_eob_p && boundary_pos >= 0)
        right = BOTTOM_RIGHT_ANGLE_BITMAP;
        else if (row->truncated_on_right_p)
        right = RIGHT_TRUNCATION_BITMAP;
        else if (row->continued_p)
        right = CONTINUED_LINE_BITMAP;
!       else if (row->indicate_top_line_p && arrow_pos > 0)
        right = UP_ARROW_BITMAP;
!       else if (row->indicate_bottom_line_p && arrow_pos >= 0)
        right = DOWN_ARROW_BITMAP;
!       else if (row->indicate_empty_line_p
!              && (empty_pos > 0
!                  || (WINDOW_LEFT_FRINGE_WIDTH (w) == 0 && empty_pos == 0)))
        right = ZV_LINE_BITMAP;
        else
        right = NO_FRINGE_BITMAP;
--- 890,909 ----
          right = row->right_user_fringe_bitmap;
          right_face_id = row->right_user_fringe_face_id;
        }
!       else if (row->indicate_bob_p && EQ (boundary_top, Qright))
!       right = ((row->indicate_eob_p && EQ (boundary_bot, Qright))
                 ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP);
!       else if (row->indicate_eob_p && EQ (boundary_bot, Qright))
        right = BOTTOM_RIGHT_ANGLE_BITMAP;
        else if (row->truncated_on_right_p)
        right = RIGHT_TRUNCATION_BITMAP;
        else if (row->continued_p)
        right = CONTINUED_LINE_BITMAP;
!       else if (row->indicate_top_line_p && EQ (arrow_top, Qright))
        right = UP_ARROW_BITMAP;
!       else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qright))
        right = DOWN_ARROW_BITMAP;
!       else if (row->indicate_empty_line_p && EQ (empty_pos, Qright))
        right = ZV_LINE_BITMAP;
        else
        right = NO_FRINGE_BITMAP;
***************
*** 978,1003 ****
        redraw_frame (f);
  }
  
! DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, 
Sdestroy_fringe_bitmap,
!        1, 1, 0,
!        doc: /* Destroy fringe bitmap WHICH.
! If WHICH overrides a standard fringe bitmap, the original bitmap is restored. 
 */)
!   (which)
!      Lisp_Object which;
  {
-   int n;
    struct fringe_bitmap **fbp;
  
-   CHECK_NUMBER (which);
-   if (n = XINT (which), n >= max_used_fringe_bitmap)
-     return Qnil;
- 
    fringe_faces[n] = FRINGE_FACE_ID;
  
    fbp = &fringe_bitmaps[n];
    if (*fbp && (*fbp)->dynamic)
      {
!       if (rif->destroy_fringe_bitmap)
        rif->destroy_fringe_bitmap (n);
        xfree (*fbp);
        *fbp = NULL;
--- 1038,1058 ----
        redraw_frame (f);
  }
  
! 
! /* Free resources used by a user-defined bitmap.  */
! 
! int
! destroy_fringe_bitmap (n)
!      int n;
  {
    struct fringe_bitmap **fbp;
  
    fringe_faces[n] = FRINGE_FACE_ID;
  
    fbp = &fringe_bitmaps[n];
    if (*fbp && (*fbp)->dynamic)
      {
!       if (rif && rif->destroy_fringe_bitmap)
        rif->destroy_fringe_bitmap (n);
        xfree (*fbp);
        *fbp = NULL;
***************
*** 1006,1011 ****
--- 1061,1091 ----
    while (max_used_fringe_bitmap > MAX_STANDARD_FRINGE_BITMAPS
         && fringe_bitmaps[max_used_fringe_bitmap - 1] == NULL)
      max_used_fringe_bitmap--;
+ }
+ 
+ 
+ DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, 
Sdestroy_fringe_bitmap,
+        1, 1, 0,
+        doc: /* Destroy fringe bitmap BITMAP.
+ If BITMAP overrides a standard fringe bitmap, the original bitmap is 
restored.  */)
+   (bitmap)
+      Lisp_Object bitmap;
+ {
+   int n;
+ 
+   CHECK_SYMBOL (bitmap);
+   n = lookup_fringe_bitmap (bitmap);
+   if (!n)
+     return Qnil;
+ 
+   destroy_fringe_bitmap (n);
+ 
+   if (n >= MAX_STANDARD_FRINGE_BITMAPS)
+     {
+       Vfringe_bitmaps = Fdelq (bitmap, Vfringe_bitmaps);
+       /* It would be better to remove the fringe property.  */
+       Fput (bitmap, Qfringe, Qnil);
+     }
  
    return Qnil;
  }
***************
*** 1077,1085 ****
  
    if (!once_p)
      {
!       Fdestroy_fringe_bitmap (make_number (which));
  
!       if (rif->define_fringe_bitmap)
        rif->define_fringe_bitmap (which, fb->bits, fb->height, fb->width);
  
        fringe_bitmaps[which] = fb;
--- 1157,1165 ----
  
    if (!once_p)
      {
!       destroy_fringe_bitmap (which);
  
!       if (rif && rif->define_fringe_bitmap)
        rif->define_fringe_bitmap (which, fb->bits, fb->height, fb->width);
  
        fringe_bitmaps[which] = fb;
***************
*** 1090,1109 ****
  
  
  DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap,
!        1, 5, 0,
!        doc: /* Define a fringe bitmap from BITS of height HEIGHT and width 
WIDTH.
  BITS is either a string or a vector of integers.
  HEIGHT is height of bitmap.  If HEIGHT is nil, use length of BITS.
  WIDTH must be an integer between 1 and 16, or nil which defaults to 8.
! Optional fourth arg ALIGN may be one of `top', `center', or `bottom',
  indicating the positioning of the bitmap relative to the rows where it
  is used; the default is to center the bitmap.  Fourth arg may also be a
  list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap
  should be repeated.
! Optional fifth argument WHICH is bitmap number to redefine.
! Return new bitmap number, or nil of no more free bitmap slots.  */)
!   (bits, height, width, align, which)
!      Lisp_Object bits, height, width, align, which;
  {
    Lisp_Object len;
    int n, h, i, j;
--- 1170,1189 ----
  
  
  DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap,
!        2, 5, 0,
!        doc: /* Define fringe bitmap BITMAP from BITS of size HEIGHT x WIDTH.
! BITMAP is a symbol or string naming the new fringe bitmap.
  BITS is either a string or a vector of integers.
  HEIGHT is height of bitmap.  If HEIGHT is nil, use length of BITS.
  WIDTH must be an integer between 1 and 16, or nil which defaults to 8.
! Optional fifth arg ALIGN may be one of `top', `center', or `bottom',
  indicating the positioning of the bitmap relative to the rows where it
  is used; the default is to center the bitmap.  Fourth arg may also be a
  list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap
  should be repeated.
! If BITMAP already exists, the existing definition is replaced.  */)
!   (bitmap, bits, height, width, align)
!      Lisp_Object bitmap, bits, height, width, align;
  {
    Lisp_Object len;
    int n, h, i, j;
***************
*** 1111,1116 ****
--- 1191,1198 ----
    struct fringe_bitmap fb, *xfb;
    int fill1 = 0, fill2 = 0;
  
+   CHECK_SYMBOL (bitmap);
+ 
    if (!STRINGP (bits) && !VECTORP (bits))
      bits = wrong_type_argument (Qstringp, bits);
  
***************
*** 1162,1189 ****
    else if (!NILP (align) && !EQ (align, Qcenter))
      error ("Bad align argument");
  
!   if (NILP (which))
      {
!       if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS)
        n = max_used_fringe_bitmap++;
        else
        {
          for (n = MAX_STANDARD_FRINGE_BITMAPS;
!              n < MAX_FRINGE_BITMAPS;
               n++)
            if (fringe_bitmaps[n] == NULL)
              break;
!         if (n == MAX_FRINGE_BITMAPS)
!           return Qnil;
        }
!       which = make_number (n);
!     }
!   else
!     {
!       CHECK_NUMBER (which);
!       n = XINT (which);
!       if (n <= NO_FRINGE_BITMAP || n >= MAX_FRINGE_BITMAPS)
!       error ("Invalid fringe bitmap number");
      }
  
    fb.dynamic = 1;
--- 1244,1285 ----
    else if (!NILP (align) && !EQ (align, Qcenter))
      error ("Bad align argument");
  
!   n = lookup_fringe_bitmap (bitmap);
!   if (!n)
      {
!       if (max_used_fringe_bitmap < max_fringe_bitmaps)
        n = max_used_fringe_bitmap++;
        else
        {
          for (n = MAX_STANDARD_FRINGE_BITMAPS;
!              n < max_fringe_bitmaps;
               n++)
            if (fringe_bitmaps[n] == NULL)
              break;
! 
!         if (n == max_fringe_bitmaps)
!           {
!             if ((max_fringe_bitmaps + 20) > MAX_FRINGE_BITMAPS)
!               error ("No free fringe bitmap slots");
! 
!             i = max_fringe_bitmaps;
!             max_fringe_bitmaps += 20;
!             fringe_bitmaps
!               = ((struct fringe_bitmap **)
!                  xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof 
(struct fringe_bitmap *)));
!             fringe_faces
!               = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * 
sizeof (unsigned));
! 
!             for (; i < max_fringe_bitmaps; i++)
!               {
!                 fringe_bitmaps[i] = NULL;
!                 fringe_faces[i] = FRINGE_FACE_ID;
!               }
!           }
        }
! 
!       Vfringe_bitmaps = Fcons (bitmap, Vfringe_bitmaps);
!       Fput (bitmap, Qfringe, make_number (n));
      }
  
    fb.dynamic = 1;
***************
*** 1211,1231 ****
  
    init_fringe_bitmap (n, xfb, 0);
  
!   return which;
  }
  
  DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, 
Sset_fringe_bitmap_face,
         1, 2, 0,
!        doc: /* Set face for fringe bitmap FRINGE-ID to FACE.
  If FACE is nil, reset face to default fringe face.  */)
!   (fringe_id, face)
!      Lisp_Object fringe_id, face;
  {
    int face_id;
  
!   CHECK_NUMBER (fringe_id);
!   if (!valid_fringe_bitmap_id_p (XINT (fringe_id)))
!     error ("Invalid fringe id");
  
    if (!NILP (face))
      {
--- 1307,1329 ----
  
    init_fringe_bitmap (n, xfb, 0);
  
!   return bitmap;
  }
  
  DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, 
Sset_fringe_bitmap_face,
         1, 2, 0,
!        doc: /* Set face for fringe bitmap BITMAP to FACE.
  If FACE is nil, reset face to default fringe face.  */)
!   (bitmap, face)
!      Lisp_Object bitmap, face;
  {
+   int n;
    int face_id;
  
!   CHECK_SYMBOL (bitmap);
!   n = lookup_fringe_bitmap (bitmap);
!   if (!n)
!     error ("Undefined fringe bitmap");
  
    if (!NILP (face))
      {
***************
*** 1236,1242 ****
    else
      face_id = FRINGE_FACE_ID;
  
!   fringe_faces [XINT (fringe_id)] = face_id;
  
    return Qnil;
  }
--- 1334,1340 ----
    else
      face_id = FRINGE_FACE_ID;
  
!   fringe_faces[n] = face_id;
  
    return Qnil;
  }
***************
*** 1247,1253 ****
  If WINDOW is nil, use selected window.  If POS is nil, use value of point
  in that window.  Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT
  are the fringe bitmap numbers for the bitmaps in the left and right fringe,
! resp.  Return nil if POS is not visible in WINDOW.  */)
    (pos, window)
       Lisp_Object pos, window;
  {
--- 1345,1352 ----
  If WINDOW is nil, use selected window.  If POS is nil, use value of point
  in that window.  Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT
  are the fringe bitmap numbers for the bitmaps in the left and right fringe,
! resp.  If left or right fringe is empty, the corresponding element is nil.
! Return nil if POS is not visible in WINDOW.  */)
    (pos, window)
       Lisp_Object pos, window;
  {
***************
*** 1274,1281 ****
    row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
    row = row_containing_pos (w, textpos, row, NULL, 0);
    if (row)
!     return Fcons (make_number (row->left_fringe_bitmap),
!                 make_number (row->right_fringe_bitmap));
    else
      return Qnil;
  }
--- 1373,1380 ----
    row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
    row = row_containing_pos (w, textpos, row, NULL, 0);
    if (row)
!     return Fcons (get_fringe_bitmap_name (row->left_fringe_bitmap),
!                 get_fringe_bitmap_name (row->right_fringe_bitmap));
    else
      return Qnil;
  }
***************
*** 1288,1294 ****
  void
  syms_of_fringe ()
  {
- 
    defsubr (&Sdestroy_fringe_bitmap);
    defsubr (&Sdefine_fringe_bitmap);
    defsubr (&Sfringe_bitmaps_at_pos);
--- 1387,1392 ----
***************
*** 1303,1308 ****
--- 1401,1410 ----
  If nil, also continue lines which are exactly as wide as the window.  */);
    Voverflow_newline_into_fringe = Qt;
  
+   DEFVAR_LISP ("fringe-bitmaps", &Vfringe_bitmaps,
+     doc: /* List of fringe bitmap symbols.
+ You must (require 'fringe) to use fringe bitmap symbols in your programs." 
*/);
+   Vfringe_bitmaps = Qnil;
  }
  
  /* Initialize this module when Emacs starts.  */
***************
*** 1321,1329 ****
  {
    int i;
  
!   bzero (fringe_bitmaps, sizeof fringe_bitmaps);
!   for (i = 0; i < MAX_FRINGE_BITMAPS; i++)
!     fringe_faces[i] = FRINGE_FACE_ID;
  }
  
  #ifdef HAVE_NTGUI
--- 1423,1440 ----
  {
    int i;
  
!   max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
! 
!   fringe_bitmaps
!     = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct 
fringe_bitmap *));
!   fringe_faces
!     = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned));
! 
!   for (i = 0; i < max_fringe_bitmaps; i++)
!     {
!       fringe_bitmaps[i] = NULL;
!       fringe_faces[i] = FRINGE_FACE_ID;
!     }
  }
  
  #ifdef HAVE_NTGUI
***************
*** 1333,1338 ****
--- 1444,1452 ----
  {
    enum fringe_bitmap_type bt;
  
+   if (!rif)
+     return;
+ 
    for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++)
      {
        struct fringe_bitmap *fb = &standard_bitmaps[bt];
***************
*** 1346,1351 ****
--- 1460,1468 ----
    /* Destroy row bitmaps.  */
    int bt;
  
+   if (!rif)
+     return;
+ 
    for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++)
      rif->destroy_fringe_bitmap (bt);
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]