From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry OReilly Newsgroups: gmane.emacs.bugs Subject: bug#15045: Point jumps inappropriately around time of Semantic lexing Date: Thu, 8 Aug 2013 13:07:01 -0400 Message-ID: References: <87pptptk9n.fsf@engster.org> <831u65uvzk.fsf@gnu.org> <83zjssucnc.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1375981703 32672 80.91.229.3 (8 Aug 2013 17:08:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Aug 2013 17:08:23 +0000 (UTC) Cc: 15045@debbugs.gnu.org, deng@randomsample.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 08 19:08:24 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V7ThH-00069y-V2 for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Aug 2013 19:08:24 +0200 Original-Received: from localhost ([::1]:48507 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7ThH-0000tA-G7 for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Aug 2013 13:08:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7Th2-0000Wr-Vy for bug-gnu-emacs@gnu.org; Thu, 08 Aug 2013 13:08:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7Tgx-0002R6-0H for bug-gnu-emacs@gnu.org; Thu, 08 Aug 2013 13:08:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7Tgw-0002R2-UK for bug-gnu-emacs@gnu.org; Thu, 08 Aug 2013 13:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V7Tgw-0001YO-Nx for bug-gnu-emacs@gnu.org; Thu, 08 Aug 2013 13:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Barry OReilly Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Aug 2013 17:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15045 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15045-submit@debbugs.gnu.org id=B15045.13759816305733 (code B ref 15045); Thu, 08 Aug 2013 17:08:02 +0000 Original-Received: (at 15045) by debbugs.gnu.org; 8 Aug 2013 17:07:10 +0000 Original-Received: from localhost ([127.0.0.1]:47702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V7Tg5-0001UN-JW for submit@debbugs.gnu.org; Thu, 08 Aug 2013 13:07:09 -0400 Original-Received: from mail-ob0-f172.google.com ([209.85.214.172]:64398) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V7Tg3-0001Tl-Pz for 15045@debbugs.gnu.org; Thu, 08 Aug 2013 13:07:08 -0400 Original-Received: by mail-ob0-f172.google.com with SMTP id er7so4359703obc.31 for <15045@debbugs.gnu.org>; Thu, 08 Aug 2013 10:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=6ZtXh6MIe80Qwz+3jt/d51hbFf+VssrHpgXeBekufs8=; b=SsWElNKbXafhr2kYtH1W/uK5C9oUuroAxdxShh6VprvixgyCVzqw7O6zZ4QHHSYhv1 d2P0m1c0BW2pwaali1zSApk2ZDuX9lmeF0IcJbWvv7muJTzidrSyxyNX60ZUdqGHkxvd AcwUU2oPTX8lENV+SVxsmH9pmb13tPifc6hhzxWC5PNu8fBqw9n69uDxh+5PzpJn9UsF bdjXOMfo7GS/Eei25H3j6d5+sAuN6FbgSkfT07XMR7UvHRBsi13wvTOZHEvjF9T1wmB7 8VPQgNh6L9ZWq0K7VbX6lhitVTkGvlS64WG4NmjK/GqiI72/gz68AW9jgyw4ny1trQ5Y TuAw== X-Received: by 10.182.142.104 with SMTP id rv8mr7168270obb.3.1375981622034; Thu, 08 Aug 2013 10:07:02 -0700 (PDT) Original-Received: by 10.76.89.194 with HTTP; Thu, 8 Aug 2013 10:07:01 -0700 (PDT) In-Reply-To: <83zjssucnc.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:77087 Archived-At: Eli: > Can you identify the area in this trace where the unwarranted scroll > was visible? Barry: > but redisplay didn't need to scroll Undesired scrolling is a downstream symptom. Upstream from it is point visibly moving around inappropriately. I have scroll-margin set to 4, so when point briefly moves into the top scroll-margin, I get undesired scrolling. I don't know that I've seen point move to outside the visible part of the buffer. If so, then users with scroll-margin 0 won't see undesired scrolling, but would still see point moving around. Thus, I'm debugging the symptom of point moving. > A, B, and C are local variables whose meaning depends on the email > in which they're used. Ah, so it's not in "thread local storage". > in Fredisplay, walk the specpdl stack looking for a > save_excursion_restore where the saved position is different from > the current value of point in that buffer. Thanks for the tip. I tested this change and it seems to implement what you described. diff --git a/src/dispnew.c b/src/dispnew.c index 522a0e6..cf0103e 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5815,6 +5815,32 @@ immediately by pending input. */) (Lisp_Object force) { ptrdiff_t count; + bool noninteractive_old = noninteractive; + noninteractive = true; + Lisp_Object curPtMarker = Fpoint_marker(); + union specbinding *pdl = specpdl_ptr; + while (pdl > specpdl) + { + --pdl; + if (pdl->kind == SPECPDL_UNWIND + && pdl->unwind.func == save_excursion_restore + && ! EQ (Fequal (XSAVE_OBJECT (pdl->unwind.arg, 0), curPtMarker), Qt)) + { + { struct timespec debug_ts; char debug_dateStr[20]; { clock_gettime(CLOCK_REALTIME, &debug_ts); struct tm mytm; localtime_r(&debug_ts.tv_sec, &mytm); strftime(debug_dateStr, 20, "%Y-%m-%dT%H:%M:%S", &mytm) + printf( "%s.%09ld|pid:%d|tid:%ld|%s|%d| DEBUG: Found save_excursion_restore with mismatched point markers ", // TODO: debugging + debug_dateStr, debug_ts.tv_nsec, getpid(), pthread_self(), __FILE__, __LINE__ ); } + Fprin1(XSAVE_OBJECT (pdl->unwind.arg, 0), Qnil); + Fprin1(curPtMarker, Qnil); + printf("\n"); + Fbacktrace(); + fflush(stdout); + } + } + /* { struct timespec debug_ts; char debug_dateStr[20]; { clock_gettime(CLOCK_REALTIME, &debug_ts); struct tm mytm; localtime_r(&debug_ts.tv_sec, &mytm); strftime(debug_dateStr, 20, "%Y-%m-%dT%H:%M:%S", &mytm); } */ + /* printf( "%s.%09ld|pid:%d|tid:%ld|%s|%d| DEBUG: redisplay \n", // TODO: debugging */ + /* debug_dateStr, debug_ts.tv_nsec, getpid(), pthread_self(), __FILE__, __LINE__ ); fflush(stdout); } */ + /* Fbacktrace(); */ + noninteractive = noninteractive_old; swallow_events (1); if ((detect_input_pending_run_timers (1) We'll see what I get next time it comes up.