Subject: bug#13590: 23.4; Cursor jumps around while typing

From: Alpheus Madsen <[email-masked]>
Date: Wed, 30 Jan 2013 10:58:47 -0700

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your report will be posted to the [email-masked] mailing list
and the gnu.emacs.bug news group, and at http://debbugs.gnu.org.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug.  If you can, give
a recipe starting from `emacs -Q':
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I am currently trying to disable "Smart Tabs" for Python.

I start with:

   emacs -nw ~/aoeu.py

Right off the bat, if I try to type

   def hello, world!

I get the following:

   deo h!ll , world

with the initial "de" highlighted in Cyan, "o h" and "ll" in blue, and the
rest in grey.

If I then type "M-x whitespace-mode", the text *sometimes* reappears as
normal text.

Also, if I try to open a file, and type "C-x C-f" and then "~/.git[TAB]"
(or something similar), the tab completion jumps back over the
text--indeed, if I repeatedly backspace, I'll even backspace over the
highlighed status line.

I *don't* think it's a problem with "python-mode", because I have had this
problem before, when trying to edit "~/.gitconfig".  Since I was working
with a lot of colors, I suspected that the problem involved funny escape
characters.  Here is the portion of the Git configuration file:

=================
[alias]
   tree = log --pretty=format:'%C(red reverse)%h%Creset %C(yellow)%d%Creset
%C(blue bold)<%cn>%Creset %Cgreen%cd %Creset%s' --date=short --graph
   lg = log --graph --pretty=format:'%Cred%h%Creset %ad %s
%C(yellow)%d%Creset %C(bold blue)<%an>%Creset' --date=short
   hist = log --graph --full-history --all --pretty=format:'%Cred%h%Creset
%ad %s %C(yellow)%d%Creset %C(bold blue)<%an>%Creset' --date=short
   graph = log --graph --color --all
--pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"
   lol = log --graph --decorate --pretty=oneline --abbrev-commit
   lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
   ln = log --oneline --graph --decorate --all

   mytree log --graph --full-history --all --color
--pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"
=================

Unfortunately, because I deleted the line that seemed to be causing the
problem, this *isn't* the original section of the file; I *hope* that the
alias "mytree" is like the line that was causing the problem, but I cannot
be sure--thus, this example might be completely useless for debugging
purposes.

If I start with "emacs -nw -Q ~/aoeu.py", the problem doesn't seem to exist
at all.

Also, if I comment out (column-number-mode 1) in my init.el file, the
problem also doesn't see\
m to exist.

My ".emacs.d/init.el" file is as follows:
==================
;;;; A few basic variables that I like to have set up...
(desktop-save-mode 1)
(show-paren-mode 1)
(column-number-mode 1)
(setq make-backup-files nil)

;;;; Include files; we add "~/.emacs.d/elisp/[. smarttabs]"
(let ((default-directory "~/.emacs.d/elisp"))
  (normal-top-level-add-to-load-path '("."))
  (normal-top-level-add-to-load-path '("smarttabs")))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; Smart Tabs Mode and hooks; useful for using tabs to show
;;;; indentation, and spaces for showing alignment.
(setq-default tab-width 3)
(setq indent-tabs-mode nil)

(autoload 'smart-tabs-mode "smart-tabs-mode"
  "Intelligently indent with tabs, align with spaces!")
(autoload 'smart-tabs-mode-enable "smart-tabs-mode")
(autoload 'smart-tabs-advice "smart-tabs-mode")

;; Python
(add-hook 'python-mode-hook
          (lambda ()
                  (setq indent-tabs-mode t)
                  (setq tab-width (default-value 'tab-width))
                  (setq smart-tabs-mode t)))
(smart-tabs-advice python-indent-line-1 python-indent)

;; Lisp
==================

Of course, I have reason to believe that the problem is somewhere in
column-number-mode, so I'll be turning off this mode, so that I could just
get back to work.  Since the cursor jumps back and forth in this bug,
however, I wouldn't be surprised if it's a combination of
column-number-mode and show-paren-mode--but that's just speculation on my
part.

Also, I use the Smart Tabs mode made available on the Wiki:
https://github.com/jcsalomon/smarttabs.git

While I can't be certain, I don't *think* that Smart Tabs is part of the
bug, because I can comment out Smart Tabs in init.el, and the problem
remains.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/share/emacs/23.4/etc/DEBUG.

In GNU Emacs 23.4.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.12)
 of 2012-09-22 on allspice, modified by Debian
configured using `configure  '--build' 'x86_64-linux-gnu' '--build'
'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib'
'--libexecdir=/usr/lib' '--localstatedir=/var/lib'
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes'
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.4/site-lisp:/usr/share/emacs/site-lisp'
'--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
'--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -DDEBIAN
-O2' 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Python

Minor modes in effect:
  smart-tabs-mode: t
  show-paren-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
h e l l o , SPC w o r l d ! RET C-x b C-g ESC x r e
p TAB o r t TAB RET

Recent messages:
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el
(source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el
(source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...done
No desktop file.
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
Quit
Making completion list...

Load-path shadows:
/usr/share/emacs/23.4/site-lisp/debian-startup hides
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/site-lisp/rst hides
/usr/share/emacs/23.4/lisp/textmodes/rst
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/23.4/lisp/textmodes/ispell
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/23.4/lisp/textmodes/flyspell

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha1 hex-util hashcash mail-utils emacsbug help-mode view python-21
python easymenu comint ring smart-tabs-mode easy-mmode advice help-fns
advice-preload paren desktop tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mldrag 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 loaddefs button minibuffer faces cus-face files text-properties
overlay md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)