GNU bug report logs - #15045
Point jumps inappropriately around time of Semantic lexing

Previous Next

Package: emacs;

Reported by: Barry OReilly <gundaetiapo <at> gmail.com>

Date: Wed, 7 Aug 2013 18:00:02 UTC

Severity: normal

Done: Barry OReilly <gundaetiapo <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Barry OReilly <gundaetiapo <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 15045 <at> debbugs.gnu.org, deng <at> randomsample.de
Subject: bug#15045: Point jumps inappropriately around time of Semantic lexing
Date: Thu, 8 Aug 2013 13:07:01 -0400
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.




This bug report was last modified 11 years and 193 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.