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: Wed, 7 Aug 2013 13:59:03 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1375898413 31429 80.91.229.3 (7 Aug 2013 18:00:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 7 Aug 2013 18:00:13 +0000 (UTC) To: 15045@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 07 20:00:15 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 1V781v-0008N0-3q for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Aug 2013 20:00:15 +0200 Original-Received: from localhost ([::1]:49989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V781u-0003eE-Nl for geb-bug-gnu-emacs@m.gmane.org; Wed, 07 Aug 2013 14:00:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V781p-0003co-R0 for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 14:00:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V781l-00024d-08 for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 14:00:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51681) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V781k-00024M-TK for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 14:00:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V781k-0004gJ-6J for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 14:00:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Barry OReilly Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Aug 2013 18:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15045 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137589836217876 (code B ref -1); Wed, 07 Aug 2013 18:00:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Aug 2013 17:59:22 +0000 Original-Received: from localhost ([127.0.0.1]:45995 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V7813-0004eF-Gc for submit@debbugs.gnu.org; Wed, 07 Aug 2013 13:59:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34749) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V7811-0004dy-0O for submit@debbugs.gnu.org; Wed, 07 Aug 2013 13:59:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V780t-0001Wz-Km for submit@debbugs.gnu.org; Wed, 07 Aug 2013 13:59:13 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V780t-0001Wi-Ha for submit@debbugs.gnu.org; Wed, 07 Aug 2013 13:59:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V780q-0003TD-P9 for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 13:59:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V780m-0001Lp-Ud for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 13:59:08 -0400 Original-Received: from mail-ob0-x244.google.com ([2607:f8b0:4003:c01::244]:47598) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V780m-0001Lb-NH for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2013 13:59:04 -0400 Original-Received: by mail-ob0-f196.google.com with SMTP id wc20so790642obb.7 for ; Wed, 07 Aug 2013 10:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=bvt43c+9kCsdS/Qca7hPUaCJ3RxVqKuHHcQ+CPdS4T0=; b=ZINr0HfTF24/ZIqAGC1UwbpFwF3ovX2BviI9OX01ld0Uxug1XiGXmFDnILEg9hrcfp no3vopAQEHKtnwnfWMzI8RKgnwuwag08+FadCwJLicby4VGlJUe7LW2+ALntjQ+lLTXv gplY76MSkP/DukdcWs//SgTz3sFfqkuoXLzAOMpL+DPfqABDUytNpxDzUm2kfyXcdsQy Ac/DFNCJiQ8bfaHXsNCaaJEJ1P7krU30Rb075V1GJyWEv4SXlIhkhqjhc6fWf2W7yBJl 2P3ypHTZqFoiyVS4LOFKnBNPIiNPuKaNxs9enYKsQv0jpWwe5EMFYq+Wu2TBBnGJzzUO kjvw== X-Received: by 10.182.76.38 with SMTP id h6mr3443896obw.74.1375898343107; Wed, 07 Aug 2013 10:59:03 -0700 (PDT) Original-Received: by 10.76.89.194 with HTTP; Wed, 7 Aug 2013 10:59:03 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:77042 Archived-At: See this thread for the original description: http://lists.gnu.org/archive/html/emacs-devel/2013-07/msg00328.html The short of it is that I occasionally witness point jump to elsewhere in the buffer while I'm editing and then back again. The change of point is visually apparent in the display. This has consequences such as causing undesired scrolling while editing. To debug it, I used a change like this: diff --git a/src/editfns.c b/src/editfns.c index 50bde90..039e13f 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -234,6 +234,8 @@ The return value is POSITION. */) (register Lisp_Object position) { ptrdiff_t pos; + bool noninteractive_old =3D noninteractive; + noninteractive =3D true; if (MARKERP (position) && current_buffer =3D=3D XMARKER (position)->buffer) @@ -245,7 +247,19 @@ The return value is POSITION. */) SET_PT_BOTH (ZV, ZV_BYTE); else SET_PT_BOTH (pos, marker_byte_position (position)); - + int btI =3D 0; + Lisp_Object theBacktrace; + do + { + theBacktrace =3D Fbacktrace_frame( make_number(btI) ); + ++btI; + Fprin1(theBacktrace, Qnil); + printf("\017\n"); + } while( ! EQ(theBacktrace, Qnil) ); + { 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: goto-char marker pos=3D%ld\n", // TODO: debugging + debug_dateStr, debug_ts.tv_nsec, getpid(), pthread_self(), __FILE__, __LINE__, pos ); fflush(stdout); } + noninteractive =3D noninteractive_old; return position; } @@ -253,6 +267,19 @@ The return value is POSITION. */) pos =3D clip_to_bounds (BEGV, XINT (position), ZV); SET_PT (pos); + int btI =3D 0; + Lisp_Object theBacktrace; + do + { + theBacktrace =3D Fbacktrace_frame( make_number(btI) ); + ++btI; + Fprin1(theBacktrace, Qnil); + printf("\017\n"); + } while( ! EQ(theBacktrace, Qnil) ); + { 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: goto-char position pos=3D%ld\n", // TODO: debugging + debug_dateStr, debug_ts.tv_nsec, getpid(), pthread_self(), __FILE__, __LINE__, pos ); fflush(stdout); } + noninteractive =3D noninteractive_old; return position; } I got a reproduction with these debug statements. I was editing a Makefile in comments at about buffer position 3396 and observed point temporarily jump to the beginning of the comment block at position 3084. I filtered the output for calls to go to position 3084 around the time I witnessed this: [backtrace A] 2013-08-01T10:37:28.119778000|pid:10485|tid:2342111488|editfns.c|281| DEBUG: goto-char position pos=3D3084 [backtrace B] 2013-08-01T10:37:28.412962000|pid:10485|tid:2342111488|editfns.c|261| DEBUG: goto-char marker pos=3D3084 [backtrace C] 2013-08-01T10:37:29.715413000|pid:10485|tid:2342111488|editfns.c|281| DEBUG: goto-char position pos=3D3084 Strangly, the backtrace A and B are 35 and 45 empty (except my Ctrl-O chars) stack frames respectively. Backtrace C is: (t semantic-make-lexer 3083 3257 nil nil)^O (t semantic-lex 3083 3257 nil)^O (t semantic-parse-region-default 3083 3257 nil nil nil)^O (t semantic-parse-region 3083 3257 nil)^O (t semantic-edits-incremental-parser-1)^O parser error: %S" error-message-string t] 4)))] 3)^O (t semantic-parse-changes-default)^O (t semantic-parse-changes)^O (t semantic-fetch-tags)^O (t byte-code "=C0 *=C1" [semantic-fetch-tags nil] 1)^O (t semantic-idle-scheduler-refresh-tags)^O (t byte-code "=C6^X=C7p=C7=C6=C8=C9=CA \"\"\"^Y=C6^ZESC=C6^\^M;^\^@=CB^M!^^#^N$^^@=CC=CD!<= U+0085>+^@^N^M?^^@^N%?^^@^N#E^@^M;E^@=CE^M!= R^@^N#^^@=CB^M=C6=CF#^^@^N&=D0X^ ^M;=AD^@=CB^M!^^#^N$=EF^@=CC=CD!=BC^@^N^M?= =EF^@^N%?=EF^@^N#=D6^@^M;=D6^@=CE^M!=E3^@^N= #=EF^@=CB^M=C6=CF#=EF^@^N&=D0X=EF^@=D1 ^N&W) ^A^N(=FE^@=D2 ^A=D3=DA=DB ^Ap^KB^S)^N*A^V*^?^@*^K^Q)^N,=C6^^-^^*o^A^N= *@^V-^N+>^A=D6 8^A=D7 >^A=D8^N+=DC\"^N.I^A=DD=DE^N-\"^N(U^A^N- Z^A=D3=DF=E0 e-scheduler-queue service semantic-idle-scheduler-verbose-flag] 8)^O (t semantic-idle-core-handler)^O (t semantic-idle-scheduler-function)^O (t apply semantic-idle-scheduler-function nil)^O (t byte-code "r=C2=C3H\")=C1" [timer apply 5 6] 4)^O (t timer-event-handler [t 0 1 0 t semantic-idle-scheduler-function nil idle 0])^O nil^O I can see the call to goto-char in define-lex (the macro which creates semantic-make-lexer). However, there is a save-excursion in effect at the semantic-idle-core-handler frame, so this goto-char wouldn't seem to be the same goto-char I observe in the display. I'm not sure about the empty backtraces. Is the code I used to print backtraces valid? In my many runs, empty backtraces are very rare. I have since started using Fbacktrace() instead of the more long winded code above. Unfortunately I'm having a reproduction drought in the past week. One additional observation not previously noted is that I see this bug much more often when editing comments or strings. However, I'm fairly sure I've seen it when editing straight code too. In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.4) of 2013-06-18 on psd15 Windowing system distributor `The X.Org Foundation', version 11.0.70101000 System Description: Red Hat Enterprise Linux Client release 5.4 (Tikanga) Configured using: `configure --prefix=3D/redacted/user/boreilly/sw/emacs-install-trunk-20899d085afe6252= 0113b5acbfe3dbba57823dc9 --with-gif=3Dno' Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=3Dnone locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: outline-minor-mode: t global-whitespace-mode: t global-ede-mode: t global-semanticdb-minor-mode: t global-semantic-idle-scheduler-mode: t semantic-mode: t evil-mode: t evil-local-mode: t global-undo-tree-mode: t undo-tree-mode: t show-paren-mode: t delete-selection-mode: t global-auto-revert-mode: t tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: M-x r e p o r t - Recent messages: Loading redacted Loading redacted Loading whitespace...done 2013-08-07T13:47:52.565183 Loading tags file: redacted Starting a new list of tags tables 2013-08-07T13:47:52.716876 Finished loading init file. 2013-08-07T13:47:52.723671 Inside my-prog-mode-hook 2013-08-07T13:47:52.732424 Inside my-emacs-lisp-mode-hook for buffer *scrat= ch* For information about GNU Emacs and the GNU system, type C-h C-a. 2013-08-07T13:47:52.748012 ---------------- Finished with my-emacs-startup-hook. ---------------- Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils noutline outline easy-mmode my-config warnings semantic/lex-spp etags package cl-macs whitespace cus-start cus-load my-proj ede/cpp-root ede/speedbar ede/files ede ede/base ede/auto ede/source eieio-speedbar speedbar sb-image dframe eieio-custom wid-edit semantic/db-mode semantic/idle semantic/bovine/gcc semantic/dep semantic/ia semantic/analyze/refs semantic/db-find semantic/db-ref semantic/senator semantic/decorate pulse semantic/analyze semantic/sort semantic/scope semantic/analyze/fcn semantic/db gv eieio-base semantic/ctxt semantic/format ezimage semantic/tag-ls semantic/find semantic/util-modes easymenu semantic/util semantic semantic/tag semantic/lex semantic/fw eieio byte-opt bytecomp byte-compile cconv eieio-core mode-local cedet evil evil-integration evil-maps evil-commands evil-types evil-search evil-ex evil-macros evil-repeat evil-states evil-core evil-common windmove rect evil-digraphs evil-vars ring edmacro kmacro undo-tree diff goto-chg rainbow-delimiters my-util advice help-fns electric paren delsel autorevert cl nadvice cl-lib time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)