]> code.delx.au - gnu-emacs/commitdiff
Remove kludgey save and restore of IT->position for push_it.
authorEli Zaretskii <eliz@gnu.org>
Sat, 14 May 2011 14:05:36 +0000 (17:05 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 14 May 2011 14:05:36 +0000 (17:05 +0300)
 src/xdisp.c (push_it): Accept second argument POSITION, where pop_it
 should jump to continue iteration.

src/ChangeLog
src/xdisp.c

index b122f0612b2b2228b923993c6e24c550b4b99721..fdb98351672f48e29dba0f1ed92b3223223938d7 100644 (file)
@@ -2,6 +2,8 @@
 
        * xdisp.c (compute_display_string_pos): Non-trivial implementation.
        (compute_display_string_end): New function.
+       (push_it): Accept second argument POSITION, where pop_it should
+       jump to continue iteration.
 
        * dispextern.h (compute_display_string_end): Declare prototype.
 
index 508728d95f83ed21cc55b03efb3c8e2ecbb273f2..6ea6f92a3f7c5bfc500865a5f531ede6792be0cf 100644 (file)
@@ -812,7 +812,7 @@ static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int);
 static int try_cursor_movement (Lisp_Object, struct text_pos, int *);
 static int trailing_whitespace_p (EMACS_INT);
 static unsigned long int message_log_check_duplicate (EMACS_INT, EMACS_INT);
-static void push_it (struct it *);
+static void push_it (struct it *, struct text_pos *);
 static void pop_it (struct it *);
 static void sync_frame_with_window_matrix_rows (struct window *);
 static void select_frame_for_redisplay (Lisp_Object);
@@ -3938,7 +3938,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
 {
   Lisp_Object form;
   Lisp_Object location, value;
-  struct text_pos start_pos, save_pos;
+  struct text_pos start_pos;
   int valid_p;
 
   /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM.
@@ -4155,11 +4155,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
 
       /* Save current settings of IT so that we can restore them
         when we are finished with the glyph property value.  */
-
-      save_pos = it->position;
-      it->position = *position;
-      push_it (it);
-      it->position = save_pos;
+      push_it (it, position);
 
       it->area = TEXT_AREA;
       it->what = IT_IMAGE;
@@ -4234,10 +4230,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
     {
       /* Save current settings of IT so that we can restore them
         when we are finished with the glyph property value.  */
-      save_pos = it->position;
-      it->position = *position;
-      push_it (it);
-      it->position = save_pos;
+      push_it (it, position);
       it->from_overlay = overlay;
 
       if (NILP (location))
@@ -4911,7 +4904,7 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
       /* When called from handle_stop, there might be an empty display
          string loaded.  In that case, don't bother saving it.  */
       if (!STRINGP (it->string) || SCHARS (it->string))
-       push_it (it);
+       push_it (it, NULL);
 
       /* Set up IT to deliver display elements from the first overlay
         string.  */
@@ -4953,10 +4946,11 @@ get_overlay_strings (struct it *it, EMACS_INT charpos)
 /* Save current settings of IT on IT->stack.  Called, for example,
    before setting up IT for an overlay string, to be able to restore
    IT's settings to what they were after the overlay string has been
-   processed.  */
+   processed.  If POSITION is non-NULL, it is the position to save on
+   the stack instead of IT->position.  */
 
 static void
-push_it (struct it *it)
+push_it (struct it *it, struct text_pos *position)
 {
   struct iterator_stack_entry *p;
 
@@ -4983,7 +4977,7 @@ push_it (struct it *it)
       p->u.stretch.object = it->object;
       break;
     }
-  p->position = it->position;
+  p->position = position ? *position : it->position;
   p->current = it->current;
   p->end_charpos = it->end_charpos;
   p->string_nchars = it->string_nchars;
@@ -17157,7 +17151,7 @@ cursor_row_p (struct glyph_row *row)
 static int
 push_display_prop (struct it *it, Lisp_Object prop)
 {
-  push_it (it);
+  push_it (it, NULL);
 
   if (STRINGP (prop))
     {