Subject: bug#16327: 24.3; Arrow keys not working in virtual terminal after key binding

From: Yi Wang <[email-masked]>
Date: Thu, 2 Jan 2014 16:58:28 +0000

In a virtual terminal (i.e. the terminal without X, the one after
pressing, say C-M-F1), if the following code is evaluated, arrow keys no
longer work correctly. The 4 arrow keys becomes ABCD.

(global-set-key (kbd "M-[") '(lambda ()   (interactive) (other-window -1) ))

Note:

(1) This bug is reproducible with emacs -nw --no-init
(2) Under a X-environment terminal, say konsole, there is no problem.

==========

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgment at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

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':

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/24.3/etc/DEBUG.

In GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.2)
 of 2013-08-06 on -mnt-storage-buildroots-staging-x86_64-eric
Windowing system distributor `The X.Org Foundation', version 11.0.11405000
System Description: Arch Linux

Configured using:
 `configure '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib'
 '--localstatedir=/var' '--with-x-toolkit=gtk3' '--with-xft'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
 --param=ssp-buffer-size=4'
 'LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Org

Minor modes in effect:
  flyspell-mode: t
  show-paren-mode: t
  global-edit-server-edit-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<next> <next> <next> <next> <next> <next> <prior> <prior>
<prior> <prior> <prior> <prior> <prior> <next> <next>
<next> <prior> <prior> <prior> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <left>
<kp-enter> M-r C-x C-c M-x e <backspace> r e p SPC
o SPC r SPC e SPC b SPC <return>

Recent messages:
Source file `/home/wangyi/.emacs.d/elpa/org-20131028/org-bbdb.el' newer
than byte-compiled file
Source file `/home/wangyi/.emacs.d/elpa/org-20131028/org-gnus.el' newer
than byte-compiled file
Source file `/home/wangyi/.emacs.d/elpa/org-20131028/org-irc.el' newer than
byte-compiled file
Source file `/home/wangyi/.emacs.d/elpa/org-20131028/org-rmail.el' newer
than byte-compiled file
Starting new Ispell process [aspell::en] ...
scroll-up-command: End of buffer [2 times]
scroll-down-command: Beginning of buffer [3 times]
goto-line [2 times]
(No files need saving)
Making completion list... [2 times]

Load-path shadows:
/home/wangyi/.emacs.d/elpa/org-20131028/org-feed hides
/usr/share/emacs/24.3/lisp/org/org-feed
/home/wangyi/.emacs.d/elpa/org-20131028/ob-lob hides
/usr/share/emacs/24.3/lisp/org/ob-lob
/home/wangyi/.emacs.d/elpa/org-20131028/org-archive hides
/usr/share/emacs/24.3/lisp/org/org-archive
/home/wangyi/.emacs.d/elpa/org-20131028/ob-sql hides
/usr/share/emacs/24.3/lisp/org/ob-sql
/home/wangyi/.emacs.d/elpa/org-20131028/org-macs hides
/usr/share/emacs/24.3/lisp/org/org-macs
/home/wangyi/.emacs.d/elpa/org-20131028/org-faces hides
/usr/share/emacs/24.3/lisp/org/org-faces
/home/wangyi/.emacs.d/elpa/org-20131028/ob-ref hides
/usr/share/emacs/24.3/lisp/org/ob-ref
/home/wangyi/.emacs.d/elpa/org-20131028/org-colview hides
/usr/share/emacs/24.3/lisp/org/org-colview
/home/wangyi/.emacs.d/elpa/org-20131028/ob-js hides
/usr/share/emacs/24.3/lisp/org/ob-js
/home/wangyi/.emacs.d/elpa/org-20131028/ob-ocaml hides
/usr/share/emacs/24.3/lisp/org/ob-ocaml
/home/wangyi/.emacs.d/elpa/org-20131028/org-src hides
/usr/share/emacs/24.3/lisp/org/org-src
/home/wangyi/.emacs.d/elpa/org-20131028/org-install hides
/usr/share/emacs/24.3/lisp/org/org-install
/home/wangyi/.emacs.d/elpa/org-20131028/ob-mscgen hides
/usr/share/emacs/24.3/lisp/org/ob-mscgen
/home/wangyi/.emacs.d/elpa/org-20131028/org-info hides
/usr/share/emacs/24.3/lisp/org/org-info
/home/wangyi/.emacs.d/elpa/org-20131028/ob-calc hides
/usr/share/emacs/24.3/lisp/org/ob-calc
/home/wangyi/.emacs.d/elpa/org-20131028/ob-scala hides
/usr/share/emacs/24.3/lisp/org/ob-scala
/home/wangyi/.emacs.d/elpa/org-20131028/org-table hides
/usr/share/emacs/24.3/lisp/org/org-table
/home/wangyi/.emacs.d/elpa/org-20131028/ob-org hides
/usr/share/emacs/24.3/lisp/org/ob-org
/home/wangyi/.emacs.d/elpa/org-20131028/org-datetree hides
/usr/share/emacs/24.3/lisp/org/org-datetree
/home/wangyi/.emacs.d/elpa/org-20131028/org-list hides
/usr/share/emacs/24.3/lisp/org/org-list
/home/wangyi/.emacs.d/elpa/org-20131028/org-element hides
/usr/share/emacs/24.3/lisp/org/org-element
/home/wangyi/.emacs.d/elpa/org-20131028/org-attach hides
/usr/share/emacs/24.3/lisp/org/org-attach
/home/wangyi/.emacs.d/elpa/org-20131028/org-version hides
/usr/share/emacs/24.3/lisp/org/org-version
/home/wangyi/.emacs.d/elpa/org-20131028/ob-sqlite hides
/usr/share/emacs/24.3/lisp/org/ob-sqlite
/home/wangyi/.emacs.d/elpa/org-20131028/org-agenda hides
/usr/share/emacs/24.3/lisp/org/org-agenda
/home/wangyi/.emacs.d/elpa/org-20131028/ob-comint hides
/usr/share/emacs/24.3/lisp/org/ob-comint
/home/wangyi/.emacs.d/elpa/org-20131028/ob-tangle hides
/usr/share/emacs/24.3/lisp/org/ob-tangle
/home/wangyi/.emacs.d/elpa/org-20131028/ob-sh hides
/usr/share/emacs/24.3/lisp/org/ob-sh
/home/wangyi/.emacs.d/elpa/org-20131028/ob-C hides
/usr/share/emacs/24.3/lisp/org/ob-C
/home/wangyi/.emacs.d/elpa/org-20131028/ob-sass hides
/usr/share/emacs/24.3/lisp/org/ob-sass
/home/wangyi/.emacs.d/elpa/org-20131028/org-ctags hides
/usr/share/emacs/24.3/lisp/org/org-ctags
/home/wangyi/.emacs.d/elpa/org-20131028/ob-matlab hides
/usr/share/emacs/24.3/lisp/org/ob-matlab
/home/wangyi/.emacs.d/elpa/org-20131028/org-rmail hides
/usr/share/emacs/24.3/lisp/org/org-rmail
/home/wangyi/.emacs.d/elpa/org-20131028/org-plot hides
/usr/share/emacs/24.3/lisp/org/org-plot
/home/wangyi/.emacs.d/elpa/org-20131028/org-clock hides
/usr/share/emacs/24.3/lisp/org/org-clock
/home/wangyi/.emacs.d/elpa/org-20131028/ob-ditaa hides
/usr/share/emacs/24.3/lisp/org/ob-ditaa
/home/wangyi/.emacs.d/elpa/org-20131028/ob-emacs-lisp hides
/usr/share/emacs/24.3/lisp/org/ob-emacs-lisp
/home/wangyi/.emacs.d/elpa/org-20131028/org-w3m hides
/usr/share/emacs/24.3/lisp/org/org-w3m
/home/wangyi/.emacs.d/elpa/org-20131028/ob-gnuplot hides
/usr/share/emacs/24.3/lisp/org/ob-gnuplot
/home/wangyi/.emacs.d/elpa/org-20131028/org-compat hides
/usr/share/emacs/24.3/lisp/org/org-compat
/home/wangyi/.emacs.d/elpa/org-20131028/ob-scheme hides
/usr/share/emacs/24.3/lisp/org/ob-scheme
/home/wangyi/.emacs.d/elpa/org-20131028/ob hides
/usr/share/emacs/24.3/lisp/org/ob
/home/wangyi/.emacs.d/elpa/org-20131028/ob-asymptote hides
/usr/share/emacs/24.3/lisp/org/ob-asymptote
/home/wangyi/.emacs.d/elpa/org-20131028/ob-picolisp hides
/usr/share/emacs/24.3/lisp/org/ob-picolisp
/home/wangyi/.emacs.d/elpa/org-20131028/ob-dot hides
/usr/share/emacs/24.3/lisp/org/ob-dot
/home/wangyi/.emacs.d/elpa/org-20131028/org hides
/usr/share/emacs/24.3/lisp/org/org
/home/wangyi/.emacs.d/elpa/org-20131028/ob-perl hides
/usr/share/emacs/24.3/lisp/org/ob-perl
/home/wangyi/.emacs.d/elpa/org-20131028/ob-ruby hides
/usr/share/emacs/24.3/lisp/org/ob-ruby
/home/wangyi/.emacs.d/elpa/org-20131028/org-indent hides
/usr/share/emacs/24.3/lisp/org/org-indent
/home/wangyi/.emacs.d/elpa/org-20131028/org-bibtex hides
/usr/share/emacs/24.3/lisp/org/org-bibtex
/home/wangyi/.emacs.d/elpa/org-20131028/ob-R hides
/usr/share/emacs/24.3/lisp/org/ob-R
/home/wangyi/.emacs.d/elpa/org-20131028/org-mobile hides
/usr/share/emacs/24.3/lisp/org/org-mobile
/home/wangyi/.emacs.d/elpa/org-20131028/org-crypt hides
/usr/share/emacs/24.3/lisp/org/org-crypt
/home/wangyi/.emacs.d/elpa/org-20131028/org-habit hides
/usr/share/emacs/24.3/lisp/org/org-habit
/home/wangyi/.emacs.d/elpa/org-20131028/org-pcomplete hides
/usr/share/emacs/24.3/lisp/org/org-pcomplete
/home/wangyi/.emacs.d/elpa/org-20131028/org-entities hides
/usr/share/emacs/24.3/lisp/org/org-entities
/home/wangyi/.emacs.d/elpa/org-20131028/org-footnote hides
/usr/share/emacs/24.3/lisp/org/org-footnote
/home/wangyi/.emacs.d/elpa/org-20131028/ob-plantuml hides
/usr/share/emacs/24.3/lisp/org/ob-plantuml
/home/wangyi/.emacs.d/elpa/org-20131028/ob-css hides
/usr/share/emacs/24.3/lisp/org/ob-css
/home/wangyi/.emacs.d/elpa/org-20131028/org-loaddefs hides
/usr/share/emacs/24.3/lisp/org/org-loaddefs
/home/wangyi/.emacs.d/elpa/org-20131028/ob-exp hides
/usr/share/emacs/24.3/lisp/org/ob-exp
/home/wangyi/.emacs.d/elpa/org-20131028/org-protocol hides
/usr/share/emacs/24.3/lisp/org/org-protocol
/home/wangyi/.emacs.d/elpa/org-20131028/org-irc hides
/usr/share/emacs/24.3/lisp/org/org-irc
/home/wangyi/.emacs.d/elpa/org-20131028/ob-octave hides
/usr/share/emacs/24.3/lisp/org/ob-octave
/home/wangyi/.emacs.d/elpa/org-20131028/org-mhe hides
/usr/share/emacs/24.3/lisp/org/org-mhe
/home/wangyi/.emacs.d/elpa/org-20131028/ob-screen hides
/usr/share/emacs/24.3/lisp/org/ob-screen
/home/wangyi/.emacs.d/elpa/org-20131028/ob-python hides
/usr/share/emacs/24.3/lisp/org/ob-python
/home/wangyi/.emacs.d/elpa/org-20131028/ob-clojure hides
/usr/share/emacs/24.3/lisp/org/ob-clojure
/home/wangyi/.emacs.d/elpa/org-20131028/org-capture hides
/usr/share/emacs/24.3/lisp/org/org-capture
/home/wangyi/.emacs.d/elpa/org-20131028/ob-shen hides
/usr/share/emacs/24.3/lisp/org/ob-shen
/home/wangyi/.emacs.d/elpa/org-20131028/ob-io hides
/usr/share/emacs/24.3/lisp/org/ob-io
/home/wangyi/.emacs.d/elpa/org-20131028/org-gnus hides
/usr/share/emacs/24.3/lisp/org/org-gnus
/home/wangyi/.emacs.d/elpa/org-20131028/ob-lilypond hides
/usr/share/emacs/24.3/lisp/org/ob-lilypond
/home/wangyi/.emacs.d/elpa/org-20131028/org-mouse hides
/usr/share/emacs/24.3/lisp/org/org-mouse
/home/wangyi/.emacs.d/elpa/org-20131028/org-eshell hides
/usr/share/emacs/24.3/lisp/org/org-eshell
/home/wangyi/.emacs.d/elpa/org-20131028/ob-fortran hides
/usr/share/emacs/24.3/lisp/org/ob-fortran
/home/wangyi/.emacs.d/elpa/org-20131028/ob-latex hides
/usr/share/emacs/24.3/lisp/org/ob-latex
/home/wangyi/.emacs.d/elpa/org-20131028/ob-ledger hides
/usr/share/emacs/24.3/lisp/org/ob-ledger
/home/wangyi/.emacs.d/elpa/org-20131028/org-docview hides
/usr/share/emacs/24.3/lisp/org/org-docview
/home/wangyi/.emacs.d/elpa/org-20131028/ob-maxima hides
/usr/share/emacs/24.3/lisp/org/ob-maxima
/home/wangyi/.emacs.d/elpa/org-20131028/ob-lisp hides
/usr/share/emacs/24.3/lisp/org/ob-lisp
/home/wangyi/.emacs.d/elpa/org-20131028/org-timer hides
/usr/share/emacs/24.3/lisp/org/org-timer
/home/wangyi/.emacs.d/elpa/org-20131028/ob-java hides
/usr/share/emacs/24.3/lisp/org/ob-java
/home/wangyi/.emacs.d/elpa/org-20131028/org-id hides
/usr/share/emacs/24.3/lisp/org/org-id
/home/wangyi/.emacs.d/elpa/org-20131028/org-bbdb hides
/usr/share/emacs/24.3/lisp/org/org-bbdb
/home/wangyi/.emacs.d/elpa/org-20131028/ob-table hides
/usr/share/emacs/24.3/lisp/org/ob-table
/home/wangyi/.emacs.d/elpa/org-20131028/ob-awk hides
/usr/share/emacs/24.3/lisp/org/ob-awk
/home/wangyi/.emacs.d/elpa/org-20131028/ob-eval hides
/usr/share/emacs/24.3/lisp/org/ob-eval
/home/wangyi/.emacs.d/elpa/org-20131028/ob-haskell hides
/usr/share/emacs/24.3/lisp/org/ob-haskell
/home/wangyi/.emacs.d/elpa/org-20131028/org-inlinetask hides
/usr/share/emacs/24.3/lisp/org/org-inlinetask
/home/wangyi/.emacs.d/elpa/org-20131028/ob-keys hides
/usr/share/emacs/24.3/lisp/org/ob-keys

Features:
(shadow sort mail-extr emacsbug message idna cl-macs gv rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils thingatpt flyspell ispell image-file org-element
org-rmail org-mhe org-irc org-info org-gnus gnus-util org-docview
org-bibtex bibtex org-bbdb org-w3m org byte-opt warnings bytecomp
byte-compile cconv org-macro org-footnote org-pcomplete pcomplete
org-list org-faces org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob ob-tangle org-src ob-ref ob-lob ob-table ob-keys ob-exp
ob-comint comint ansi-color ring ob-core ob-eval org-compat org-macs
org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs server
wy-txt wy-tex derived wy-appearance wy-org wy-keys wy-settings time-date
paren edit-server yasnippet advice help-fns advice-preload edmacro
kmacro help-mode cl cl-lib wy-utils edit-server-autoloads
goto-last-change-autoloads org-autoloads info easymenu
yasnippet-autoloads package tooltip ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)