unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22287: 25.1.50; Sudden jumping point in buffer
@ 2016-01-01 11:10 Stefan-W. Hahn
  2016-01-03 11:26 ` David Engster
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan-W. Hahn @ 2016-01-01 11:10 UTC (permalink / raw)
  To: 22287

Hello,

I have a problem with a jumping point in buffers while typing
(see http://permalink.gmane.org/gmane.emacs.devel/194737).

I investigating this problem since quite a while. I also come along
Bug#15045. I think it could be the same problem.

I traced it to running auto-save-hook; call of funktion
semanticdb-save-all-db-idle.

To be sure it happens there I made following change:

,----
| (defun semanticdb-save-all-db-idle ()
|   "Save all semantic tag databases from idle time.
| Exit the save between databases if there is user input."
|   (semantic-safe "Auto-DB Save: %S"
|     ;; FIXME: Use `while-no-input'?
|     ;;(save-mark-and-excursion
|      (progn
|      (message "*** sem start: buffer %s %d" (buffer-name) (point))
|     (semantic-exit-on-input 'semanticdb-idle-save
|       (mapc (lambda (db)
|               (message "*** sem: buffer %s %d" (buffer-name) (point))
|               (when
|                   (and semantic-current-input-throw-symbol
|                        (or
|                         (let
|                             ((pos
|                               (point))
|                              rc)
|                           (setq rc
|                                 (input-pending-p))
|                           (message "*** input: rc=%s %d %d" rc pos
|                                        (point))
|                           rc)
|                         (let ((pos (point))
|                               rc)
|                           (with-current-buffer
|                               (marker-buffer semantic--on-input-start-marker)
|                             (save-excursion
|                               (goto-char semantic--on-input-start-marker)
|                               (setq rc (accept-process-output))))
|                           (message "*** out: rc=%s %d %d" rc pos (point))
|                           rc)))
|                 (message "throw %d"
|                          (point))
|                 (throw semantic-current-input-throw-symbol 'semanticdb-idle-save))
|               (let ((pos (point)))
|                 (semanticdb-save-db db t)
|                 (if (/= pos (point))
|                     (message "*** db %s %d->%d" db pos (point)))
|                 ))
| 	    semanticdb-database-list))
|     (message "*** sem end: buffer %s %d" (buffer-name) (point))
|     )))
`----

(While inspecting the code with macrostep-expand, it leaves the original
code and removes the macro; perhaps a bug there, but has no relevance
here.)

To reproduce the problem I do expanding the code in src/intervals.c
(can be other code too) in function set_point with a statement and
a C-comment in which I type until auto-save is triggered. To retry I
always start with a fresh copy of the file with deleting the rubbish I
typed in, save the file, revert the file, waiting till semantic has
parsed the file and the putting in the same statement and beginning to
write the comment...

With above instrumentation and the error happening, I saw following
messages:

,----
| Cannot find types for ‘"Zeit"’
| *** sem start: buffer intervals.c 49724
| *** sem: buffer intervals.c 49724
| *** input: rc=nil 49724 49724
| *** out: rc=nil 49724 49724
| *** sem: buffer intervals.c 49724
| *** input: rc=nil 49724 49724
| *** out: rc=nil 49724 49724
| *** sem: buffer intervals.c 49724
| *** input: rc=nil 49724 49724
| *** out: rc=nil 49724 49724
| *** sem: buffer intervals.c 49724
| *** input: rc=nil 49724 49724
| *** out: rc=nil 49724 49724
| *** sem: buffer intervals.c 49724
| *** input: rc=nil 49724 49724
| *** out: rc=nil 49724 49724
| *** sem: buffer intervals.c 49724
| *** input: rc=nil 49724 49724
| *** out: rc=nil 49724 49724
| *** sem: buffer intervals.c 49724
| *** input: rc=nil 49724 49724
| *** out: rc=nil 49724 49724
| *** sem: buffer intervals.c 49724
| *** input: rc=nil 49724 49724
| *** out: rc=nil 49724 49724
| *** sem end: buffer intervals.c 49392
| Auto-saving...done
| Error during redisplay: (jit-lock-function 50506) signaled (scan-error "Unbalanced parentheses" 49433 70139)
`----

The first "Cannot find types.." is a message from company which cannot
finds completions for the rubbish I typed inside the comment.

The "Error during redisplay.." comes from the open comment while typing.

What can be seen:
- auto-save is triggered and first function from auto-save-hook,
  semanticdb-save-all-db-idle, is called:

  "sem start:"

- there are 8 database to be saved.

  "sem: buffer:"

- before saving each database input-pending-p and accept-process-output
  are returning nil.

- after each call of input-pending-p and accept-process-output the point
  is at same position as before the call.

- the signalled was not thrown at all.

- after each call of semanticdb-save-db the point is at same position as
  before the call (no output of message "*** db ...".

- the point at the end of semanticdb-save-all-db-idle has changed!!


Following calls can be seen to be made:

semanticdb-save-all-deb-idle
-> progn
   -> message "sem start"
   -> let
      -> point-marker
      -> catch
         -> mapc
            -> message, buffer-name, point
            -> and, or, let, setq
            -> input-pending-p
            -> message, buffer-name, point
            -> with-current-buffer, marker-buffer, save-excursion
            -> accept-process-output
            -> message, buffer-name, point
            -> point
            -> semanticdb-save-db
            -> if (with no ouput, so no different point compared to
                  point before call of semanticdb-save-db)
      -> message, buffer-name, point ("sem end")
         !! here with other position of point compared to "sem start"


If I see it correct, the point before catch and after catch are
different, but nothing inside catch is moving the point.

My environment ist:

In GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2015-12-31
Repository revision: 70f1fda4ae6abb5e11dcf281738c25f6f5b06061
  (compiled is 6595, see explanation below)
  
Windowing system distributor 'The X.Org Foundation', version 11.0.11204000
System Description:	Debian GNU/Linux 7.9 (wheezy)

Configured using:
 'configure --with-x --with-sound=alsa --with-wide-int
 --with-file-notification=yes --prefix=/opt/emacs25 --with-jpeg
 --with-xpm --with-png --with-tiff --with-rsvg --with-xml2 --with-gnutls
 --with-xft --with-imagemagick 'CFLAGS=-g3 -O3'
 GIT_VERSION=emacs-24.5-rc3-fixed-6595-g70f1fda'

The fixed-6595 is a (work around) in lisp/cedet/semantic/db.el:

diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index e4ac56c..5067c93 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -724,12 +724,13 @@ semanticdb-save-all-db-idle
 Exit the save between databases if there is user input."
   (semantic-safe "Auto-DB Save: %S"
     ;; FIXME: Use `while-no-input'?
+    (save-mark-and-excursion
     (semantic-exit-on-input 'semanticdb-idle-save
       (mapc (lambda (db)
              (semantic-throw-on-input 'semanticdb-idle-save)
              (semanticdb-save-db db t))
            semanticdb-database-list))
-    ))
+    )))
 
 ;;; Directory Project support
 ;;

which seems to be a solution for the problem described in this bug report.

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK2 X11

Important settings:
  value of $LC_COLLATE: de_DE.UTF-8
  value of $LC_CTYPE: de_DE.UTF-8
  value of $LC_MESSAGES: en_GB.UTF8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  display-time-mode: t
  yas-minor-mode: t
  org-link-minor-mode: t
  winner-mode: t
  whitespace-mode: t
  global-semantic-mru-bookmark-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  global-semantic-idle-local-symbol-highlight-mode: t
  global-semantic-idle-summary-mode: t
  global-semantic-decoration-mode: t
  global-semantic-highlight-func-mode: t
  global-semantic-stickyfunc-mode: t
  semantic-mode: t
  recentf-mode: t
  rainbow-delimiters-mode: t
  global-git-commit-mode: t
  hs-org/minor-mode: t
  savehist-mode: t
  async-bytecomp-package-mode: t
  hl-paren-mode: t
  hl-line-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  ido-everywhere: t
  diredp-highlight-autofiles-mode: t
  diff-auto-refine-mode: t
  eproject-mode: t
  ivy-mode: t
  company-quickhelp-mode: t
  global-company-mode: t
  company-mode: t
  electric-pair-mode: t
  url-handler-mode: t
  show-paren-mode: t
  which-function-mode: t
  shell-dirtrack-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-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
  abbrev-mode: t
  hs-minor-mode: t

Recent messages:
*** out: rc=nil 6573 6573
*** sem: buffer jump.el 6573
*** input: rc=nil 6573 6573
*** out: rc=nil 6573 6573
*** sem: buffer jump.el 6573
*** input: rc=nil 6573 6573
*** out: rc=nil 6573 6573
*** sem end: buffer jump.el 6573
Entering debugger...
Back to top level

Load-path shadows:
/home/hs/.emacs.d/git/org-mode/.dir-locals hides /home/hs/.emacs.d/git/hydra/.dir-locals
/home/hs/.emacs.d/git/org-mode/.dir-locals hides /home/hs/.emacs.d/git/avy/.dir-locals
/home/hs/.emacs.d/lisp/project/xgtags hides /home/hs/.emacs.d/lisp/xgtags/xgtags
/home/hs/.emacs.d/git/org-mode/contrib/lisp/htmlize hides /home/hs/.emacs.d/elpa/htmlize-20130207.1202/htmlize
/home/hs/.emacs.d/lisp/w32/w32-browser hides /home/hs/.emacs.d/elpa/w32-browser-20150105.105/w32-browser
/home/hs/.emacs.d/lisp/find-cmd hides /opt/emacs25/share/emacs/25.1.50/lisp/find-cmd
/home/hs/.emacs.d/lisp/master hides /opt/emacs25/share/emacs/25.1.50/lisp/master
/home/hs/.emacs.d/lisp/doc-view hides /opt/emacs25/share/emacs/25.1.50/lisp/doc-view
/home/hs/.emacs.d/lisp/loaddefs hides /opt/emacs25/share/emacs/25.1.50/lisp/loaddefs
/home/hs/.emacs.d/lisp/flymake hides /opt/emacs25/share/emacs/25.1.50/lisp/progmodes/flymake
/home/hs/.emacs.d/git/org-mode/lisp/org-mobile hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-mobile
/home/hs/.emacs.d/git/org-mode/lisp/ob-org hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-org
/home/hs/.emacs.d/git/org-mode/lisp/org-archive hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-archive
/home/hs/.emacs.d/git/org-mode/lisp/ob-table hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-table
/home/hs/.emacs.d/git/org-mode/lisp/ox-publish hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-publish
/home/hs/.emacs.d/git/org-mode/lisp/ob-keys hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-keys
/home/hs/.emacs.d/git/org-mode/lisp/ox-icalendar hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-icalendar
/home/hs/.emacs.d/git/org-mode/lisp/ob-dot hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-dot
/home/hs/.emacs.d/git/org-mode/lisp/ob-ruby hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-ruby
/home/hs/.emacs.d/git/org-mode/lisp/ob-io hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-io
/home/hs/.emacs.d/git/org-mode/lisp/org-protocol hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-protocol
/home/hs/.emacs.d/git/org-mode/lisp/ob-matlab hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-matlab
/home/hs/.emacs.d/git/org-mode/lisp/ox hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox
/home/hs/.emacs.d/git/org-mode/lisp/org-element hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-element
/home/hs/.emacs.d/git/org-mode/lisp/ox-org hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-org
/home/hs/.emacs.d/git/org-mode/lisp/ob-perl hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-perl
/home/hs/.emacs.d/git/org-mode/lisp/org-rmail hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-rmail
/home/hs/.emacs.d/git/org-mode/lisp/ob-maxima hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-maxima
/home/hs/.emacs.d/git/org-mode/lisp/org-footnote hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-footnote
/home/hs/.emacs.d/git/org-mode/lisp/ob-shen hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-shen
/home/hs/.emacs.d/git/org-mode/lisp/org-info hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-info
/home/hs/.emacs.d/git/org-mode/lisp/org-datetree hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-datetree
/home/hs/.emacs.d/git/org-mode/lisp/org-macro hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-macro
/home/hs/.emacs.d/git/org-mode/lisp/org-habit hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-habit
/home/hs/.emacs.d/git/org-mode/lisp/org-eshell hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-eshell
/home/hs/.emacs.d/git/org-mode/lisp/ob-ref hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-ref
/home/hs/.emacs.d/git/org-mode/lisp/org-version hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-version
/home/hs/.emacs.d/git/org-mode/lisp/ob-picolisp hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-picolisp
/home/hs/.emacs.d/git/org-mode/lisp/ox-texinfo hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-texinfo
/home/hs/.emacs.d/git/org-mode/lisp/ox-ascii hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-ascii
/home/hs/.emacs.d/git/org-mode/lisp/org-faces hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-faces
/home/hs/.emacs.d/git/org-mode/lisp/ob-haskell hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-haskell
/home/hs/.emacs.d/git/org-mode/lisp/ob-emacs-lisp hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-emacs-lisp
/home/hs/.emacs.d/git/org-mode/lisp/ob-comint hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-comint
/home/hs/.emacs.d/git/org-mode/lisp/ob-gnuplot hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-gnuplot
/home/hs/.emacs.d/git/org-mode/lisp/ob-python hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-python
/home/hs/.emacs.d/git/org-mode/lisp/org-bbdb hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-bbdb
/home/hs/.emacs.d/git/org-mode/lisp/org-list hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-list
/home/hs/.emacs.d/git/org-mode/lisp/ob-scala hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-scala
/home/hs/.emacs.d/git/org-mode/lisp/org-table hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-table
/home/hs/.emacs.d/git/org-mode/lisp/ob-mscgen hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-mscgen
/home/hs/.emacs.d/git/org-mode/lisp/ob-lisp hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-lisp
/home/hs/.emacs.d/git/org-mode/lisp/org-inlinetask hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-inlinetask
/home/hs/.emacs.d/git/org-mode/lisp/ob-lob hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-lob
/home/hs/.emacs.d/git/org-mode/lisp/ob-calc hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-calc
/home/hs/.emacs.d/git/org-mode/lisp/ob-plantuml hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-plantuml
/home/hs/.emacs.d/git/org-mode/lisp/ob-asymptote hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-asymptote
/home/hs/.emacs.d/git/org-mode/lisp/ob-css hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-css
/home/hs/.emacs.d/git/org-mode/lisp/ob-scheme hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-scheme
/home/hs/.emacs.d/git/org-mode/lisp/org-install hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-install
/home/hs/.emacs.d/git/org-mode/lisp/org-w3m hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-w3m
/home/hs/.emacs.d/git/org-mode/lisp/org-crypt hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-crypt
/home/hs/.emacs.d/git/org-mode/lisp/ox-man hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-man
/home/hs/.emacs.d/git/org-mode/lisp/ox-md hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-md
/home/hs/.emacs.d/git/org-mode/lisp/org-irc hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-irc
/home/hs/.emacs.d/git/org-mode/lisp/ob-clojure hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-clojure
/home/hs/.emacs.d/git/org-mode/lisp/ob-awk hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-awk
/home/hs/.emacs.d/git/org-mode/lisp/ob-sql hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-sql
/home/hs/.emacs.d/git/org-mode/lisp/ob-core hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-core
/home/hs/.emacs.d/git/org-mode/lisp/ob-sass hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-sass
/home/hs/.emacs.d/git/org-mode/lisp/org-bibtex hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-bibtex
/home/hs/.emacs.d/git/org-mode/lisp/ob-R hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-R
/home/hs/.emacs.d/git/org-mode/lisp/ox-html hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-html
/home/hs/.emacs.d/git/org-mode/lisp/ob-octave hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-octave
/home/hs/.emacs.d/git/org-mode/lisp/org-clock hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-clock
/home/hs/.emacs.d/git/org-mode/lisp/org-feed hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-feed
/home/hs/.emacs.d/git/org-mode/lisp/org-id hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-id
/home/hs/.emacs.d/git/org-mode/lisp/org-indent hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-indent
/home/hs/.emacs.d/git/org-mode/lisp/org-attach hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-attach
/home/hs/.emacs.d/git/org-mode/lisp/org-pcomplete hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-pcomplete
/home/hs/.emacs.d/git/org-mode/lisp/ob-latex hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-latex
/home/hs/.emacs.d/git/org-mode/lisp/org-loaddefs hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-loaddefs
/home/hs/.emacs.d/git/org-mode/lisp/org-src hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-src
/home/hs/.emacs.d/git/org-mode/lisp/ox-beamer hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-beamer
/home/hs/.emacs.d/git/org-mode/lisp/org-macs hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-macs
/home/hs/.emacs.d/git/org-mode/lisp/ob-ledger hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-ledger
/home/hs/.emacs.d/git/org-mode/lisp/ob hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob
/home/hs/.emacs.d/git/org-mode/lisp/ob-ditaa hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-ditaa
/home/hs/.emacs.d/git/org-mode/lisp/org-gnus hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-gnus
/home/hs/.emacs.d/git/org-mode/lisp/org-capture hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-capture
/home/hs/.emacs.d/git/org-mode/lisp/org-plot hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-plot
/home/hs/.emacs.d/git/org-mode/lisp/ob-exp hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-exp
/home/hs/.emacs.d/git/org-mode/lisp/org-mhe hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-mhe
/home/hs/.emacs.d/git/org-mode/lisp/ob-java hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-java
/home/hs/.emacs.d/git/org-mode/lisp/ob-C hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-C
/home/hs/.emacs.d/git/org-mode/lisp/ob-lilypond hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-lilypond
/home/hs/.emacs.d/git/org-mode/lisp/org-entities hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-entities
/home/hs/.emacs.d/git/org-mode/lisp/ob-makefile hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-makefile
/home/hs/.emacs.d/git/org-mode/lisp/ob-tangle hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-tangle
/home/hs/.emacs.d/git/org-mode/lisp/org-colview hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-colview
/home/hs/.emacs.d/git/org-mode/lisp/ob-js hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-js
/home/hs/.emacs.d/git/org-mode/lisp/org-ctags hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-ctags
/home/hs/.emacs.d/git/org-mode/lisp/ox-latex hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-latex
/home/hs/.emacs.d/git/org-mode/lisp/org hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org
/home/hs/.emacs.d/git/org-mode/lisp/ob-sqlite hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-sqlite
/home/hs/.emacs.d/git/org-mode/lisp/org-timer hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-timer
/home/hs/.emacs.d/git/org-mode/lisp/ob-fortran hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-fortran
/home/hs/.emacs.d/git/org-mode/lisp/org-compat hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-compat
/home/hs/.emacs.d/git/org-mode/lisp/ox-odt hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ox-odt
/home/hs/.emacs.d/git/org-mode/lisp/org-mouse hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-mouse
/home/hs/.emacs.d/git/org-mode/lisp/ob-eval hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-eval
/home/hs/.emacs.d/git/org-mode/lisp/org-agenda hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-agenda
/home/hs/.emacs.d/git/org-mode/lisp/ob-ocaml hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-ocaml
/home/hs/.emacs.d/git/org-mode/lisp/org-docview hides /opt/emacs25/share/emacs/25.1.50/lisp/org/org-docview
/home/hs/.emacs.d/git/org-mode/lisp/ob-screen hides /opt/emacs25/share/emacs/25.1.50/lisp/org/ob-screen
/home/hs/.emacs.d/git/org-mode/.dir-locals hides /opt/emacs25/share/emacs/25.1.50/lisp/gnus/.dir-locals

Features:
(shadow sort mail-extr emacsbug sendmail debug semantic/symref/filter
character-fold misearch multi-isearch semantic/tag-write
semantic/analyze/complete semantic/edit semantic/db-typecache eieio-opt
speedbar sb-image dframe auto flymake-cursor flymake time org-rmail
org-mhe org-irc org-info org-gnus org-docview org-bbdb org-w3m jka-compr
semantic/tag-file inversion semantic/db-file data-debug cedet-files
semantic/bovine/c semantic/decorate/include hideif semantic/bovine/c-by
semantic/lex-spp semantic/bovine/gcc semantic/dep semantic/bovine vc
vc-dispatcher map colir color smex yasnippet org-link-minor-mode
x86-lookup doc-view vlf-setup vlf vlf-base vlf-tune winner snippets
smooth-scrolling whitespace semantic/mru-bookmark semantic/db-mode
semantic/idle semantic/decorate/mode 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 eieio-base semantic/ctxt semantic/format ezimage
semantic/tag-ls semantic/find semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet saveplace rmail
recentf-ext recentf tree-widget wid-edit rainbow-delimiters
quick-transfer printing ps-print ps-def lpr neotree phi-replace
phi-search phi-search-core move-text magit-gitflow magit-filenotify
filenotify magit-blame magit-stash magit-bisect magit-remote
magit-commit magit-sequence magit magit-apply magit-wip magit-log
magit-diff smerge-mode magit-core magit-process magit-popup magit-mode
magit-git crm magit-section magit-utils git-commit log-edit message
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log with-editor tramp-sh server macrostep irony
simple-httpd htmlize ace-window avy hs-google leo hs-coding hideshowvis
hs-hideshow hideshow-org hideshow helm-projectile projectile grep
helm-bibtex f s ucs-normalize dash parsebib helm-C-x-b helm-cmd-t
helm-command helm-elisp helm-eval savehist session helm-config
helm-easymenu async-bytecomp helm-aliases async org-gtd org-id
org-capture org-clock ob-plantuml ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar ox-html ox-ascii ox-publish ox
org-outlook org-agenda-property org-agenda ob-perl org-occur-goto
org-bibtex org-protocol reftex-parse my-org-bibtex org-element avl-tree
windmove ob-latex ob-sh org-inset-dblock org org-macro org-footnote
org-pcomplete org-list org-faces org-entities noutline outline
org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs find-func
bibtex hl-anything hl-line hi-lock git-timemachine generic-x generic
fold-this export-tester ido seq my-eproject find-cmd eproject-extras
ibuf-macs ibuf-ext ibuffer edebug disp-table wdired vc-git unsafep
dired+ image-file highlight bookmark+ bookmark+-key bookmark+-1
bookmark+-bmu bookmark+-lit diff-mode diff diff-doc desktop frameset
counsel-global ggtags ewoc counsel-cscope eproject esh-var esh-io
esh-cmd esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module
esh-mode esh-util xcscope counsel swiper ivy-buffer-extend ivy-hydra ivy
derived highlights button-lock hydra lv cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs chistory
cal-menu calendar cal-loaddefs boxquote rect company-files
company-oddmuse company-keywords company-etags etags xref project
company-gtags company-dabbrev-code company-dabbrev company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-css company-nxml company-bbdb company-quickhelp
pos-tip company-c-headers company my-auctex reftex reftex-vars qt-pro
elec-pair avoid url-handlers paren delsel which-func imenu helm-mode
helm-files rx image-dired tramp tramp-compat tramp-loaddefs trampver
shell pcomplete format-spec dired-x dired-aux ffap thingatpt
helm-buffers helm-elscreen helm-tags helm-bookmark helm-adaptive
helm-info bookmark pp helm-locate helm-grep helm-regexp helm-plugin
helm-external helm-net browse-url xml url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
url-parse auth-source gnus-util mm-util help-fns mail-prsvr
password-cache url-vars mailcap helm-utils compile comint ansi-color
ring helm-help helm-types helm edmacro kmacro helm-source cl-seq
eieio-compat eieio byte-opt eieio-core helm-multi-match helm-lib dired
cus-start cus-load org-loaddefs helm-autoloads hs-macros use-package
diminish bytecomp byte-compile cl-extra help-mode cconv bind-key cl-macs
easy-mmode cl gv cl-loaddefs pcase cl-lib finder-inf tex-site advice
info package easymenu epg-config time-date mule-util tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
dbusbind inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 2332212 193392)
 (symbols 48 65722 0)
 (miscs 40 25980 2475)
 (strings 32 263528 119911)
 (string-bytes 1 6665386)
 (vectors 16 117481)
 (vector-slots 8 1894747 105613)
 (floats 8 1591 1102)
 (intervals 56 243416 728)
 (buffers 976 44)
 (heap 1024 125849 4875))

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply related	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-01 11:10 bug#22287: 25.1.50; Sudden jumping point in buffer Stefan-W. Hahn
@ 2016-01-03 11:26 ` David Engster
  2016-01-03 13:07   ` Stefan-W. Hahn
  0 siblings, 1 reply; 15+ messages in thread
From: David Engster @ 2016-01-03 11:26 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: 22287

Stefan-W. Hahn writes:
> - the point at the end of semanticdb-save-all-db-idle has changed!!

Thank you for investigating this so thoroughly. This is indeed some
weird behavior and I'm no longer sure this is the same bug as 15045. I
will try to reproduce this on my system.

-David





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-03 11:26 ` David Engster
@ 2016-01-03 13:07   ` Stefan-W. Hahn
  2016-01-03 15:47     ` David Engster
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan-W. Hahn @ 2016-01-03 13:07 UTC (permalink / raw)
  To: David Engster; +Cc: 22287

Mail von David Engster, Sun, 03 Jan 2016 at 12:26:37 +0100:

Hello,

> Stefan-W. Hahn writes:
> > - the point at the end of semanticdb-save-all-db-idle has changed!!
> 
> Thank you for investigating this so thoroughly. This is indeed some

Thanks.

> weird behavior and I'm no longer sure this is the same bug as 15045. I
> will try to reproduce this on my system.

I tried to get deeper yesterday and tried to check if a timer is called at
the end of semanticdb-save-all-db-idle.

For this I instrumented the code as follows:

,----
| diff --git a/src/alloc.c b/src/alloc.c
| index bee7cd1..4adb3d6 100644
| --- a/src/alloc.c
| +++ b/src/alloc.c
| @@ -7146,6 +7146,10 @@ do hash-consing of the objects allocated to pure space.  */);
|  	       doc: /* Non-nil means display messages at start and end of garbage collection.  */);
|    garbage_collection_messages = 0;
|  
| +  DEFVAR_BOOL ("my-safe-run-hooks", my_safe_run_hooks,
| +	       doc: /* Non-nil means display messages at start and end of garbage collection.  */);
| +  my_safe_run_hooks = 0;
| +
|    DEFVAR_LISP ("post-gc-hook", Vpost_gc_hook,
|  	       doc: /* Hook run after garbage collection has finished.  */);
|    Vpost_gc_hook = Qnil;
| diff --git a/src/fileio.c b/src/fileio.c
| index 6cda1e3..fb094df 100644
| --- a/src/fileio.c
| +++ b/src/fileio.c
| @@ -5499,7 +5499,9 @@ A non-nil CURRENT-ONLY argument means save only current buffer.  */)
|    Vquit_flag = Qnil;
|  
|    hook = intern ("auto-save-hook");
| +  my_safe_run_hooks = Qt;
|    safe_run_hooks (hook);
| +  my_safe_run_hooks = Qnil;
|  
|    if (STRINGP (Vauto_save_list_file_name))
|      {
| diff --git a/src/keyboard.c b/src/keyboard.c
| index 2449abb..00696cf 100644
| --- a/src/keyboard.c
| +++ b/src/keyboard.c
| @@ -7039,6 +7039,8 @@ process_pending_signals (void)
|  {
|    pending_signals = false;
|    handle_async_input ();
| +  if (garbage_collection_messages && my_safe_run_hooks)
| +    message1("*** handle atimers");
|    do_pending_atimers ();
|  }
|  
`----

and semanticdb-save-all-db-idle as described in the initial post.

With this I got (after starting and setting garbage-collection-messages t,
and doing stuff as described in the bug-report):

,----
| *** handle atimers [540 times]
| *** sem start: buffer intervals.c 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** handle atimers [10 times]
| *** sem end: buffer intervals.c 49392
| Auto-saving...done
| *** handle atimers [32 times]
`----

So a running timer is moving point!

Now I will try to find the desperado.

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-03 13:07   ` Stefan-W. Hahn
@ 2016-01-03 15:47     ` David Engster
  2016-01-03 20:51       ` Stefan-W. Hahn
  2016-01-04 15:22       ` Eli Zaretskii
  0 siblings, 2 replies; 15+ messages in thread
From: David Engster @ 2016-01-03 15:47 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: 22287

Stefan-W. Hahn writes:
> With this I got (after starting and setting garbage-collection-messages t,
> and doing stuff as described in the bug-report):
>
> ,----
> | *** handle atimers [540 times]
> | *** sem start: buffer intervals.c 49722
> | *** sem: buffer intervals.c 49722
> | *** input: rc=nil 49722 49722
> | *** out: rc=nil 49722 49722
> | *** sem: buffer intervals.c 49722
> | *** input: rc=nil 49722 49722
> | *** out: rc=nil 49722 49722
> | *** sem: buffer intervals.c 49722
> | *** input: rc=nil 49722 49722
> | *** out: rc=nil 49722 49722
> | *** sem: buffer intervals.c 49722
> | *** input: rc=nil 49722 49722
> | *** out: rc=nil 49722 49722
> | *** sem: buffer intervals.c 49722
> | *** input: rc=nil 49722 49722
> | *** out: rc=nil 49722 49722
> | *** sem: buffer intervals.c 49722
> | *** input: rc=nil 49722 49722
> | *** out: rc=nil 49722 49722
> | *** handle atimers [10 times]

That's interesting. Why do timers run here at all? Since your
'out:'-Message comes before that, it is clear that this is not because
of `accept-process-output'.

I'm pretty sure now that this is something else than #15045. There, we
had the problem that Semantic itself was moving point during lexing and
called 'input-pending-p' as well as 'accept-process-output', which both
ran timers at the time. If one of the timers forced redisplay, this lead
to a sudden change of point in the buffer. We fixed that by making
`input-pending-p' not running timers by default, and restoring point
before calling `accept-process-output'. This here seems to be something
different, in that not Semantic is moving point but some timer (which
does not mean there isn't a bug in Semantic here).

> | *** sem end: buffer intervals.c 49392
> | Auto-saving...done
> | *** handle atimers [32 times]
> `----
>
> So a running timer is moving point!

This makes sense as I cannot reproduce it here with

  emacs -Q -f semantic-mode

I'd suggest that you also start with 'emacs -Q' and activate minor-modes
you're using until you see the bug. Reducing `auto-save-interval' might
make this less tedious. Also, look at 'timer-list' which of your
minor-modes put timers in there (not sure if `timer-idle-list' might be
involved as well).

-David





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-03 15:47     ` David Engster
@ 2016-01-03 20:51       ` Stefan-W. Hahn
  2016-01-04 15:22         ` Eli Zaretskii
  2016-01-04 15:22       ` Eli Zaretskii
  1 sibling, 1 reply; 15+ messages in thread
From: Stefan-W. Hahn @ 2016-01-03 20:51 UTC (permalink / raw)
  To: David Engster; +Cc: 22287

Mail von David Engster, Sun, 03 Jan 2016 at 16:47:29 +0100:

Hello,

> That's interesting. Why do timers run here at all? Since your
> 'out:'-Message comes before that, it is clear that this is not because
> of `accept-process-output'.

I extended semanticdb-save-all-db-idle a little bit and replaced the
semantic-exit-on-input macro with its code:

,----
| (defun semanticdb-save-all-db-idle ()
|   "Save all semantic tag databases from idle time.
| Exit the save between databases if there is user input."
|   (semantic-safe "Auto-DB Save: %S"
|     ;; FIXME: Use `while-no-input'?
|     ;;    (save-excursion
|     (let ((start (point)))
|       (setq my-msg t)
|       (message "*** sem start: buffer %s %d" (buffer-name) (point))
|       (let ((semantic-current-input-throw-symbol 'semanticdb-idle-save)
|             (semantic--on-input-start-marker (point-marker)))
|         (catch 'semanticdb-idle-save
|           ;; ,@forms)))
|           ;;(semantic-exit-on-input 'semanticdb-idle-save
|           (mapc (lambda (db)
|                   (message "*** sem: buffer %s %d" (buffer-name) (point))
|                   (when
|                       (and semantic-current-input-throw-symbol
|                            (or
|                             (let
|                                 ((pos
|                                   (point))
|                                  rc)
|                               (setq rc
|                                     (input-pending-p))
|                               (message "*** input: rc=%s %d %d" rc pos
|                                        (point))
|                               rc)
|                             (let ((pos (point))
|                                   rc)
|                               (with-current-buffer
|                                   (marker-buffer semantic--on-input-start-marker)
|                                 (save-excursion
|                                   (goto-char semantic--on-input-start-marker)
|                                   (setq rc (accept-process-output))))
|                               (message "*** out: rc=%s %d %d" rc pos (point))
|                               rc)))
|                     (message "throw %d"
|                              (point))
|                     (throw semantic-current-input-throw-symbol 'semanticdb-idle-save))
|                   (let ((pos (point)))
|                     (semanticdb-save-db db t)
|                     (if (/= pos (point))
|                         (message "*** db %s %d->%d" db pos (point)))
|                     ))
|                 semanticdb-database-list)
|           (message "*** sem end: buffer %s %d->%d" (buffer-name) start (point))
|           )
|         (message "*** sem end2: buffer %s %d->%d" (buffer-name) start (point))
|         (message "*** sem end2: timer %s" timer-list)
|         (message "*** sem end2: idle-timer %s" timer-idle-list)
|         (message "*** sem end2: post-command-hook %s" post-command-hook)
|         (message "*** sem end2: pre-command-hook %s" pre-command-hook)
|         )
|       (setq my-msg nil)
|       )
|     ))
`----

This shows:
- With my-msg I tried to show running timers inside semantic-exit-on-input.
  There where just calls to jit-lock-deferred-fontify, but never when
  jumping point.
- point is never moving inside the "catch" ("sem end" has never shown up)
- every time point was jumping was with "sem end2"

> before calling `accept-process-output'. This here seems to be something
> different, in that not Semantic is moving point but some timer (which
> does not mean there isn't a bug in Semantic here).

> This makes sense as I cannot reproduce it here with
> 
>   emacs -Q -f semantic-mode
> 
> I'd suggest that you also start with 'emacs -Q' and activate minor-modes
> you're using until you see the bug. Reducing `auto-save-interval' might

That was a good hint. I sat it to 20 and it happened more often.

When started with

     emacs -Q

I got following minor-modes enabled in "intervals.c" buffer:

- abbrev-mode
- transient-mark-mode
- line-number-mode
- auto-compression-mode
- auto-encryption-mode
- auto-composition-mode
- blink-cursor-mode
- font-lock-mode
- global-font-lock-mode
- file-name-shadow-mode
- menu-bar-mode
- tool-bar-mode
- mouse-wheel-mode
- electric-indent-mode
- global-eldoc-mode
- tooltip-mode
- semantic-mode
- semantic-idle-scheduler-mode
- global-semantic-idle-scheduler-mode
- global-semanticdb-minor-mode
- diff-auto-refine-mode
- global-semantic-decoration-mode
- semantic-decoration-mode)

I tried to shut them off one after another. The minimum set of switched on
minor modes where the error happened was:

- menu-bar-mode
- semantic-mode
- semantic-idle-scheduler-mode
- global-semantic-idle-scheduler-mode
- global-semanticdb-minor-mode)

Output of one of moving point errors:

,----
| *** sem start: buffer intervals.c 49510
| *** sem: buffer intervals.c 49510
| *** input: rc=nil 49510 49510
| *** out: rc=nil 49510 49510
| *** sem: buffer intervals.c 49510
| *** input: rc=nil 49510 49510
| *** out: rc=nil 49510 49510
| *** sem: buffer intervals.c 49510
| *** input: rc=nil 49510 49510
| *** out: rc=nil 49510 49510
| *** sem: buffer intervals.c 49510
| *** input: rc=nil 49510 49510
| *** out: rc=nil 49510 49510
| *** sem: buffer intervals.c 49510
| *** input: rc=nil 49510 49510
| *** out: rc=nil 49510 49510
| *** sem: buffer intervals.c 49510
| *** input: rc=nil 49510 49510
| *** out: rc=nil 49510 49510
| *** sem end2: buffer intervals.c 49510->49391
| *** sem end2: timer nil
| *** sem end2: idle-timer ([nil 0 1 0 t semantic-idle-scheduler-function nil idle 0] [nil 0 60 0 t semantic-idle-scheduler-work-function nil idle 0])
| *** sem end2: post-command-hook (diff-post-command-hook t)
| *** sem end2: pre-command-hook nil
`----

When switching semantic-mode off, the error seems not to be reproducible.

This should it be for today.

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-03 15:47     ` David Engster
  2016-01-03 20:51       ` Stefan-W. Hahn
@ 2016-01-04 15:22       ` Eli Zaretskii
  1 sibling, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2016-01-04 15:22 UTC (permalink / raw)
  To: David Engster; +Cc: stefan.hahn, 22287

> From: David Engster <deng@randomsample.de>
> Date: Sun, 03 Jan 2016 16:47:29 +0100
> Cc: 22287@debbugs.gnu.org
> 
> > | *** handle atimers [540 times]
> > | *** sem start: buffer intervals.c 49722
> > | *** sem: buffer intervals.c 49722
> > | *** input: rc=nil 49722 49722
> > | *** out: rc=nil 49722 49722
> > | *** sem: buffer intervals.c 49722
> > | *** input: rc=nil 49722 49722
> > | *** out: rc=nil 49722 49722
> > | *** sem: buffer intervals.c 49722
> > | *** input: rc=nil 49722 49722
> > | *** out: rc=nil 49722 49722
> > | *** sem: buffer intervals.c 49722
> > | *** input: rc=nil 49722 49722
> > | *** out: rc=nil 49722 49722
> > | *** sem: buffer intervals.c 49722
> > | *** input: rc=nil 49722 49722
> > | *** out: rc=nil 49722 49722
> > | *** sem: buffer intervals.c 49722
> > | *** input: rc=nil 49722 49722
> > | *** out: rc=nil 49722 49722
> > | *** handle atimers [10 times]
> 
> That's interesting. Why do timers run here at all?

These are _atimers_, not timers.  An entirely different beast.  See
atimer.c.

Grep the C sources for start_atimer and turn_on_atimers, to see which
code uses atimers.  One such place is the poll timer used to poll for
user input (see keyboard.c), another is the hour-glass mouse pointer
feature shown when Emacs is busy (see xdisp.c).  We also turn them off
while waiting for input in wait_reading_process_output (see
process.c).





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-03 20:51       ` Stefan-W. Hahn
@ 2016-01-04 15:22         ` Eli Zaretskii
  2016-01-05 15:01           ` Stefan-W. Hahn
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-01-04 15:22 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: deng, 22287

> Date: Sun, 3 Jan 2016 21:51:04 +0100
> From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> Cc: 22287@debbugs.gnu.org
> 
> | *** sem end2: buffer intervals.c 49510->49391
> | *** sem end2: timer nil
> | *** sem end2: idle-timer ([nil 0 1 0 t semantic-idle-scheduler-function nil 
> idle 0] [nil 0 60 0 t semantic-idle-scheduler-work-function nil idle 0])
> | *** sem end2: post-command-hook (diff-post-command-hook t)
> | *** sem end2: pre-command-hook nil
> `----
> 
> When switching semantic-mode off, the error seems not to be reproducible.
> 
> This should it be for today.

Thank you for your efforts.

It strikes me that a much more efficient way of finding who moves
point would be by setting a watchpoint on that buffer's value of
point, with commands like this:

 xbacktrace
 continue
 end

Then, whenever point changes in that buffer, you should see a Lisp
backtrace which will show the offending code.

Let me know if you need further help with setting up such a watchpoint
in GDB.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-04 15:22         ` Eli Zaretskii
@ 2016-01-05 15:01           ` Stefan-W. Hahn
  2016-01-05 16:27             ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan-W. Hahn @ 2016-01-05 15:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: deng, 22287

Mail von Eli Zaretskii, Mon, 04 Jan 2016 at 17:22:50 +0200:

Hello,

> > Date: Sun, 3 Jan 2016 21:51:04 +0100
> > From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> > Cc: 22287@debbugs.gnu.org
> > 
> > | *** sem end2: buffer intervals.c 49510->49391
> > | *** sem end2: timer nil
> > | *** sem end2: idle-timer ([nil 0 1 0 t semantic-idle-scheduler-function nil 
> > idle 0] [nil 0 60 0 t semantic-idle-scheduler-work-function nil idle 0])
> > | *** sem end2: post-command-hook (diff-post-command-hook t)
> > | *** sem end2: pre-command-hook nil
> > `----
> > 
> > When switching semantic-mode off, the error seems not to be reproducible.
> > 
> > This should it be for today.
> 
> Thank you for your efforts.

You'r welcome.

> It strikes me that a much more efficient way of finding who moves
> point would be by setting a watchpoint on that buffer's value of
> point, with commands like this:
> 
>  xbacktrace
>  continue
>  end
> 
> Then, whenever point changes in that buffer, you should see a Lisp
> backtrace which will show the offending code.
> 
> Let me know if you need further help with setting up such a watchpoint
> in GDB.
> 

Thanks for this hint. I wasn't aware of this, after reading the good
documentation etc/DEBUG, great possibilities.

I've sat it up and am able to define a watchpoint which calls xbacktrace. I
have to play around with it a little, because in this straight forward
atempt, it is to slow. There is no possibility to do any real keystrokes in
the debuged emacs.

So, now, playtime... :-)

With kind regards,
Stefan


-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-05 15:01           ` Stefan-W. Hahn
@ 2016-01-05 16:27             ` Eli Zaretskii
  2016-01-05 19:51               ` Stefan-W. Hahn
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2016-01-05 16:27 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: deng, 22287

> Date: Tue, 5 Jan 2016 16:01:22 +0100
> From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> Cc: deng@randomsample.de, 22287@debbugs.gnu.org
> 
> Thanks for this hint. I wasn't aware of this, after reading the good
> documentation etc/DEBUG, great possibilities.
> 
> I've sat it up and am able to define a watchpoint which calls xbacktrace. I
> have to play around with it a little, because in this straight forward
> atempt, it is to slow. There is no possibility to do any real keystrokes in
> the debuged emacs.

Probably because you defined the watchpoint so that GDB was forced to
use software watchpoints, rather than hardware-assisted watchpoints.
The latter doesn't slow down Emacs.

If you tell how you defined the watchpoint, I might be able to help
you redefine it so that hardware-assisted watchpoints are used by GDB.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-05 16:27             ` Eli Zaretskii
@ 2016-01-05 19:51               ` Stefan-W. Hahn
  2016-01-05 20:12                 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Stefan-W. Hahn @ 2016-01-05 19:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: deng, 22287

Mail von Eli Zaretskii, Tue, 05 Jan 2016 at 18:27:22 +0200:

Hello,

> > Date: Tue, 5 Jan 2016 16:01:22 +0100
> > From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> > Cc: deng@randomsample.de, 22287@debbugs.gnu.org
> > 
> > Thanks for this hint. I wasn't aware of this, after reading the good
> > documentation etc/DEBUG, great possibilities.
> > 
> > I've sat it up and am able to define a watchpoint which calls xbacktrace. I
> > have to play around with it a little, because in this straight forward
> > atempt, it is to slow. There is no possibility to do any real keystrokes in
> > the debuged emacs.
> 
> Probably because you defined the watchpoint so that GDB was forced to
> use software watchpoints, rather than hardware-assisted watchpoints.
> The latter doesn't slow down Emacs.

I tried watch and awatch:

,----
| (gdb) info watch
| Num     Type           Disp Enb Address            What
| 3       hw watchpoint  keep n                      current_buffer->pt
|         xbacktrace
|         continue
| 4       acc watchpoint keep y                      current_buffer->pt
|         xbacktrace
|         continue
| (gdb) c
| Continuing.
| Hardware access (read/write) watchpoint 4: current_buffer->pt
| 
| Value = 4827705
| Hardware access (read/write) watchpoint 4: current_buffer->pt
| 
| Value = 4827705
| 0x000000000057fb40 in fix_start_end_in_overlays (start=4827705, end=4827706) at buffer.c:3580
| 3580      for (parent = NULL, tail = current_buffer->overlays_before; tail;)
| "message" (0xffffc790)
| 0x1c7c530 PVEC_COMPILED
| "mapc" (0xffffce60)
| "semanticdb-save-all-db-idle" (0xffffd3b0)
| Hardware access (read/write) watchpoint 4: current_buffer->pt
| 
| Value = 4827705
| Hardware access (read/write) watchpoint 4: current_buffer->pt
`----

and before watch 3:

,----
| Old value = 2008
| New value = 49503
| set_buffer_internal_1 (b=0x1a968c0) at buffer.c:2040
| 2040      last_known_column_point = -1;   /* Invalidate indentation cache.  */
| "message" (0xffffc790)
| 0x1db1838 PVEC_COMPILED
| "mapc" (0xffffce60)
| "semanticdb-save-all-db-idle" (0xffffd3b0)
| Hardware watchpoint 3: current_buffer->pt
`----

and both showed up as HW-Watchpoint.

But with each of these the execution of emacs, mainly the xbacktrace, was so
slow, that no further action in emacs is possible.

I started emacs in src/ via:

- gdb emacs
- run -Q
- I loaded the intervals.c file (my playground).
- in intervals.c buffer I call M-x xx

,----
|   (defun xx ()
|     (interactive)
|     (setq-default message-log-max 64000)
|     (setq auto-save-interval 20)
|     (setq load-prefer-newer t)
|     (abbrev-mode -1)
|     (transient-mark-mode -1)
|     (line-number-mode -1)
|     (auto-compression-mode -1)
|     (auto-encryption-mode -1)
|     (auto-composition-mode -1)
|     (blink-cursor-mode -1)
|     (font-lock-mode -1)
|     (global-font-lock-mode -1)
|     (file-name-shadow-mode -1)
|     ;; menu-bar-mode
|     (tool-bar-mode -1)
|     (mouse-wheel-mode -1)
|     (electric-indent-mode -1)
|     (global-eldoc-mode -1)
|     (tooltip-mode -1)
|
|     (add-to-list 'load-path "/usr/src/emacs/emacs.git/lisp/cedet/")
|     (add-to-list 'load-path "/usr/src/emacs/emacs.git/lisp/cedet/semantic/")
|     (semantic-mode)
|     (semantic-idle-scheduler-mode)
|     (global-semantic-idle-scheduler-mode)
|     (global-semanticdb-minor-mode)
|     (diff-auto-refine-mode -1)
|     (global-semantic-decoration-mode)
|     (semantic-decoration-mode)
|     (setq semantic-idle-scheduler-verbose-flag t)
|     )
`----

 to shut down all unnecessary minor-modes.
- added the watch point together with the xbacktrace, continue command

Together with the watch point no further keyboard input was possible in
emacs.

> If you tell how you defined the watchpoint, I might be able to help
> you redefine it so that hardware-assisted watchpoints are used by GDB.

Any hint welcome.

With kind regards,
Stefan
 

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-05 19:51               ` Stefan-W. Hahn
@ 2016-01-05 20:12                 ` Eli Zaretskii
  2016-01-05 21:08                   ` Stefan-W. Hahn
  2016-01-06 14:13                   ` Stefan-W. Hahn
  0 siblings, 2 replies; 15+ messages in thread
From: Eli Zaretskii @ 2016-01-05 20:12 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: deng, 22287

> Date: Tue, 5 Jan 2016 20:51:30 +0100
> From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> Cc: deng@randomsample.de, 22287@debbugs.gnu.org
> 
> > If you tell how you defined the watchpoint, I might be able to help
> > you redefine it so that hardware-assisted watchpoints are used by GDB.
> 
> Any hint welcome.

First, your watchpoints are hardware-assisted, so the problem is a
different one than what I imagined.  Which is good.

Don't use awatch, you only want a watchpoint to trigger when the value
of point actually changes, not when it's being read by some code.  Use
the "watch" command.

Next, I'm guessing that the watchpoint fires all the time, and that's
what slows down Emacs.  One way to make the situation better is to
condition the watchpoint on the value of point (since your previous
tests repeatedly move point from one known position to another known
position).  Like this:

  (gdb) watch -l current_buffer->pt if current_buffer->pt == POS
  (gdb) commands
    > xbacktrace
    > continue
    > end
  (gdb)

where POS is the value of buffer position to which point jumps when it
should have stayed put.

Note that I used "watch -l" (the letter ell) -- this will limit the
watchpoint to watching only point of the buffer that is current when
you type these GDB commands.  You will have to arrange that the
current buffer at that time is the buffer that visits intervals.c.

Let me know if the above is enough to allow you to run a session.

Thanks.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-05 20:12                 ` Eli Zaretskii
@ 2016-01-05 21:08                   ` Stefan-W. Hahn
  2016-01-06 14:13                   ` Stefan-W. Hahn
  1 sibling, 0 replies; 15+ messages in thread
From: Stefan-W. Hahn @ 2016-01-05 21:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: deng, 22287

Mail von Eli Zaretskii, Tue, 05 Jan 2016 at 22:12:40 +0200:

Hello,

> > Date: Tue, 5 Jan 2016 20:51:30 +0100
> > From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> > Cc: deng@randomsample.de, 22287@debbugs.gnu.org
> > 
> > > If you tell how you defined the watchpoint, I might be able to help
> > > you redefine it so that hardware-assisted watchpoints are used by GDB.
> > 
> > Any hint welcome.
> 
> Don't use awatch, you only want a watchpoint to trigger when the value
> of point actually changes, not when it's being read by some code.  Use
> the "watch" command.

Yes, was just to look if it is faster.

> Next, I'm guessing that the watchpoint fires all the time, and that's

Yes.

> what slows down Emacs.  One way to make the situation better is to

>   (gdb) watch -l current_buffer->pt if current_buffer->pt == POS

> where POS is the value of buffer position to which point jumps when it
> should have stayed put.

It was not every time the same, but I will try again without debugger
to check if I can define a condition.

> 
> Note that I used "watch -l" (the letter ell) -- this will limit the
> watchpoint to watching only point of the buffer that is current when

Ouch,... I have overread the "-l".

I tried with "-l" without condition watching the debugger for half an hour
running, while semantic is parsing. But no success.

I will try again tomorrow.

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-05 20:12                 ` Eli Zaretskii
  2016-01-05 21:08                   ` Stefan-W. Hahn
@ 2016-01-06 14:13                   ` Stefan-W. Hahn
  2016-01-06 21:52                     ` David Engster
  1 sibling, 1 reply; 15+ messages in thread
From: Stefan-W. Hahn @ 2016-01-06 14:13 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: deng, 22287

Mail von Eli Zaretskii, Tue, 05 Jan 2016 at 22:12:40 +0200:

Hello,

> > Date: Tue, 5 Jan 2016 20:51:30 +0100
> > From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> > Cc: deng@randomsample.de, 22287@debbugs.gnu.org
> > 
> > > If you tell how you defined the watchpoint, I might be able to help
> > > you redefine it so that hardware-assisted watchpoints are used by GDB.
> > 
> > Any hint welcome.
> 
>   (gdb) watch -l current_buffer->pt if current_buffer->pt == POS
>   (gdb) commands
>     > xbacktrace
>     > continue
>     > end
>   (gdb)

Ok, I tried this. But then it was not reproducible... I tried several
things, also to enable the watchpoint if another variable set in
semanticdb-save-all-db-idle() etc. Typing hours and watching hours at debug
outputs... nothing happend.

Then I tried another thing, just M-x do-auto-save. And it happened again.
With debugging on I have to wait long minutes to see nothing happens in
emacs but tons of debug output from gdb.

Last try was to work with to watchpoints trying to trigger on writing 753 to
pt which should enable the watch to enable all writing. But worked not so
good. I also had problems with xbacktrace on eeePC I tried this morning,
because on my Core-2 machine it was not reproducible any more after
yesterday evening. And therefore defined an xbacktrace2 which just goes back
15 entries in backtrace.

I am watching pt in intervals.c having typed <ret> at the end of
set_point() ((point) = 49504), M-x do-auto-save, and then wating...

What is seen is several calls to semantic-idle-scheduler-function, which is
changing position of point, every time going back to 49504.

,----
| ...
| 
| Old value = 49505
| New value = 49504
| 0x0000000000615b63 in temp_set_point_both (bytepos=49504, charpos=49504, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-end-of-context-default" (0xffffb4b0)
| "semantic-end-of-context" (0xffffb670)
| "semantic-narrow-to-context" (0xffffb820)
| "semantic-end-of-command-default" (0xffffb9e0)
| "semantic-end-of-command" (0xffffbba8)
| "semantic-ctxt-current-assignment-default" (0xffffbd50)
| "semantic-ctxt-current-assignment" (0xffffbf10)
| "semantic-ctxt-current-thing" (0xffffc0b0)
| "semantic-idle-summary-current-symbol-info-brutish" (0xffffc270)
| "semantic-idle-summary-current-symbol-info-default" (0xffffc420)
| "semantic-idle-summary-current-symbol-info-c-mode" (0xffffc5f0)
| "semantic-idle-summary-current-symbol-info" (0xffffc7b0)
| "semantic-idle-summary-idle-function" (0xffffc970)
| "semantic-idle-core-handler" (0xffffcb50)
| "semantic-idle-scheduler-function" (0xffffce08)
| "apply" (0xffffce00)
| "timer-event-handler" (0xffffcfc8)
| Hardware watchpoint 5: -location current_buffer->pt
| 

now point is changing to 1 in semantic-c-lexer:

| Old value = 49504
| New value = 1
| 0x0000000000615b63 in temp_set_point_both (bytepos=1, charpos=1, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-c-lexer" (0xffffbb10)
| "semantic-lex" (0xffffbce8)
| "semantic-parse-region-default" (0xffffbea0)
| "semantic-parse-region-c-mode" (0xffffc070)
| "semantic-parse-region" (0xffffc240)
| "semantic-fetch-tags" (0xffffc410)
| "semantic-refresh-tags-safe" (0xffffc5c0)
| "semantic-analyze-current-context" (0xffffc7a0)
| "semantic-idle-local-symbol-highlight-idle-function" (0xffffc970)
| "semantic-idle-core-handler" (0xffffcb50)
| "semantic-idle-scheduler-function" (0xffffce08)
| "apply" (0xffffce00)
| "timer-event-handler" (0xffffcfc8)
| Hardware watchpoint 4: -location current_buffer->pt
|

going to 753, which is the end of the copyright message at begin of intervals.c:

| Old value = 1
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 1
| New value = 753
| 0x0000000000615b63 in temp_set_point_both (bytepos=753, charpos=753, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "forward-comment" (0xffffb930)
| "semantic-c-lexer" (0xffffbb10)
| "semantic-lex" (0xffffbce8)
| "semantic-parse-region-default" (0xffffbea0)
| "semantic-parse-region-c-mode" (0xffffc070)
| "semantic-parse-region" (0xffffc240)
| "semantic-fetch-tags" (0xffffc410)
| "semantic-refresh-tags-safe" (0xffffc5c0)
| "semantic-analyze-current-context" (0xffffc7a0)
| "semantic-idle-local-symbol-highlight-idle-function" (0xffffc970)
| "semantic-idle-core-handler" (0xffffcb50)
| "semantic-idle-scheduler-function" (0xffffce08)
| "apply" (0xffffce00)
| "timer-event-handler" (0xffffcfc8)
| Hardware watchpoint 5: -location current_buffer->pt
| 

and going back to 49504:

| Old value = 753
| New value = 49504
| 0x0000000000615b63 in temp_set_point_both (bytepos=49504, charpos=49504, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-refresh-tags-safe" (0xffffc5c0)
| "semantic-analyze-current-context" (0xffffc7a0)
| "semantic-idle-local-symbol-highlight-idle-function" (0xffffc970)
| "semantic-idle-core-handler" (0xffffcb50)
| "semantic-idle-scheduler-function" (0xffffce08)
| "apply" (0xffffce00)
| "timer-event-handler" (0xffffcfc8)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 49504
| New value = 49210
| 0x0000000000615b63 in temp_set_point_both (bytepos=49210, charpos=49210, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff57b0)
| "list" (0xffff5960)
| "eval" (0xffff5af8)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 49210
| New value = 49170
| 0x0000000000615b63 in temp_set_point_both (bytepos=49170, charpos=49170, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff57b0)
| "list" (0xffff5960)
| "eval" (0xffff5af8)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 49170
| New value = 49209
| 0x0000000000615b63 in temp_set_point_both (bytepos=49209, charpos=49209, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff57b0)
| "list" (0xffff5960)
| "eval" (0xffff5af8)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 49209
| New value = 49504
| 0x0000000000615b63 in temp_set_point_both (bytepos=49504, charpos=49504, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff57b0)
| "list" (0xffff5960)
| "eval" (0xffff5af8)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 5: -location current_buffer->pt
| 

no again semantic-c-lexer going to 1, but now not called from
timer-event-handler, but from semanticdb-save-all-db-idle:

| Old value = 49504
| New value = 1
| 0x0000000000615b63 in temp_set_point_both (bytepos=1, charpos=1, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-c-lexer" (0xffffa0c0)
| "semantic-lex" (0xffffa298)
| "semantic-parse-region-default" (0xffffa450)
| "semantic-parse-region-c-mode" (0xffffa620)
| "semantic-parse-region" (0xffffa7f0)
| "semantic-fetch-tags" (0xffffa9c0)
| 0x3462ed0 PVEC_COMPILED
| "apply" (0xffffac88)
| 0x3b4a008 PVEC_COMPILED
| "apply" (0xffffaf20)
| "object-write" (0xffffb0c8)
| "eieio-list-prin1" (0xffffb228)
| "eieio-override-prin1" (0xffffb3d8)
| 0x19a7e78 PVEC_COMPILED
| "apply" (0xffffb678)
| 0x4f0bfa0 PVEC_COMPILED
| 0x3108888 PVEC_COMPILED
| "apply" (0xffffba88)
| 0x16a4798 PVEC_COMPILED
| "apply" (0xffffbd20)
| "object-write" (0xffffbf00)
| 0x3108a40 PVEC_COMPILED
| "apply" (0xffffc180)
| "eieio-persistent-save" (0xffffc320)
| 0x3b636a0 PVEC_COMPILED
| "apply" (0xffffc5f0)
| "semanticdb-save-db" (0xffffc6e0)
| "let" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 4: -location current_buffer->pt
| 
| Old value = 1
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 1
| New value = 753
| 0x0000000000615b63 in temp_set_point_both (bytepos=753, charpos=753, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "forward-comment" (0xffff9ee0)
| "semantic-c-lexer" (0xffffa0c0)
| "semantic-lex" (0xffffa298)
| "semantic-parse-region-default" (0xffffa450)
| "semantic-parse-region-c-mode" (0xffffa620)
| "semantic-parse-region" (0xffffa7f0)
| "semantic-fetch-tags" (0xffffa9c0)
| 0x3462ed0 PVEC_COMPILED
| "apply" (0xffffac88)
| 0x3b4a008 PVEC_COMPILED
| "apply" (0xffffaf20)
| "object-write" (0xffffb0c8)
| "eieio-list-prin1" (0xffffb228)
| "eieio-override-prin1" (0xffffb3d8)
| 0x19a7e78 PVEC_COMPILED
| "apply" (0xffffb678)
| Hardware watchpoint 5: -location current_buffer->pt
|

to 753 and back to 49504, after this switching between 753, 49504 several times:

| Old value = 753
| New value = 49504
| 0x0000000000615b63 in temp_set_point_both (bytepos=49504, charpos=49504, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "goto-char" (0xffffc320)
| "save-excursion" (0xffffc410)
| "save-current-buffer" (0xffffc510)
| "let" (0xffffc660)
| "or" (0xffffc740)
| "and" (0xffffc820)
| "if" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 4: -location current_buffer->pt
| 
| Old value = 49504
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 49504
| New value = 753
| 0x0000000000615b63 in temp_set_point_both (bytepos=753, charpos=753, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "save-excursion" (0xffffc410)
| "save-current-buffer" (0xffffc510)
| "let" (0xffffc660)
| "or" (0xffffc740)
| "and" (0xffffc820)
| "if" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 753
| New value = 49504
| 0x0000000000615b63 in temp_set_point_both (bytepos=49504, charpos=49504, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "goto-char" (0xffffc320)
| "save-excursion" (0xffffc410)
| "save-current-buffer" (0xffffc510)
| "let" (0xffffc660)
| "or" (0xffffc740)
| "and" (0xffffc820)
| "if" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 4: -location current_buffer->pt
| 
| Old value = 49504
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 49504
| New value = 753
| 0x0000000000615b63 in temp_set_point_both (bytepos=753, charpos=753, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "save-excursion" (0xffffc410)
| "save-current-buffer" (0xffffc510)
| "let" (0xffffc660)
| "or" (0xffffc740)
| "and" (0xffffc820)
| "if" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 753
| New value = 49504
| 0x0000000000615b63 in temp_set_point_both (bytepos=49504, charpos=49504, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "goto-char" (0xffffc320)
| "save-excursion" (0xffffc410)
| "save-current-buffer" (0xffffc510)
| "let" (0xffffc660)
| "or" (0xffffc740)
| "and" (0xffffc820)
| "if" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 4: -location current_buffer->pt
| 
| Old value = 49504
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 49504
| New value = 753
| 0x0000000000615b63 in temp_set_point_both (bytepos=753, charpos=753, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "save-excursion" (0xffffc410)
| "save-current-buffer" (0xffffc510)
| "let" (0xffffc660)
| "or" (0xffffc740)
| "and" (0xffffc820)
| "if" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 753
| New value = 49504
| 0x0000000000615b63 in temp_set_point_both (bytepos=49504, charpos=49504, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "goto-char" (0xffffc320)
| "save-excursion" (0xffffc410)
| "save-current-buffer" (0xffffc510)
| "let" (0xffffc660)
| "or" (0xffffc740)
| "and" (0xffffc820)
| "if" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 4: -location current_buffer->pt
| 
| Old value = 49504
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 49504
| New value = 753
| 0x0000000000615b63 in temp_set_point_both (bytepos=753, charpos=753, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "save-excursion" (0xffffc410)
| "save-current-buffer" (0xffffc510)
| "let" (0xffffc660)
| "or" (0xffffc740)
| "and" (0xffffc820)
| "if" (0xffffc900)
| 0x3981060 Lisp type 3
| "mapc" (0xffffcb70)
| "catch" (0xffffcc60)
| "let" (0xffffcdb0)
| "let" (0xffffcf00)
| "progn" (0xffffcfe0)
| "condition-case" (0xffffd140)
| "if" (0xffffd220)
| "semanticdb-save-all-db-idle" (0xffffd3c0)
| Hardware watchpoint 5: -location current_buffer->pt

and now switching between 753 and 146/147, not going back to 49504 again:

| 
| Old value = 753
| New value = 147
| 0x0000000000615b63 in temp_set_point_both (bytepos=147, charpos=147, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff5bb0)
| "list" (0xffff5d60)
| "eval" (0xffff5ef8)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 147
| New value = 146
| 0x0000000000615b63 in temp_set_point_both (bytepos=146, charpos=146, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff5bb0)
| "list" (0xffff5d60)
| "eval" (0xffff5ef8)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 4: -location current_buffer->pt
| 
| Old value = 146
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 146
| New value = 753
| 0x0000000000615b63 in temp_set_point_both (bytepos=753, charpos=753, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff5bb0)
| "list" (0xffff5d60)
| "eval" (0xffff5ef8)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 753
| New value = 147
| 0x0000000000615b63 in temp_set_point_both (bytepos=147, charpos=147, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff56f0)
| "list" (0xffff58a0)
| "eval" (0xffff5a38)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 147
| New value = 146
| 0x0000000000615b63 in temp_set_point_both (bytepos=146, charpos=146, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff56f0)
| "list" (0xffff58a0)
| "eval" (0xffff5a38)
| "redisplay_internal (C function)" (0x0)
| Hardware watchpoint 4: -location current_buffer->pt
| 
| Old value = 146
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
| Old value = 146
| New value = 753
| 0x0000000000615b63 in temp_set_point_both (bytepos=753, charpos=753, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-stickyfunc-fetch-stickyline" (0xffff56f0)
| "list" (0xffff58a0)
| "eval" (0xffff5a38)
| "redisplay_internal (C function)" (0x0)
| 
| Program received signal SIGTSTP, Stopped (user).
| 0x00007ffff1e0852e in __pselect (nfds=17, readfds=<optimized out>, readfds@entry=0x7fffffffcb60, writefds=<optimized out>, exceptfds=<optimized out>, exceptfds@entry=0x0, timeout=<optimized out>, timeout@entry=0x7fffffffd160, sigmask=<optimized out>, sigmask@entry=0x0) at ../sysdeps/unix/sysv/linux/pselect.c:79
| 79	../sysdeps/unix/sysv/linux/pselect.c: No such file or directory.
| Continuing.
| Hardware watchpoint 5: -location current_buffer->pt

I stopped the debugger and continued after this a hile but it was not going
back to 49504.

With next call from timer-event-handler it switches between 753 and 1 and
147 again:

| 
| Old value = 753
| New value = 1
| 0x0000000000615b63 in temp_set_point_both (bytepos=1, charpos=1, buffer=0x385aa10) at intervals.c:1798
| 1798	  SET_BUF_PT_BOTH (buffer, charpos, bytepos);
| "semantic-c-lexer" (0xffffc2a0)
| "semantic-lex" (0xffffc478)
| "semantic-parse-region-default" (0xffffc630)
| "semantic-parse-region-c-mode" (0xffffc800)
| "semantic-parse-region" (0xffffc9d0)
| "semantic-fetch-tags" (0xffffcba0)
| "semantic-idle-scheduler-refresh-tags" (0xffffcd60)
| "semantic-idle-core-handler" (0xffffcf40)
| "semantic-idle-scheduler-function" (0xffffd1f8)
| "apply" (0xffffd1f0)
| "timer-event-handler" (0xffffd3b8)
| Hardware watchpoint 4: -location current_buffer->pt
| 
| Old value = 1
| New value = 753
| Hardware watchpoint 5: -location current_buffer->pt
| 
`----

For me the suspect function is semantic-c-lexer, which is defined via macro
define-lex:

,----
| (defmacro define-lex (name doc &rest analyzers)
|   "Create a new lexical analyzer with NAME.
| ...
|   `(defun ,name  (start end &optional depth length)
|      ,(concat doc "\nSee `semantic-lex' for more information.")
|      ;; Make sure the state of block parsing starts over.
|      (setq semantic-lex-block-streams nil)
|      ;; Allow specialty reset items.
|      (run-hook-with-args 'semantic-lex-reset-functions start end)
|      ;; Lexing state.
|      (let* (;(starttime (current-time))
| 	    (starting-position (point))
| ...
|        (with-syntax-table semantic-lex-syntax-table
|          (goto-char start)
|          (while (and (< (point) end)
|                      (or (not length)
| 			 (<= (length semantic-lex-token-stream) length)))
|            (semantic-lex-one-token ,analyzers)
| 	   (when (eq semantic-lex-end-point tmp-start)
| 	     (error ,(format "%s: endless loop at %%d, after %%S" name)
|                     tmp-start (car semantic-lex-token-stream)))
| 	   (setq tmp-start semantic-lex-end-point)
|            (goto-char semantic-lex-end-point)
| 	   ;;(when (> (semantic-elapsed-time starttime (current-time))
| 	   ;;	    semantic-lex-timeout)
| 	   ;;  (error "Timeout during lex at char %d" (point)))
| >>>>	   (semantic-throw-on-input 'lex)
| 	   (semantic-lex-debug-break (car semantic-lex-token-stream))
| 	   ))
| ...
|        ;; Return to where we started.
|        ;; Do not wrap in protective stuff so that if there is an error
|        ;; thrown, the user knows where.
|        (goto-char starting-position)
|        ;; Return the token stream
|        (nreverse semantic-lex-token-stream))))
`----

It is moving point, only wrapping a goto-char around it and it is throwing a
signal under specific circumstances.

If I see it right, then semantic-c-lexer will be called under save-excursion
from semantic-idle-core-handler whenn called via timer-event-handler:

,----
| "semantic-idle-core-handler" (0xffffcb50)
| "semantic-idle-scheduler-function" (0xffffce08)
| "apply" (0xffffce00)
| "timer-event-handler" (0xffffcfc8)
`----

but when called from semanticdb-save-all-db-idle (I think) it will be called
from semanticdb-save-db and

,----
|     (semantic-exit-on-input 'semanticdb-idle-save
|       (mapc (lambda (db)
| 	      (semantic-throw-on-input 'semanticdb-idle-save)
| 	      (semanticdb-save-db db t))
| 	    semanticdb-database-list))
`----

therefore from within semantic-exit-on-input, which is a catch. And with my
other observations I saw the catch exiting with moved point.

This seems to explains, why a save-excursion around this works for me.

I also tried a save-excursion around semantic-c-lexer and this seems to work
too.

So after all this: my opinion is that semantic-c-lexer is the problem.

@Eli: I can send you the complete log if you need it.

With kind regards,
Stefan


-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-06 14:13                   ` Stefan-W. Hahn
@ 2016-01-06 21:52                     ` David Engster
  2016-02-21 16:29                       ` David Engster
  0 siblings, 1 reply; 15+ messages in thread
From: David Engster @ 2016-01-06 21:52 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: 22287

Stefan-W. Hahn writes:
> If I see it right, then semantic-c-lexer will be called under save-excursion
> from semantic-idle-core-handler whenn called via timer-event-handler:
>
> ,----
> | "semantic-idle-core-handler" (0xffffcb50)
> | "semantic-idle-scheduler-function" (0xffffce08)
> | "apply" (0xffffce00)
> | "timer-event-handler" (0xffffcfc8)
> `----
>
> but when called from semanticdb-save-all-db-idle (I think) it will be called
> from semanticdb-save-db and
>
> ,----
> |     (semantic-exit-on-input 'semanticdb-idle-save
> |       (mapc (lambda (db)
> | 	      (semantic-throw-on-input 'semanticdb-idle-save)
> | 	      (semanticdb-save-db db t))
> | 	    semanticdb-database-list))
> `----
>
> therefore from within semantic-exit-on-input, which is a catch. And with my
> other observations I saw the catch exiting with moved point.
>
> This seems to explains, why a save-excursion around this works for me.
>
> I also tried a save-excursion around semantic-c-lexer and this seems to work
> too.
>
> So after all this: my opinion is that semantic-c-lexer is the problem.

That is some impressive sleuthing you did there. Thanks a lot!

The problem is that the `object-write' method for the semanticdb-table
class calls `semantic-fetch-tags'. I was completely unaware of
that. When the table is not up-to-date, it will re-parse the buffer and
call the lexer.

So yes, this has to be wrapped in a save-excursion. But more
importantly, I think we should not put semanticdb-save-all-db-idle in
the auto-save-hook. As a function meant for idle-time, it really has no
business there. My best guess is that Eric originally thought that the
auto-save-hook is only called during idle time. I'll look a bit more
into what this entails, and I'll apply a fix in the coming days.

Thanks again,
David





^ permalink raw reply	[flat|nested] 15+ messages in thread

* bug#22287: 25.1.50; Sudden jumping point in buffer
  2016-01-06 21:52                     ` David Engster
@ 2016-02-21 16:29                       ` David Engster
  0 siblings, 0 replies; 15+ messages in thread
From: David Engster @ 2016-02-21 16:29 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: 22287-close

David Engster writes:
> So yes, this has to be wrapped in a save-excursion. But more
> importantly, I think we should not put semanticdb-save-all-db-idle in
> the auto-save-hook.

I finally fixed this on the emacs-25 branch. I apologize for the long
delay. Thanks again for debugging this.

I'm closing this bug; please reopen if you still observe problems.

-David





^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-02-21 16:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-01 11:10 bug#22287: 25.1.50; Sudden jumping point in buffer Stefan-W. Hahn
2016-01-03 11:26 ` David Engster
2016-01-03 13:07   ` Stefan-W. Hahn
2016-01-03 15:47     ` David Engster
2016-01-03 20:51       ` Stefan-W. Hahn
2016-01-04 15:22         ` Eli Zaretskii
2016-01-05 15:01           ` Stefan-W. Hahn
2016-01-05 16:27             ` Eli Zaretskii
2016-01-05 19:51               ` Stefan-W. Hahn
2016-01-05 20:12                 ` Eli Zaretskii
2016-01-05 21:08                   ` Stefan-W. Hahn
2016-01-06 14:13                   ` Stefan-W. Hahn
2016-01-06 21:52                     ` David Engster
2016-02-21 16:29                       ` David Engster
2016-01-04 15:22       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).