GNU bug report logs - #49186
ansi-term switch to char mode immediately executes string at prompt

Previous Next

Package: emacs;

Reported by: simon254 <at> mailbox.org

Date: Wed, 23 Jun 2021 12:56:02 UTC

Severity: normal

Tags: moreinfo

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49186 in the body.
You can then email your comments to 49186 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#49186; Package emacs. (Wed, 23 Jun 2021 12:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to simon254 <at> mailbox.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 23 Jun 2021 12:56:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: simon254 <at> mailbox.org
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: ansi-term switch to char mode immediately executes string at prompt
Date: Wed, 23 Jun 2021 13:55:37 +0100 (BST)
One can switch from char-mode to line-mode via C-c C-j to copy text /
enter text etc. Unfortunately, when changing back to char-mode, it always sends a return to the shell.
This was not the case in emacs 26

For example, C-c C-j, then typing ls and then C-c C-k -> ls is
executed. However, If I type ls and then C-c C-j followed by C-c C-k, it does not execute ls

Bug affects emacs version 27 and 28

In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.5.0, NS appkit-2022.50 Version 11.4 (Build 20F71))
 of 2021-06-06 built on two.local
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.4

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs-plus <at> 28/28.0.50/share/info/emacs
 --prefix=/usr/local/Cellar/emacs-plus <at> 28/28.0.50 --with-xml2
 --with-gnutls --with-native-compilation --without-dbus
 --with-imagemagick --with-modules --with-rsvg --with-ns
 --disable-ns-self-contained 'CFLAGS=-I/usr/local/opt/gcc/include
 -I/usr/local/opt/libgccjit/include -I/usr/local/opt/gmp/include
 -I/usr/local/opt/jpeg/include' 'LDFLAGS=-L/usr/local/lib/gcc/11
 -I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include
 -I/usr/local/opt/gmp/include -I/usr/local/opt/jpeg/include''

Configured features:
ACL GIF GLIB GMP GNUTLS IMAGEMAGICK JPEG JSON LCMS2 LIBXML2 MODULES
NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG THREADS TIFF
TOOLKIT_SCROLL_BARS XIM ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-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
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs
cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
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 tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer 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 cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue cocoa ns lcms2
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 68746 8679)
 (symbols 48 6527 0)
 (strings 32 18707 1877)
 (string-bytes 1 646131)
 (vectors 16 14337)
 (vector-slots 8 288368 17073)
 (floats 8 22 39)
 (intervals 56 262 0)
 (buffers 992 11))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49186; Package emacs. (Wed, 23 Jun 2021 13:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 49186 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 49186 <at> debbugs.gnu.org
Cc: simon254 <at> mailbox.org
Subject: Re: bug#49186: ansi-term switch to char mode immediately executes
 string at prompt
Date: Wed, 23 Jun 2021 15:21:01 +0200
simon254--- via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> For example, C-c C-j, then typing ls and then C-c C-k -> ls is
> executed. However, If I type ls and then C-c C-j followed by C-c C-k, it does not execute ls
>
> Bug affects emacs version 27 and 28

I can reproduce the behaviour.  To reproduce:

emacs -Q
M-x ansi-term RET RET
`C-c C-j l s C-c C-k'

In Emacs 26, this won't execute ls, but in Emacs 28 it does (and so it
does in Emacs 25.1).

The code for `term-char-mode' (i.e., `C-c C-k') seems to indicate that
the intention of the `C-c C-k' was to behave like Emacs 28 does now:

    ;; Send existing partial line to inferior (without newline).
    (let ((pmark (process-mark (get-buffer-process (current-buffer))))
	  (save-input-sender term-input-sender))
      (when (> (point) pmark)
	(unwind-protect
	    (progn
	      (setq term-input-sender
		    (symbol-function 'term-send-string))
	      (end-of-line)
	      (term-send-input))
	  (setq term-input-sender save-input-sender))))

But this didn't work in Emacs 26.1, but has been fixed now.

I don't use ansi-term myself much -- I think it's pretty peculiar that
`C-c C-k' sends partial line inputs to the shell.  Does anybody know
what the rationale for this is?  The code has been like this since 1994,
and Emacs 25 works like Emacs 28.  (So it's Emacs 26.1 that's broken
here.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 24 Jun 2021 01:22:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#49186; Package emacs. (Thu, 22 Jul 2021 14:19:02 GMT) Full text and rfc822 format available.

Message #13 received at 49186 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 49186 <at> debbugs.gnu.org
Cc: simon254 <at> mailbox.org
Subject: Re: bug#49186: ansi-term switch to char mode immediately executes
 string at prompt
Date: Thu, 22 Jul 2021 16:18:24 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I don't use ansi-term myself much -- I think it's pretty peculiar that
> `C-c C-k' sends partial line inputs to the shell.  Does anybody know
> what the rationale for this is?  The code has been like this since 1994,
> and Emacs 25 works like Emacs 28.  (So it's Emacs 26.1 that's broken
> here.)

I've now made term-char-mode document what it does.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 49186 <at> debbugs.gnu.org and simon254 <at> mailbox.org Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 22 Jul 2021 14:19:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 20 Aug 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.