all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Magne Ingebrigtsen <larsi@gnus.org>
Cc: 14616@debbugs.gnu.org
Subject: bug#14616: 24.3.50; Excessive cursor movement on non-X Emacs
Date: Fri, 02 Aug 2013 17:28:09 +0300	[thread overview]
Message-ID: <83a9l0yxom.fsf@gnu.org> (raw)
In-Reply-To: <m3y58kxl1s.fsf@stories.gnus.org>

> From: Lars Magne Ingebrigtsen <larsi@gnus.org>
> Cc: bug-gnu-emacs@gnu.org
> Date: Fri, 02 Aug 2013 15:46:23 +0200
> 
> While this is going on, I can't see anything visibly changing in Emacs.
> 
> Looking at the lines included below, I see lots of clear_to_end_of_line
> and cursor_to...  and write_glyphs...

clear_to_end_of_line is not the problem, because it actually does
nothing:

  #0  clear_end_of_line (f=0xb7fbe0, first_unused_hpos=80) at terminal.c:153

The last argument is 80, i.e. the position beyond the end of the line.
In this case, clear_end_of_line (more accurately, its TTY
implementation) returns immediately without writing anything to the
screen.

The real problem is the series of calls to write_glyphs, with ever
increasing numbers of screen lines (the vpos argument of
update_frame_line):

  #0  write_glyphs (f=0xb7fbe0, string=0x145e6f0, len=63) at terminal.c:163
  #1  0x0000000000415639 in update_frame_line (f=f@entry=0xb7fbe0, 
      vpos=vpos@entry=0) at dispnew.c:4816
  ...
  #0  write_glyphs (f=0xb7fbe0, string=0x145f5f0, len=80) at terminal.c:163
  #1  0x0000000000415639 in update_frame_line (f=f@entry=0xb7fbe0, 
      vpos=vpos@entry=1) at dispnew.c:4816
  ...
  #0  write_glyphs (f=0xb7fbe0, string=0x14604f0, len=66) at terminal.c:163
  #1  0x0000000000415639 in update_frame_line (f=f@entry=0xb7fbe0, 
      vpos=vpos@entry=2) at dispnew.c:4816

etc.  Can you throw together a test case that causes this part and
doesn't require to have Gnus set up, i.e. which I could try from
"emacs -Q"?

These calls come from line 4816 of dispnew.c, in this snippet:

  /* If display line has unknown contents, write the whole line.  */
  if (must_write_whole_line_p)
    {
      /* Ignore spaces at the end, if we can.  */
      if (!write_spaces_p)
	while (nlen > 0 && CHAR_GLYPH_SPACE_P (nbody[nlen - 1]))
	  --nlen;

      /* Write the contents of the desired line.  */
      if (nlen)
	{
          cursor_to (f, vpos, 0);
	  write_glyphs (f, nbody, nlen);  <<<<<<<<<<<<<<<<<<<<<
	}

The fact that must_write_whole_line_p is non-zero is the key: it means
that Emacs believes the screen lines in the 'current' glyph matrix are
invalid.  The question is: who and why invalidates them?  One way to
find out is to put a watchpoint on the enabled_p flag of some screen
line, and see which code changes it.  Something like this:

 (gdb) watch -l current_row->enabled_p
 (gdb) commands
   > bt 10
   > continue
   > end

You must set the watchpoint when you are in the above code snippet, so
begin by setting a breakpoint on the line marked above that calls
write_glyphs; when that breakpoint breaks, set the watchpoint as
above, and then delete or disable the breakpoint.  Then let Emacs do
what you did here, and see which code resets the enabled_p flags.

Also, I see that this is an optimized build.  Could you please try all
that in an unoptimized build, so that I could trust the backtraces and
the values of variables 100%?

Thanks.





  reply	other threads:[~2013-08-02 14:28 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14  8:00 bug#14616: 24.3.50; Excessive cursor movement on non-X Emacs Lars Magne Ingebrigtsen
2013-06-14  8:05 ` Lars Magne Ingebrigtsen
2013-06-23 17:27   ` Eli Zaretskii
2013-06-25 20:18     ` Lars Magne Ingebrigtsen
2013-06-26 16:32       ` Eli Zaretskii
2013-07-19 15:31         ` Lars Magne Ingebrigtsen
2013-07-19 18:46           ` Eli Zaretskii
2013-07-30 14:47             ` Lars Magne Ingebrigtsen
2013-07-30 16:44               ` Eli Zaretskii
2013-07-31 10:03                 ` Lars Magne Ingebrigtsen
2013-07-31 10:11                   ` Lars Magne Ingebrigtsen
2013-07-31 17:34                     ` Eli Zaretskii
2013-08-01 10:41                       ` Lars Magne Ingebrigtsen
2013-08-01 16:46                         ` Eli Zaretskii
2013-08-02 13:33                           ` Lars Magne Ingebrigtsen
2013-08-02 15:07                             ` Eli Zaretskii
2013-08-02 13:46                           ` Lars Magne Ingebrigtsen
2013-08-02 14:28                             ` Eli Zaretskii [this message]
2013-08-03 13:00                               ` Lars Magne Ingebrigtsen
2013-08-03 13:32                                 ` Eli Zaretskii
2013-08-05 18:22                                   ` Lars Magne Ingebrigtsen
2013-08-05 18:45                                     ` Eli Zaretskii
2013-08-05 19:10                                       ` Lars Magne Ingebrigtsen
2013-08-05 19:15                                         ` Lars Magne Ingebrigtsen
2013-08-05 19:21                                         ` Lars Magne Ingebrigtsen
2013-08-05 19:45                                           ` Eli Zaretskii
2013-08-05 19:53                                             ` Lars Magne Ingebrigtsen
2013-08-06 15:45                                               ` Eli Zaretskii
2013-08-05 19:40                                         ` Eli Zaretskii
2013-08-05 19:46                                           ` Lars Magne Ingebrigtsen
2013-08-05 19:51                                           ` Lars Magne Ingebrigtsen
2013-08-05 20:10                                             ` Eli Zaretskii
2013-08-05 20:20                                               ` Lars Magne Ingebrigtsen
2013-08-06 15:26                                                 ` Eli Zaretskii
2013-08-06 20:32                                                   ` Lars Magne Ingebrigtsen
2013-08-07 13:51                                                     ` Eli Zaretskii
2013-08-02 14:00                           ` Lars Magne Ingebrigtsen
2013-08-03  7:57                             ` Eli Zaretskii
2013-08-03 13:00                               ` Lars Magne Ingebrigtsen
2013-06-14  8:59 ` Eli Zaretskii
2013-06-18  5:22   ` lee
2013-06-18 15:57     ` Eli Zaretskii
2013-06-19  1:38       ` lee
2013-06-27 11:16         ` lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a9l0yxom.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=14616@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.