aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2011-05-14 17:05:36 +0300
committerEli Zaretskii2011-05-14 17:05:36 +0300
commit683a44f77c8c83febe1ab7ebe7fc32d26fc71bcd (patch)
treeef3b872220e0ed8690dfe492e7e6f9c64d039ef6
parent7b60010279ef966ed79de968c918e3e9f4b42e3b (diff)
downloademacs-683a44f77c8c83febe1ab7ebe7fc32d26fc71bcd.tar.gz
emacs-683a44f77c8c83febe1ab7ebe7fc32d26fc71bcd.zip
Remove kludgey save and restore of IT->position for push_it.
src/xdisp.c (push_it): Accept second argument POSITION, where pop_it should jump to continue iteration.
-rw-r--r--src/ChangeLog2
-rw-r--r--src/xdisp.c26
2 files changed, 12 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b122f0612b2..fdb98351672 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -2,6 +2,8 @@
2 2
3 * xdisp.c (compute_display_string_pos): Non-trivial implementation. 3 * xdisp.c (compute_display_string_pos): Non-trivial implementation.
4 (compute_display_string_end): New function. 4 (compute_display_string_end): New function.
5 (push_it): Accept second argument POSITION, where pop_it should
6 jump to continue iteration.
5 7
6 * dispextern.h (compute_display_string_end): Declare prototype. 8 * dispextern.h (compute_display_string_end): Declare prototype.
7 9
diff --git a/src/xdisp.c b/src/xdisp.c
index 508728d95f8..6ea6f92a3f7 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -812,7 +812,7 @@ static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int);
812static int try_cursor_movement (Lisp_Object, struct text_pos, int *); 812static int try_cursor_movement (Lisp_Object, struct text_pos, int *);
813static int trailing_whitespace_p (EMACS_INT); 813static int trailing_whitespace_p (EMACS_INT);
814static unsigned long int message_log_check_duplicate (EMACS_INT, EMACS_INT); 814static unsigned long int message_log_check_duplicate (EMACS_INT, EMACS_INT);
815static void push_it (struct it *); 815static void push_it (struct it *, struct text_pos *);
816static void pop_it (struct it *); 816static void pop_it (struct it *);
817static void sync_frame_with_window_matrix_rows (struct window *); 817static void sync_frame_with_window_matrix_rows (struct window *);
818static void select_frame_for_redisplay (Lisp_Object); 818static void select_frame_for_redisplay (Lisp_Object);
@@ -3938,7 +3938,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
3938{ 3938{
3939 Lisp_Object form; 3939 Lisp_Object form;
3940 Lisp_Object location, value; 3940 Lisp_Object location, value;
3941 struct text_pos start_pos, save_pos; 3941 struct text_pos start_pos;
3942 int valid_p; 3942 int valid_p;
3943 3943
3944 /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. 3944 /* 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,
4155 4155
4156 /* Save current settings of IT so that we can restore them 4156 /* Save current settings of IT so that we can restore them
4157 when we are finished with the glyph property value. */ 4157 when we are finished with the glyph property value. */
4158 4158 push_it (it, position);
4159 save_pos = it->position;
4160 it->position = *position;
4161 push_it (it);
4162 it->position = save_pos;
4163 4159
4164 it->area = TEXT_AREA; 4160 it->area = TEXT_AREA;
4165 it->what = IT_IMAGE; 4161 it->what = IT_IMAGE;
@@ -4234,10 +4230,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
4234 { 4230 {
4235 /* Save current settings of IT so that we can restore them 4231 /* Save current settings of IT so that we can restore them
4236 when we are finished with the glyph property value. */ 4232 when we are finished with the glyph property value. */
4237 save_pos = it->position; 4233 push_it (it, position);
4238 it->position = *position;
4239 push_it (it);
4240 it->position = save_pos;
4241 it->from_overlay = overlay; 4234 it->from_overlay = overlay;
4242 4235
4243 if (NILP (location)) 4236 if (NILP (location))
@@ -4911,7 +4904,7 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
4911 /* When called from handle_stop, there might be an empty display 4904 /* When called from handle_stop, there might be an empty display
4912 string loaded. In that case, don't bother saving it. */ 4905 string loaded. In that case, don't bother saving it. */
4913 if (!STRINGP (it->string) || SCHARS (it->string)) 4906 if (!STRINGP (it->string) || SCHARS (it->string))
4914 push_it (it); 4907 push_it (it, NULL);
4915 4908
4916 /* Set up IT to deliver display elements from the first overlay 4909 /* Set up IT to deliver display elements from the first overlay
4917 string. */ 4910 string. */
@@ -4953,10 +4946,11 @@ get_overlay_strings (struct it *it, EMACS_INT charpos)
4953/* Save current settings of IT on IT->stack. Called, for example, 4946/* Save current settings of IT on IT->stack. Called, for example,
4954 before setting up IT for an overlay string, to be able to restore 4947 before setting up IT for an overlay string, to be able to restore
4955 IT's settings to what they were after the overlay string has been 4948 IT's settings to what they were after the overlay string has been
4956 processed. */ 4949 processed. If POSITION is non-NULL, it is the position to save on
4950 the stack instead of IT->position. */
4957 4951
4958static void 4952static void
4959push_it (struct it *it) 4953push_it (struct it *it, struct text_pos *position)
4960{ 4954{
4961 struct iterator_stack_entry *p; 4955 struct iterator_stack_entry *p;
4962 4956
@@ -4983,7 +4977,7 @@ push_it (struct it *it)
4983 p->u.stretch.object = it->object; 4977 p->u.stretch.object = it->object;
4984 break; 4978 break;
4985 } 4979 }
4986 p->position = it->position; 4980 p->position = position ? *position : it->position;
4987 p->current = it->current; 4981 p->current = it->current;
4988 p->end_charpos = it->end_charpos; 4982 p->end_charpos = it->end_charpos;
4989 p->string_nchars = it->string_nchars; 4983 p->string_nchars = it->string_nchars;
@@ -17157,7 +17151,7 @@ cursor_row_p (struct glyph_row *row)
17157static int 17151static int
17158push_display_prop (struct it *it, Lisp_Object prop) 17152push_display_prop (struct it *it, Lisp_Object prop)
17159{ 17153{
17160 push_it (it); 17154 push_it (it, NULL);
17161 17155
17162 if (STRINGP (prop)) 17156 if (STRINGP (prop))
17163 { 17157 {