emacs-devel
[Top][All Lists]
Advanced

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

Re: Mysterious redisplay problem and a trap in xdisp.c


From: Kim F. Storm
Subject: Re: Mysterious redisplay problem and a trap in xdisp.c
Date: 09 Feb 2002 21:59:48 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

Hi Gerd,
Eli suggested I forwarded this to you.
There seem to be a problem with make_gap_smaller.

Since the posting below, I have tried the following steps (after starting emacs 
-q):

1) Setting gc-cons-threshold to 100 -> problem does not occur
2) M-x column-number-mode  -> problem occurs
3) M-x tool-bar-mode -> problem goes away

"Kim F. Storm" <address@hidden> writes:

> I was trying to track down a redisplay problem I've seen lately with
> the CVS emacs:
> 
> While typing in some text in a buffer, emacs suddenly decides to
> insert a new line instead of the character I typed.  But if I do C-l,
> there is only one line, and the character I typed magically reappears.
> 
> I've only seen this with column-number-mode turned on, so the rest of
> you may not have noticed.
> 
> When this happens, the column number continues to increment relative
> to the original line start (and the bogus line wrap), but continuation
> glyphs are shown "correctly" in the fringe when the second line
> reaches the right margin and wraps into the third line.
> 

I made a small change to redisplay_internal so that instead of testing
on w->column_number_displayed, it just sets w->update_mode_line
unconditionally, i.e.

#if 0
  /* If %c is in the mode line, update it if needed.  */
  if (!NILP (w->column_number_displayed)
      /* This alternative quickly identifies a common case
         where no change is needed.  */
      && !(PT == XFASTINT (w->last_point)
           && XFASTINT (w->last_modified) >= MODIFF
           && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
      && XFASTINT (w->column_number_displayed) != current_column ())
#endif
    w->update_mode_line = Qt; 

This makes the problem appear without enabling column-number-mode.

In addition, I set the modeline-format to "-" and the problem still
appears, so it is not related to the mode-line as such. 

However, if I turn off the tool-bar (M-x tool-bar-mode), the
problem seems to disappear.


I have now tracked the problem down to the following change:

2001-12-11  Andrew Innes  <address@hidden>

        * insdel.c (make_gap) [DOUG_LEA_MALLOC]: Call make_gap_smaller if
        arg is negative.

If I comment out the call to make_gap_smaller in make_gap, the problem
goes away!

I placed a breakpoint on entry to make_gap_smaller, and except for a
few calls during startup, it seems that every time it is called
the false newline problem is seen.

But it is never(?) called when I turn off the tool-bar (except if I
make an explicit M-x garbage-collect) But maybe that is because using
the tool-bar causes the automatic garbage collection to happen more
frequently.


Here are some examples of contents of current_buffer->text on entry
and exit from that function when the problem is seen:


Breakpoint 3, make_gap_smaller (nbytes_removed=1728) at insdel.c:587
587       if (GAP_SIZE - nbytes_removed < 20)
(gdb) p *current_buffer->text
$19 = {
  beg = 0x84f4ca0 ";; This buffer is for notes you don't want to save, and for 
Lis
p evaluation.\n;; If you want to create a file, visit that file with C-x 
C-f,\n;;then enter the text in that file's own buffer.\nnnnnnnnnnn"...,
  gpt = 208,
  z = 1044,
  gpt_byte = 208,
  z_byte = 1044,
  gap_size = 1832,
  modiff = 1088,
  save_modiff = 0,
  overlay_modiff = 2,
  beg_unchanged = 207,
  end_unchanged = 836,
  unchanged_modified = 1088,
  overlay_unchanged_modified = 2,
  intervals = 0x0,
  markers = 674307420
}
(gdb) fin
Run till exit from #0  make_gap_smaller (nbytes_removed=1728) at insdel.c:587
make_gap (nbytes_added=-1728) at insdel.c:639
639     }
(gdb) p *current_buffer->text
$20 = {
  beg = 0x84f4ca0 ";; This buffer is for notes you don't want to save, and for 
Lis
p evaluation.\n;; If you want to create a file, visit that file with C-x 
C-f,\n;;then enter the text in that file's own buffer.\nnnnnnnnnnn"...,
  gpt = 208,
  z = 1044,
  gpt_byte = 208,
  z_byte = 1044,
  gap_size = 104,
  modiff = 1088,
  beg_unchanged = 1147,
  end_unchanged = 836,
  unchanged_modified = 1088,
  overlay_unchanged_modified = 2,
  intervals = 0x0,
  markers = 674307420
}
(gdb)

Breakpoint 3, make_gap_smaller (nbytes_removed=1748) at insdel.c:587
587       if (GAP_SIZE - nbytes_removed < 20)
(gdb) p *current_buffer->text
$21 = {
  beg = 0x84d0870 ";; This buffer is for notes you don't want to save, and for 
Lisp evaluation.\n;; If you want to create a file, visit that file with C-x 
C-f,\n;;
then enter the text in that file's own buffer.\nnnnnnnnnnn"...,
  gpt = 1170,
  z = 1274,
  gpt_byte = 1170,
  z_byte = 1274,
  gap_size = 1875,
  modiff = 1318,
  save_modiff = 0,
  overlay_modiff = 2,
  beg_unchanged = 1169,
  end_unchanged = 104,
  unchanged_modified = 1318,
  overlay_unchanged_modified = 2,
  intervals = 0x0,
  markers = 674306720
}
(gdb) fin
Run till exit from #0  make_gap_smaller (nbytes_removed=1748) at insdel.c:587
make_gap (nbytes_added=-1748) at insdel.c:639
639     }
(gdb) p *current_buffer->text
$22 = {
  beg = 0x84d0870 ";; This buffer is for notes you don't want to save, and for 
Lisp evaluation.\n;; If you want to create a file, visit that file with C-x 
C-f,\n;;
then enter the text in that file's own buffer.\nnnnnnnnnnn"...,
  gpt = 1170,
  z = 1274,
  gpt_byte = 1170,
  z_byte = 1274,
  gap_size = 127,
  modiff = 1318,
  save_modiff = 0,
  overlay_modiff = 2,
  beg_unchanged = 1400,
  end_unchanged = 104,
  unchanged_modified = 1318,
  overlay_unchanged_modified = 2,
  intervals = 0x0,
  markers = 674306720
}
(gdb)  


If I try an explicit garbage collection, the following behaviour
is seen:
 
Breakpoint 3, make_gap_smaller (nbytes_removed=983) at insdel.c:587
587       if (GAP_SIZE - nbytes_removed < 20)
(gdb) p *current_buffer->text
$26 = {
  beg = 0x84e44c0 ";; This buffer is for notes you don't want to save, and for 
Lisp evaluation.\n;; If you want to create a file, visit that file with C-x 
C-f,\n;;
then enter the text in that file's own buffer.\nnnnnnnnnnn"...,
  gpt = 1344,
  z = 4019,
  gpt_byte = 1344,
  z_byte = 4019,
  gap_size = 1384,
  modiff = 4063,
  save_modiff = 0,
  overlay_modiff = 6,
  beg_unchanged = 1343,
  end_unchanged = 2675,
  unchanged_modified = 4063,
  overlay_unchanged_modified = 6,
  intervals = 0x0,
  markers = 675045032
}
(gdb) fin
Run till exit from #0  make_gap_smaller (nbytes_removed=983) at insdel.c:587
make_gap (nbytes_added=-983) at insdel.c:639
639     }
(gdb) p *current_buffer->text
$27 = {
  beg = 0x84e44c0 ";; This buffer is for notes you don't want to save, and for 
Lisp evaluation.\n;; If you want to create a file, visit that file with C-x 
C-f,\n;;
then enter the text in that file's own buffer.\nnnnnnnnnnn"...,
  gpt = 1344,
  z = 4019,
  gpt_byte = 1344,
  z_byte = 4019,
  gap_size = 401,
  modiff = 4063,
  save_modiff = 0,
  overlay_modiff = 6,
  beg_unchanged = 4419,
  end_unchanged = 2675,
  unchanged_modified = 4063,
  overlay_unchanged_modified = 6,
  intervals = 0x0,
  markers = 675045032
}
(gdb)          


 
Breakpoint 3, make_gap_smaller (nbytes_removed=1322) at insdel.c:587
587       if (GAP_SIZE - nbytes_removed < 20)
(gdb) p *current_buffer->text
$29 = {
  beg = 0x84b78d8 ";; This buffer is for notes you don't want to save, and for 
Lisp evaluation.\n;; If you want to create a file, visit that file with C-x 
C-f,\n;;
then enter the text in that file's own buffer.\nnnnnnnnnnn"...,
  gpt = 887,
  z = 4636,
  gpt_byte = 887,
  z_byte = 4636,
  gap_size = 1785,
  modiff = 4680,
  save_modiff = 0,
  overlay_modiff = 6,
  beg_unchanged = 886,
  end_unchanged = 3749,
  unchanged_modified = 4680,
  overlay_unchanged_modified = 6,
  intervals = 0x0,
  markers = 675044292
}
(gdb) fin
Run till exit from #0  make_gap_smaller (nbytes_removed=1322) at insdel.c:587
make_gap (nbytes_added=-1322) at insdel.c:639
639     }
(gdb) p *current_buffer->text
$30 = {
  beg = 0x84b78d8 ";; This buffer is for notes you don't want to save, and for 
Lisp evaluation.\n;; If you want to create a file, visit that file with C-x 
C-f,\n;;
then enter the text in that file's own buffer.\nnnnnnnnnnn"...,
  gpt = 887,
  z = 4636,
  gpt_byte = 887,
  z_byte = 4636,
  gap_size = 463,
  modiff = 4680,
  save_modiff = 0,
  overlay_modiff = 6,
  beg_unchanged = 5098,
  end_unchanged = 3749,
  unchanged_modified = 4680,
  overlay_unchanged_modified = 6,
  intervals = 0x0,
  markers = 675044292
}
(gdb) 


I have tried hard to understand what's going on, but maybe someone
else is able to see what might be wrong here...

-- 
Kim F. Storm <address@hidden> http://www.cua.dk




reply via email to

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