I'm running R using the ESS package (version 18.10.2, installed using package-list-packages) in Emacs 26.3 in MS Windows 10.
When I'm in an R console window (Emacs buffer named "*R*" where R is running) and I press C-c C-c using the right (not left) Control key, Emacs starts acting as though the Control key is being held down. For example, if I press C-c C-c <return> in the R console buffer using the right Control key, I get the message "<C-return> is undefined", and it keeps happening with further key presses (e.g. pressing p moves to the previous line). The problem doesn't happen if I press C-c C-c in the R console buffer using the left Control key. Even other programs (e.g. Notepad, Firefox) start acting as though Control is being pressed.
The "stuck" Control key can be "released" by pressing the left Control key.
The problem doesn't happen if I press C-c C-c (using either Control key) in an Emacs buffer with a .R file.
I normally use Vincent Goulet's modified version of Emacs, but the problem also happens with "ordinary" unmodified Emacs. In the steps below, I'm using the unmodified Emacs.
Steps to make the problem happen:
At the Windows command prompt, in the Emacs bin directory:
emacs -Q <return>
Type or copy the following into the *scratch* buffer:
(setq inferior-R-program-name "C:/Program Files/R/R-3.6.1/bin/x64/Rterm.exe")
Run the code in the *scratch* buffer:
M-x eval-buffer <return>
M-x R <return> <return>
(This opens an R console buffer and takes you to it.)
Using the right Control key:
C-c C-c <return>
This gives the message "<C-return> is undefined", which shouldn't happen (it doesn't happen if the C-c C-c <return> is pressed using the left Control key).
Further key presses are treated as though Control is being held down. For example, pressing p acts like C-p.
Press the left Control key to go back to normal.
- The problem doesn't happen with Emacs 25.3.1 (with the same version of ESS).
- The problem also happens with the latest version of R (4.0.2).
- The problem also happens if inferior-ess-r-program is used in place of inferior-R-program-name in the steps above.
- I tried a different keyboard on the same computer, and the same thing happened. I also tried it on a different Windows 10 computer and the same thing happened.
Copied from M-x report-emacs-bug:
In GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
of 2019-08-29 built on CIRROCUMULUS
Repository revision: 96dd0196c28bc36779584e47fffcca433c9309cd
Windowing system distributor 'Microsoft Corp.', version 10.0.18363
For information about GNU Emacs and the GNU system, type C-h C-a.
Type C-h m for help on ESS version 18.10.2
ess-tracebug mode enabled
<C-return> is undefined
'configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install 'CFLAGS=-O2 -static -g3''
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS THREADS LCMS2
value of $LANG: ENA
Major mode: iESS
Minor modes in effect:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils cl-extra help-mode ess-r-mode ess-r-flymake flymake-proc
flymake warnings thingatpt ess-r-xref xref project subr-x ess-trns
ess-r-package shell pcomplete ess-r-syntax ess-r-completion ess-roxy
ess-rd essddr noutline outline easy-mmode hideshow ess-s-lang ess-help
ess-mode ess ess-noweb-mode ess-inf ess-tracebug advice format-spec
ess-utils ido ess-custom executable compile comint ansi-color ring
finder-inf ess-generics info package easymenu epg-config url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache url-vars seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib elec-pair time-date mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp
disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors 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 composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray 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 threads w32notify w32
lcms2 multi-tty make-network-process emacs)
((conses 16 156874 9057)
(symbols 48 26904 2)
(miscs 40 73 170)
(strings 32 50752 1452)
(string-bytes 1 1386755)
(vectors 16 22886)
(vector-slots 8 595421 10002)
(floats 8 90 266)
(intervals 56 303 14)
(buffers 992 16))