GNU bug report logs - #44087
27.1; Switching to term-char-mode appends newline

Previous Next

Package: emacs;

Reported by: Jinwoo Lee <jinwoo68 <at> gmail.com>

Date: Mon, 19 Oct 2020 23:50:01 UTC

Severity: normal

Tags: wontfix

Found in version 27.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 44087 in the body.
You can then email your comments to 44087 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#44087; Package emacs. (Mon, 19 Oct 2020 23:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jinwoo Lee <jinwoo68 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Oct 2020 23:50:02 GMT) Full text and rfc822 format available.

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

From: Jinwoo Lee <jinwoo68 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; Switching to term-char-mode appends newline
Date: Mon, 19 Oct 2020 16:45:48 -0700
[Message part 1 (text/plain, inline)]
In term-mode, when switching from line-mode (C-c C-j) to char-mode (C-c
C-k), a newline is appended at the end, thus sending out the text that
was previously entered in line-mode to the shell right away. Most of the
time, that is not what I want. I usually want to edit further before
sending the command to the shell.

I looked at the 'term-char-mode' function and it seems to prevent the
newline by temporarily overriding 'term-input-sender' with
'term-send-string', but it doesn't seem to work as intended
somehow. This is the snippet of the code.

        (unwind-protect
            (progn
              (add-function :override term-input-sender #'term-send-string)
              (end-of-line)
              (term-send-input))
          (remove-function term-input-sender #'term-send-string))))

I'm not sure why this doesn't work.
And not sure whether this is new in 27.1 or pre-existing.


In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20),
modified by Debian
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux rodete

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

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 --enable-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/google-emacs:/usr/local/share/google-emacs/27.1+gg3+1.20200824.053401.rc115/site-lisp:/usr/local/share/google-emacs/site-lisp:/usr/share/google-emacs/27.1+gg3+1.20200824.053401.rc115/site-lisp:/usr/share/google-emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --program-prefix=google- --disable-build-details --disable-silent-rules
 --with-modules GOOGLE_VERSION=27.1+gg3+1.20200824.053401.rc115
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 build_alias=x86_64-linux-gnu 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/google-emacs-mI2SpO/google-emacs-27.1+gg3+1.20200824.053401.rc115=.
-fstack-protector-strong
 -Wformat -Werror=format-security -Wall' LDFLAGS=-Wl,-z,relro
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'OBJCFLAGS=-g -O2
 -fdebug-prefix-map=/build/google-emacs-mI2SpO/google-emacs-27.1+gg3+1.20200824.053401.rc115=.
-fstack-protector-strong
 -Wformat -Werror=format-security''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=fcitx
  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
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs 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 term
disp-table easymenu comint ansi-color ehelp ring tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd 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 timer
select scroll-bar mouse jit-lock font-lock syntax facemenu 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 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 dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 50862 11535)
 (symbols 48 6786 1)
 (strings 32 17486 2323)
 (string-bytes 1 576575)
 (vectors 16 11421)
 (vector-slots 8 145518 16770)
 (floats 8 19 45)
 (intervals 56 248 0)
 (buffers 1000 12))
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44087; Package emacs. (Mon, 06 Jun 2022 18:55:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jinwoo Lee <jinwoo68 <at> gmail.com>
Cc: 44087 <at> debbugs.gnu.org
Subject: Re: bug#44087: 27.1; Switching to term-char-mode appends newline
Date: Mon, 06 Jun 2022 20:54:23 +0200
Jinwoo Lee <jinwoo68 <at> gmail.com> writes:

> In term-mode, when switching from line-mode (C-c C-j) to char-mode (C-c
> C-k), a newline is appended at the end, thus sending out the text that
> was previously entered in line-mode to the shell right away. Most of the
> time, that is not what I want. I usually want to edit further before
> sending the command to the shell.
>
> I looked at the 'term-char-mode' function and it seems to prevent the
> newline by temporarily overriding 'term-input-sender' with
> 'term-send-string', but it doesn't seem to work as intended
> somehow. This is the snippet of the code.
>
>         (unwind-protect
>             (progn
>               (add-function :override term-input-sender #'term-send-string)
>               (end-of-line)
>               (term-send-input))
>           (remove-function term-input-sender #'term-send-string))))

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

But the comment right above that indicates that the intention is to send
the string to the inferior process in `C-c C-k':

    ;; Send existing partial line to inferior (without newline).
    (let ((pmark (process-mark (get-buffer-process (current-buffer)))))
      (when (> (point) pmark)
	(unwind-protect
	    (progn
	      (add-function :override term-input-sender #'term-send-string)
	      (end-of-line)
	      (term-send-input))
	  (remove-function term-input-sender #'term-send-string))))
    (term-update-mode-line)))

(term-send-string just breaks up the output into shorter blocks.)

And this is how Emacs used to work in Emacs 25, and again works in 27
and up.  So it seems (see bug#49186) that this is working as intended,
so in that bug report I just updated the doc string to document the
behaviour, and I'm closing this bug report.

(And like I said in that bug report, I'm not sure the behaviour here is
optimal, so perhaps a feature request to disable this (behind a user
option) might be appropriate, if somebody feels strongly enough about
this.)

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




Added tag(s) wontfix. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 06 Jun 2022 18:55:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 44087 <at> debbugs.gnu.org and Jinwoo Lee <jinwoo68 <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 06 Jun 2022 18:55:03 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. (Tue, 05 Jul 2022 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 266 days ago.

Previous Next


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