Subject: 24.4.50; Subword mode breaks kill-word

From: Lukasz Klich <[email-masked]>
Date: Sat, 24 May 2014 11:31:33 +0200

Tested in emac -Q:

Open any buffer.
Insert "force_default[]".
Enable subword-mode.
Go to the beginning of inserted line.
Do C-u 2 M-d. (kill-word 2)

The result should be:
"[]"
but in fact is:
"efault[]".

Changing the number in command deletes additional chars.
So for C-u 3 M-d the result will be:
"fault[]".

Here's test for it:

(ert-deftest subword-mode-breaks-kill-word ()
  (with-temp-buffer
    (insert "force_default[]")
    (goto-char (point-min))
    (subword-mode)
    (kill-word 2)
    (should (string= "[]" (buffer-string)))))

In GNU Emacs 24.4.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
 of 2014-05-20 on charichuelo
Windowing system distributor `The X.Org Foundation', version 11.0.11501000
System Description: Ubuntu 14.04 LTS

Configured using:
 `configure --build=x86_64-linux-gnu --prefix=/usr
 '--includedir=${prefix}/include' '--mandir=${prefix}/share/man'
 '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var
 '--libdir=${prefix}/lib/x86_64-linux-gnu'
 '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode
 --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib
 --program-suffix=-snapshot --with-x=yes --with-x-toolkit=gtk3
 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
 -Werror=format-security' CPPFLAGS=-D_FORTIFY_SOURCE=2
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB

Important settings:
  value of $LANG: pl_PL.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  projectile-global-mode: t
  projectile-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-company-mode: t
  company-mode: t
  global-eclim-mode: t
  global-flycheck-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  flx-ido-mode: t
  ido-vertical-mode: t
  ido-ubiquitous-mode: t
  ido-everywhere: t
  which-function-mode: t
  delete-selection-mode: t
  global-subword-mode: t
  subword-mode: t
  winner-mode: t
  show-paren-mode: t
  savehist-mode: t
  recentf-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: 1

Recent input:
<triple-mouse-5> <down-mouse-5> <mouse-5> <double-down-mouse-5>
<double-mouse-5> <triple-down-mouse-5> <triple-mouse-5>
<triple-down-mouse-5> <triple-mouse-5> <triple-down-mouse-5>
<triple-mouse-5> <down-mouse-4> <mouse-4> <double-down-mouse-4>
<double-mouse-4> <triple-down-mouse-4> <triple-mouse-4>
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4>
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4>
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4>
<triple-mouse-4> <triple-down-mouse-4> <triple-mouse-4>
<triple-down-mouse-4> <triple-mouse-4> <triple-down-mouse-4>
<triple-mouse-4> <help-echo> <help-echo> <down-mouse-1>
<mouse-movement> <mouse-1> C-x b C-g C-g C-g <help-echo>
<help-echo> <down-mouse-2> <help-echo> <mouse-1> <help-echo>
<help-echo> <help-echo> <down-mouse-1> <mouse-1> M-x
d e l e t e C-SPC s e l e c C-n <return> M-x <return>
M-x <return> M-x <return> <help-echo> <down-mouse-1>
<mouse-1> C-x b s c r a <return> ( w i t h - c u r
r e n t - b u f f e r SPC " <help-echo> <down-mouse-1>
<mouse-movement> <mouse-1> C-x b C-g C-x o d e f a
u l t . r b <right> <return> ( p r i n t SPC m i n
o r - <return> <right> C-x C-s C-g <right> C-x C-e
<help-echo> <help-echo> <down-mouse-1> <drag-mouse-1>
C-x o C-x b m e s s a C-n <return> M-> <down-mouse-4>
<mouse-4> <double-down-mouse-4> <double-mouse-4> <triple-down-mouse-4>
<triple-mouse-4> <down-mouse-5> <mouse-5> <double-down-mouse-5>
<double-mouse-5> <down-mouse-1> <mouse-movement> <mouse-1>
<down-mouse-5> <mouse-5> <down-mouse-5> <mouse-5> <down-mouse-1>
<mouse-movement> <drag-mouse-1> C-x b C-g <help-echo>
<down-mouse-1> <mouse-1> C-x b r u b y <backspace>
<backspace> <backspace> d <backspace> <backspace> d
e f a <return> M-x n o r m a <return> M-x s u b w o
r d - w <backspace> m o d e <return> <down> C-u 2 M-d
<down-mouse-1> <mouse-movement> <mouse-1> C-_ M-x p
a c k a C-SPC d e s c r <return> s u b w o <return>
<down-mouse-1> <mouse-1> M-x f i l e - b u <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> b u g - e m a c s <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> C-SPC
e a <backspace> m a c s C-n C-n <return>

Recent messages:
((magit-blame-mode " blame") (edebug-mode " *Debugging*") (flyspell-mode
flyspell-mode-line-string) (ispell-minor-mode " Spell")
(magit-auto-revert-mode magit-auto-revert-mode-lighter) (view-mode " View")
(diff-minor-mode " Diff") (mml-mode " MML") (ert--current-run-stats (:eval
(ert--tests-running-mode-line-indicator))) (paredit-mode " Paredit")
(ensime-popup-buffer-mode (:eval (ensime-modeline-string))) (ensime-mode
(:eval (ensime-modeline-string))) (auto-complete-mode " AC") (flymake-mode
flymake-mode-line) (hs-minor-mode " hs") (projectile-mode
projectile-mode-line) (yas-minor-mode " yas") (company-search-mode
company-search-lighter) (company-mode company-lighter)
(compilation-minor-mode " Compilation") (compilation-shell-minor-mode "
Shell-Compile") (compilation-in-progress " Compiling") (eclim-mode "
Eclim") (global-whitespace-newline-mode " NL") (global-whitespace-mode "
WS") (whitespace-newline-mode " nl") (whitespace-mode " ws") (flycheck-mode
flycheck-mode-line) (smartparens-mode (" SP" (:eval (if
smartparens-strict-mode "/s" "")))) (undo-tree-visualizer-selection-mode
"Select") (undo-tree-mode undo-tree-mode-lighter) (rainbow-delimiters-mode
"") (flx-ido-mode "") (server-buffer-clients " Server") (superword-mode "
²") (subword-mode " ,") (global-auto-revert-mode
global-auto-revert-mode-text) (auto-revert-tail-mode
auto-revert-tail-mode-text) (auto-revert-mode auto-revert-mode-text)
(visible-mode " Vis") (visual-line-mode " Wrap")
(next-error-follow-minor-mode " Fol") (abbrev-mode " Abbrev")
(overwrite-mode overwrite-mode) (auto-fill-function " Fill")
(defining-kbd-macro " Def") (isearch-mode isearch-mode))
((magit-blame-mode " blame") (edebug-mode " *Debugging*") (flyspell-mode
flyspell-mode-line-string) (ispell-minor-mode " Spell")
(magit-auto-revert-mode magit-auto-revert-mode-lighter) (view-mode " View")
(diff-minor-mode " Diff") (mml-mode " MML") (ert--current-run-stats (:eval
(ert--tests-running-mode-line-indicator))) (paredit-mode " Paredit")
(ensime-popup-buffer-mode (:eval (ensime-modeline-string))) (ensime-mode
(:eval (ensime-modeline-string))) ...)
user-error: Minibuffer window is not active
Mark set [2 times]
Quit
Subword mode disabled
Undo branch point!
Type "q" in help window to restore its previous buffer.
You can run the command `describe-package' with C-h P
Type "q" in help window to restore its previous buffer.

Load-path shadows:
/usr/share/emacs/site-lisp/dictionaries-common/ispell hides
/usr/share/emacs/24.4.50/lisp/textmodes/ispell
/usr/share/emacs/site-lisp/dictionaries-common/flyspell hides
/usr/share/emacs/24.4.50/lisp/textmodes/flyspell

Features:
(finder-inf cus-start cus-load shadow sort mail-extr python emacsbug
sendmail magit-blame tabify network-stream starttls tls scala-mode2
scala-mode2-sbt scala-mode2-map scala-mode2-fontlock scala-mode2-indent
scala-mode2-paragraph scala-mode2-syntax scala-mode2-lib conf-mode
smartparens-ruby ruby-mode smie jka-compr eieio-opt speedbar sb-image
ezimage dframe misearch multi-isearch edebug flyspell ispell
magit-key-mode magit view tramp tramp-compat tramp-loaddefs trampver
shell pcomplete epa epg epg-config diff-mode git-rebase-mode
git-commit-mode log-edit message dired format-spec 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
ert ewoc debug chef-attributes vc-git paredit ensime easy-mmode
ensime-ui ensime-semantic-highlight ensime-doc ensime-scalex url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util url-parse auth-source eieio byte-opt bytecomp
byte-compile cconv eieio-core gnus-util mm-util mail-prsvr
password-cache url-vars mailcap ensime-search ensime-undo
ensime-refactor ensime-builder ensime-debug derived ensime-inf
ensime-sbt ensime-comint-utils ensime-auto-complete ensime-config
auto-complete popup flymake hideshow pp ensime-connections ensime-core
ensime-macros smart-mode-line mule-util key-chord projectile pkg-info
lisp-mnt epl grep clojure-snippets java-snippets yasnippet company-files
company-oddmuse company-keywords company-etags company-gtags
company-dabbrev-code company-dabbrev company-capf company-cmake
company-ropemacs company-xcode company-clang company-template
company-semantic company-css company-bbdb company-emacs-eclim
eclim-completion company help-at-pt eclimd eclim eclim-problems
eclim-maven compile comint ansi-color eclim-ant eclim-java json
eclim-project etags whitespace flycheck find-func help-mode rx f s
smartparens-config smartparens thingatpt dash undo-tree diff
rainbow-delimiters smex flx-ido flx ido-vertical-mode ido-ubiquitous
advice ido saveplace ace-jump-mode-autoloads
annoying-arrows-mode-autoloads tex-site company-cider-autoloads
csharp-mode-autoloads flycheck-color-mode-line-autoloads f-autoloads
edmacro kmacro ido-hacks-autoloads ido-ubiquitous-autoloads
ido-vertical-mode-autoloads js2-mode-autoloads json-mode-autoloads
json-reformat-autoloads git-rebase-mode-autoloads
git-commit-mode-autoloads malabar-mode-autoloads fringe-helper-autoloads
multi-autoloads openwith-autoloads popup-autoloads pkg-info-autoloads
epl-autoloads info python-info-autoloads rainbow-delimiters-autoloads
s-autoloads slime-autoloads help-fns cl-macs cl gv package server
which-func imenu delsel cap-words superword subword winner ring paren
savehist recentf tree-widget wid-edit cl-loaddefs cl-lib easymenu
autorevert filenotify wombat-theme time-date tooltip electric uniquify
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
prog-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 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 make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 583547 441771)
 (symbols 48 44205 29)
 (miscs 40 2920 6324)
 (strings 32 98883 94092)
 (string-bytes 1 2821585)
 (vectors 16 91969)
 (vector-slots 8 3235944 20211)
 (floats 8 16135 308)
 (intervals 56 16223 8822)
 (buffers 960 74)
 (heap 1024 92284 9505))