all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Jinwoo Lee <jinwoo68@gmail.com>
Cc: 44087@debbugs.gnu.org
Subject: bug#44087: 27.1; Switching to term-char-mode appends newline
Date: Mon, 06 Jun 2022 20:54:23 +0200	[thread overview]
Message-ID: <87a6appqqo.fsf@gnus.org> (raw)
In-Reply-To: <CANfjZ+unfaV_QPYgXyjLOqZSCYh=BQR6v4XVmyXD6QQzS2MdwA@mail.gmail.com> (Jinwoo Lee's message of "Mon, 19 Oct 2020 16:45:48 -0700")

Jinwoo Lee <jinwoo68@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





      reply	other threads:[~2022-06-06 18:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 23:45 bug#44087: 27.1; Switching to term-char-mode appends newline Jinwoo Lee
2022-06-06 18:54 ` Lars Ingebrigtsen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6appqqo.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=44087@debbugs.gnu.org \
    --cc=jinwoo68@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.