aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2001-10-12 22:15:07 +0000
committerStefan Monnier2001-10-12 22:15:07 +0000
commit3ebf0ea9d512eae828428d07be4ae47e0ead6699 (patch)
tree499650de110595caad158b102289a7081d3fd794
parent0d74b0068628778a8c52f2f21bf602444b7520b7 (diff)
downloademacs-3ebf0ea9d512eae828428d07be4ae47e0ead6699.tar.gz
emacs-3ebf0ea9d512eae828428d07be4ae47e0ead6699.zip
(init_iterator): Be more strict with bytepos and charspos.
(DOLIST, LOOP_PROPVAL): New macros. (invisible_p, invisible_ellipsis_p): Use them. (invisible_noellipsis_p): New function. (syms_of_xdisp): Use empty_string.
-rw-r--r--src/xdisp.c130
1 files changed, 65 insertions, 65 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index f1006578c5a..7c75ea2bc02 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -710,8 +710,6 @@ static int try_scrolling P_ ((Lisp_Object, int, int, int, int));
710static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *)); 710static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
711static int trailing_whitespace_p P_ ((int)); 711static int trailing_whitespace_p P_ ((int));
712static int message_log_check_duplicate P_ ((int, int, int, int)); 712static int message_log_check_duplicate P_ ((int, int, int, int));
713int invisible_p P_ ((Lisp_Object, Lisp_Object));
714int invisible_ellipsis_p P_ ((Lisp_Object, Lisp_Object));
715static void push_it P_ ((struct it *)); 713static void push_it P_ ((struct it *));
716static void pop_it P_ ((struct it *)); 714static void pop_it P_ ((struct it *));
717static void sync_frame_with_window_matrix_rows P_ ((struct window *)); 715static void sync_frame_with_window_matrix_rows P_ ((struct window *));
@@ -1429,7 +1427,7 @@ check_window_end (w)
1429 at character position CHARPOS. CHARPOS < 0 means that no buffer 1427 at character position CHARPOS. CHARPOS < 0 means that no buffer
1430 position is specified which is useful when the iterator is assigned 1428 position is specified which is useful when the iterator is assigned
1431 a position later. BYTEPOS is the byte position corresponding to 1429 a position later. BYTEPOS is the byte position corresponding to
1432 CHARPOS. BYTEPOS <= 0 means compute it from CHARPOS. 1430 CHARPOS. BYTEPOS < 0 means compute it from CHARPOS.
1433 1431
1434 If ROW is not null, calls to produce_glyphs with IT as parameter 1432 If ROW is not null, calls to produce_glyphs with IT as parameter
1435 will produce glyphs in that row. 1433 will produce glyphs in that row.
@@ -1535,7 +1533,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
1535 1533
1536 /* Non-zero if we should highlight the region. */ 1534 /* Non-zero if we should highlight the region. */
1537 highlight_region_p 1535 highlight_region_p
1538 = (!NILP (Vtransient_mark_mode) 1536 = (!NILP (Vtransient_mark_mode)
1539 && !NILP (current_buffer->mark_active) 1537 && !NILP (current_buffer->mark_active)
1540 && XMARKER (current_buffer->mark)->buffer != 0); 1538 && XMARKER (current_buffer->mark)->buffer != 0);
1541 1539
@@ -1672,14 +1670,14 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
1672 1670
1673 /* If a buffer position was specified, set the iterator there, 1671 /* If a buffer position was specified, set the iterator there,
1674 getting overlays and face properties from that position. */ 1672 getting overlays and face properties from that position. */
1675 if (charpos > 0) 1673 if (charpos >= BUF_BEG (current_buffer))
1676 { 1674 {
1677 it->end_charpos = ZV; 1675 it->end_charpos = ZV;
1678 it->face_id = -1; 1676 it->face_id = -1;
1679 IT_CHARPOS (*it) = charpos; 1677 IT_CHARPOS (*it) = charpos;
1680 1678
1681 /* Compute byte position if not specified. */ 1679 /* Compute byte position if not specified. */
1682 if (bytepos <= 0) 1680 if (bytepos < charpos)
1683 IT_BYTEPOS (*it) = CHAR_TO_BYTE (charpos); 1681 IT_BYTEPOS (*it) = CHAR_TO_BYTE (charpos);
1684 else 1682 else
1685 IT_BYTEPOS (*it) = bytepos; 1683 IT_BYTEPOS (*it) = bytepos;
@@ -7991,6 +7989,7 @@ hscroll_window_tree (window)
7991 &text_area_width, &text_area_height); 7989 &text_area_width, &text_area_height);
7992 7990
7993 /* Scroll when cursor is inside this scroll margin. */ 7991 /* Scroll when cursor is inside this scroll margin. */
7992 /* Shouldn't we export this `5' for customization ? -stef */
7994 hscroll_margin = 5 * CANON_X_UNIT (XFRAME (w->frame)); 7993 hscroll_margin = 5 * CANON_X_UNIT (XFRAME (w->frame));
7995 7994
7996 if ((XFASTINT (w->hscroll) 7995 if ((XFASTINT (w->hscroll)
@@ -14501,6 +14500,36 @@ display_string (string, lisp_string, face_string, face_string_pos,
14501 14500
14502 14501
14503 14502
14503#define DOLIST(var, list, code) \
14504 { \
14505 register Lisp_Object tail; \
14506 for (tail = list; CONSP (tail); tail = XCDR (tail)) \
14507 { \
14508 var = XCAR (tail); \
14509 code; \
14510 } \
14511 }
14512
14513/* Loop through the properties in PROPVAL and call CODE for each.
14514 CODE can access the current element in `propelt'. */
14515
14516#define LOOP_PROPVAL(var, propval, code) \
14517 { \
14518 var = (propval); \
14519 code; \
14520 \
14521 if (CONSP (propval)) \
14522 { \
14523 register Lisp_Object tail; \
14524 for (tail = propval; CONSP (tail); tail = XCDR (tail)) \
14525 { \
14526 var = XCAR (tail); \
14527 code; \
14528 } \
14529 } \
14530 return 0; \
14531 }
14532
14504/* This is like a combination of memq and assq. Return 1 if PROPVAL 14533/* This is like a combination of memq and assq. Return 1 if PROPVAL
14505 appears as an element of LIST or as the car of an element of LIST. 14534 appears as an element of LIST or as the car of an element of LIST.
14506 If PROPVAL is a list, compare each element against LIST in that 14535 If PROPVAL is a list, compare each element against LIST in that
@@ -14512,37 +14541,13 @@ invisible_p (propval, list)
14512 register Lisp_Object propval; 14541 register Lisp_Object propval;
14513 Lisp_Object list; 14542 Lisp_Object list;
14514{ 14543{
14515 register Lisp_Object tail, proptail; 14544 register Lisp_Object propelt, tem;
14516 14545 LOOP_PROPVAL (propelt, propval,
14517 for (tail = list; CONSP (tail); tail = XCDR (tail)) 14546 DOLIST (tem, list,
14518 { 14547 if (EQ (propelt, tem))
14519 register Lisp_Object tem; 14548 return 1;
14520 tem = XCAR (tail); 14549 if (CONSP (tem) && EQ (propelt, XCAR (tem)))
14521 if (EQ (propval, tem)) 14550 return 1;));
14522 return 1;
14523 if (CONSP (tem) && EQ (propval, XCAR (tem)))
14524 return 1;
14525 }
14526
14527 if (CONSP (propval))
14528 {
14529 for (proptail = propval; CONSP (proptail); proptail = XCDR (proptail))
14530 {
14531 Lisp_Object propelt;
14532 propelt = XCAR (proptail);
14533 for (tail = list; CONSP (tail); tail = XCDR (tail))
14534 {
14535 register Lisp_Object tem;
14536 tem = XCAR (tail);
14537 if (EQ (propelt, tem))
14538 return 1;
14539 if (CONSP (tem) && EQ (propelt, XCAR (tem)))
14540 return 1;
14541 }
14542 }
14543 }
14544
14545 return 0;
14546} 14551}
14547 14552
14548 14553
@@ -14557,31 +14562,27 @@ invisible_ellipsis_p (propval, list)
14557 register Lisp_Object propval; 14562 register Lisp_Object propval;
14558 Lisp_Object list; 14563 Lisp_Object list;
14559{ 14564{
14560 register Lisp_Object tail, proptail; 14565 register Lisp_Object propelt, tem;
14561 14566 LOOP_PROPVAL (propelt, propval,
14562 for (tail = list; CONSP (tail); tail = XCDR (tail)) 14567 DOLIST (tem, list,
14563 { 14568 if (CONSP (tem) && EQ (propelt, XCAR (tem)))
14564 register Lisp_Object tem; 14569 return !NILP (XCDR (tem))));
14565 tem = XCAR (tail); 14570}
14566 if (CONSP (tem) && EQ (propval, XCAR (tem))) 14571
14567 return ! NILP (XCDR (tem)); 14572/* As above but for "completely" invisible (no ellipsis). */
14568 } 14573
14569 14574int
14570 if (CONSP (propval)) 14575invisible_noellipsis_p (propval, list)
14571 for (proptail = propval; CONSP (proptail); proptail = XCDR (proptail)) 14576 register Lisp_Object propval;
14572 { 14577 Lisp_Object list;
14573 Lisp_Object propelt; 14578{
14574 propelt = XCAR (proptail); 14579 register Lisp_Object propelt, tem;
14575 for (tail = list; CONSP (tail); tail = XCDR (tail)) 14580 LOOP_PROPVAL (propelt, propval,
14576 { 14581 DOLIST (tem, list,
14577 register Lisp_Object tem; 14582 if (EQ (propelt, tem))
14578 tem = XCAR (tail); 14583 return 1;
14579 if (CONSP (tem) && EQ (propelt, XCAR (tem))) 14584 if (CONSP (tem) && EQ (propelt, XCAR (tem)))
14580 return ! NILP (XCDR (tem)); 14585 return NILP (XCDR (tem))));
14581 }
14582 }
14583
14584 return 0;
14585} 14586}
14586 14587
14587 14588
@@ -14801,7 +14802,7 @@ and is used only on frames for which no explicit name has been set\n\
14801 = Vframe_title_format 14802 = Vframe_title_format
14802 = Fcons (intern ("multiple-frames"), 14803 = Fcons (intern ("multiple-frames"),
14803 Fcons (build_string ("%b"), 14804 Fcons (build_string ("%b"),
14804 Fcons (Fcons (build_string (""), 14805 Fcons (Fcons (empty_string,
14805 Fcons (intern ("invocation-name"), 14806 Fcons (intern ("invocation-name"),
14806 Fcons (build_string ("@"), 14807 Fcons (build_string ("@"),
14807 Fcons (intern ("system-name"), 14808 Fcons (intern ("system-name"),
@@ -14856,8 +14857,7 @@ vertical margin.");
14856 "List of functions to call to fontify regions of text.\n\ 14857 "List of functions to call to fontify regions of text.\n\
14857Each function is called with one argument POS. Functions must\n\ 14858Each function is called with one argument POS. Functions must\n\
14858fontify a region starting at POS in the current buffer, and give\n\ 14859fontify a region starting at POS in the current buffer, and give\n\
14859fontified regions the property `fontified'.\n\ 14860fontified regions the property `fontified'.");
14860This variable automatically becomes buffer-local when set.");
14861 Vfontification_functions = Qnil; 14861 Vfontification_functions = Qnil;
14862 Fmake_variable_buffer_local (Qfontification_functions); 14862 Fmake_variable_buffer_local (Qfontification_functions);
14863 14863