From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#44087: 27.1; Switching to term-char-mode appends newline Date: Mon, 06 Jun 2022 20:54:23 +0200 Message-ID: <87a6appqqo.fsf@gnus.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2757"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 44087@debbugs.gnu.org To: Jinwoo Lee Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 06 20:55:15 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyHsh-0000Q6-BR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Jun 2022 20:55:15 +0200 Original-Received: from localhost ([::1]:54294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyHsg-0005KD-7U for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Jun 2022 14:55:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyHsU-0005K2-Pv for bug-gnu-emacs@gnu.org; Mon, 06 Jun 2022 14:55:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyHsU-0008HG-Gu for bug-gnu-emacs@gnu.org; Mon, 06 Jun 2022 14:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nyHsU-0001HS-Gc for bug-gnu-emacs@gnu.org; Mon, 06 Jun 2022 14:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Jun 2022 18:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44087 X-GNU-PR-Package: emacs Original-Received: via spool by 44087-submit@debbugs.gnu.org id=B44087.16545416784876 (code B ref 44087); Mon, 06 Jun 2022 18:55:02 +0000 Original-Received: (at 44087) by debbugs.gnu.org; 6 Jun 2022 18:54:38 +0000 Original-Received: from localhost ([127.0.0.1]:36891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyHs5-0001GZ-QP for submit@debbugs.gnu.org; Mon, 06 Jun 2022 14:54:38 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:43602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyHs3-0001GJ-1a for 44087@debbugs.gnu.org; Mon, 06 Jun 2022 14:54:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=uymM0vgk1Pdo70N99xJ25FSfl2+Psbd054ZNNws88Ig=; b=kur6TUol8nQ0YAwgsojHwcfh61 1KzXAxRyq6OxGDQewZa6XWdBfxDjBjAQpAErlVGZVjve3RvRnrdhW6ERFv3BTaV1ZMYKVk5T+OrcB hoA3wEcoB+gcF+eYQZqKSE2BNlDXJSbj/5k9arlbzkCBJU5YZKGMs0AenYLoVl2Ght+U=; Original-Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyHrt-0007Cr-K1; Mon, 06 Jun 2022 20:54:28 +0200 X-Now-Playing: Bobbie Gentry's _The Girl From Chickasaw County (5): Touch 'Em With Love_: "You've Made Me so Very Happy" In-Reply-To: (Jinwoo Lee's message of "Mon, 19 Oct 2020 16:45:48 -0700") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:233821 Archived-At: Jinwoo Lee 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