+static int
+get_logical_cursor_bitmap (w, cursor)
+ struct window *w;
+ Lisp_Object cursor;
+{
+ Lisp_Object cmap, bm = Qnil;
+
+ if ((cmap = XBUFFER (w->buffer)->fringe_cursor_alist), !NILP (cmap))
+ {
+ bm = Fassq (cursor, cmap);
+ if (CONSP (bm))
+ {
+ if ((bm = XCDR (bm)), NILP (bm))
+ return NO_FRINGE_BITMAP;
+ return lookup_fringe_bitmap (bm);
+ }
+ }
+ if (EQ (cmap, buffer_defaults.fringe_cursor_alist))
+ return NO_FRINGE_BITMAP;
+ bm = Fassq (cursor, buffer_defaults.fringe_cursor_alist);
+ if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm)))
+ return NO_FRINGE_BITMAP;
+ return lookup_fringe_bitmap (bm);
+}
+
+static int
+get_logical_fringe_bitmap (w, bitmap, right_p, partial_p)
+ struct window *w;
+ Lisp_Object bitmap;
+ int right_p, partial_p;
+{
+ Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm;
+ int ln1 = 0, ln2 = 0;
+ int ix1 = right_p;
+ int ix2 = ix1 + (partial_p ? 2 : 0);
+
+ /* Lookup in buffer-local fringe-indicator-alist before global alist.
+
+ Elements are:
+ BITMAP -- use for all
+ (L R) -- use for left right (whether partial or not)
+ (L R PL PR) -- use for left rigth partial-left partial-right
+ If any value in local binding is not present or t, use global value.
+
+ If partial, lookup partial bitmap in default value if not found here.
+ If not partial, or no partial spec is present, use non-partial bitmap. */
+
+ if ((cmap = XBUFFER (w->buffer)->fringe_indicator_alist), !NILP (cmap))
+ {
+ bm1 = Fassq (bitmap, cmap);
+ if (CONSP (bm1))
+ {
+ if ((bm1 = XCDR (bm1)), NILP (bm1))
+ return NO_FRINGE_BITMAP;
+ if (CONSP (bm1))
+ {
+ ln1 = XINT (Flength (bm1));
+ if (partial_p)
+ {
+ if (ln1 > ix2)
+ {
+ bm = Fnth (make_number (ix2), bm1);
+ if (!EQ (bm, Qt))
+ goto found;
+ }
+ }
+ else
+ {
+ if (ln1 > ix1)
+ {
+ bm = Fnth (make_number (ix1), bm1);
+ if (!EQ (bm, Qt))
+ goto found;
+ }
+ }
+ }
+ else if ((bm = bm1, !EQ (bm, Qt)))
+ goto found;
+ }
+ }
+
+ if (!EQ (cmap, buffer_defaults.fringe_indicator_alist)
+ && !NILP (buffer_defaults.fringe_indicator_alist))
+ {
+ bm2 = Fassq (bitmap, buffer_defaults.fringe_indicator_alist);
+ if (CONSP (bm2))
+ {
+ if ((bm2 = XCDR (bm2)), !NILP (bm2))
+ {
+ if (CONSP (bm2))
+ {
+ ln2 = XINT (Flength (bm2));
+ if (partial_p)
+ {
+ if (ln2 > ix2)
+ {
+ bm = Fnth (make_number (ix2), bm2);
+ if (!EQ (bm, Qt))
+ goto found;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (ln1 > ix1)
+ {
+ bm = Fnth (make_number (ix1), bm1);
+ if (!EQ (bm, Qt))
+ goto found;
+ }
+
+ if (ln2 > ix1)
+ {
+ bm = Fnth (make_number (ix1), bm2);
+ if (!EQ (bm, Qt))
+ goto found;
+ return NO_FRINGE_BITMAP;
+ }
+ else if ((bm = bm2, NILP (bm)))
+ return NO_FRINGE_BITMAP;
+
+ found:
+ return lookup_fringe_bitmap (bm);
+}
+
+