From mboxrd@z Thu Jan 1 00:00:00 1970 Path: quimby.gnus.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Mysterious redisplay problem and a trap in xdisp.c Date: 09 Feb 2002 21:59:48 +0100 Message-ID: <5xadui5q2j.fsf@kfs2.cua.dk> NNTP-Posting-Host: quimby2.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: quimby2.netfonds.no 1013288979 30062 195.204.10.66 (9 Feb 2002 21:09:39 GMT) X-Complaints-To: usenet@quimby2.netfonds.no NNTP-Posting-Date: 9 Feb 2002 21:09:39 GMT Cc: emacs-devel@gnu.org Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby2.netfonds.no with esmtp (Exim 3.12 #1 (Debian)) id 16Zekc-0007om-00 for ; Sat, 09 Feb 2002 22:09:39 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.33 #1 (Debian)) id 16ZebP-0001rW-00; Sat, 09 Feb 2002 16:00:07 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by fencepost.gnu.org with smtp (Exim 3.33 #1 (Debian)) id 16ZeZw-0001nt-00; Sat, 09 Feb 2002 15:58:36 -0500 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id 42A817C035; Sat, 9 Feb 2002 20:58:34 +0000 (GMT) Original-To: gerd@gnu.org Original-Lines: 272 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: quimby.gnus.org gmane.emacs.devel:927 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:927 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" 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 * 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 http://www.cua.dk _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://mail.gnu.org/mailman/listinfo/emacs-devel