On 2016-11-01 03:10, Philipp Stephani wrote:
> This is dangerous because a different command is executed than the one=
> that is visible in the buffer.
> Either Emacs should make sure that after C-<backspace> the same =
command
> that is displayed is sent to the shell, or it should disable
> C-<backspace> in char mode altogether.
This is a duplicate of bug #21609 -- any command which directly
modifies the state of the terminal buffer can cause the apparent
state to be out of sync with the 'actual' state (i.e. the state
according to the inferior process).
Should maybe terminal buffers in char-mode=
be read-only? The process filter could then use inhibit-read-only.
=
div>
--001a1142426297781c0541fd1e70--
From unknown Tue Aug 12 08:33:15 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ
Resent-From: Phil Sainty
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 23 Nov 2016 20:10:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 24837
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Philipp Stephani
Cc: 24837@debbugs.gnu.org, 21609@debbugs.gnu.org
Received: via spool by 24837-submit@debbugs.gnu.org id=B24837.147993174712563
(code B ref 24837); Wed, 23 Nov 2016 20:10:02 +0000
Received: (at 24837) by debbugs.gnu.org; 23 Nov 2016 20:09:07 +0000
Received: from localhost ([127.0.0.1]:39581 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1c9dqt-0003GY-II
for submit@debbugs.gnu.org; Wed, 23 Nov 2016 15:09:07 -0500
Received: from [219.88.242.52] (port=41818 helo=mail.orcon.net.nz)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1c9dqq-0003GK-PS; Wed, 23 Nov 2016 15:09:05 -0500
Received: from [192.168.20.100] ([150.107.172.103]) (authenticated bits=0)
by mail.orcon.net.nz (8.14.3/8.14.3/Debian-9.4) with ESMTP id uANK90Dd027754;
Thu, 24 Nov 2016 09:09:01 +1300
References:
From: Phil Sainty
Message-ID: <08c3b161-174d-1fb7-5df4-bbf7f7d47ee9@orcon.net.nz>
Date: Thu, 24 Nov 2016 09:08:59 +1300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.4.0
MIME-Version: 1.0
In-Reply-To:
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Bayes-Prob: 0.0001 (Score 0: No Bayes scoring rules defined,
tokens from: outbound)
X-Spam-Score: -1.73 () [Hold at 3.00] FREEMAIL_FROM:0.001, RDNS_NONE:1.274,
CC(NZ:-3)
X-CanIt-Geo: ip=150.107.172.103; country=NZ; region=Bay of Plenty Region;
city=Tauranga; latitude=-37.6686; longitude=176.2664;
http://maps.google.com/maps?q=-37.6686,176.2664&z=6
X-CanItPRO-Stream: base:outbound
X-Canit-Stats-ID: 02Sbw908P - 71052bd00dcb - 20161124
X-Scanned-By: CanIt (www . roaringpenguin . com)
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: On 24/11/16 08:44,
Philipp Stephani wrote: > Phil Sainty schrieb
am Mo., 31. Okt. 2016 um >> This is a duplicate of bug #21609 -- any command
which directly >> modifies the state of the terminal buffer can cause the
apparent >> state to be out of sync with the 'actual' state (i.e. the state
>> according to the inferior process). > > Should maybe terminal buffers
in char-mode be read-only? The process > filter could then use
inhibit-read-only. [...]
Content analysis details: (1.3 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
(psainty[at]orcon.net.nz)
1.3 RDNS_NONE Delivered to internal network by a host with no rDNS
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: 1.3 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: On 24/11/16 08:44, Philipp Stephani wrote: > Phil Sainty schrieb
am Mo., 31. Okt. 2016 um >> This is a duplicate of bug #21609 -- any command
which directly >> modifies the state of the terminal buffer can cause the
apparent >> state to be out of sync with the 'actual' state (i.e. the state
>> according to the inferior process). > > Should maybe terminal buffers
in char-mode be read-only? The process > filter could then use inhibit-read-only.
[...]
Content analysis details: (1.3 points, 10.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
(psainty[at]orcon.net.nz)
1.3 RDNS_NONE Delivered to internal network by a host with no rDNS
On 24/11/16 08:44, Philipp Stephani wrote:
> Phil Sainty schrieb am Mo., 31. Okt. 2016 um
>> This is a duplicate of bug #21609 -- any command which directly
>> modifies the state of the terminal buffer can cause the apparent
>> state to be out of sync with the 'actual' state (i.e. the state
>> according to the inferior process).
>
> Should maybe terminal buffers in char-mode be read-only? The process
> filter could then use inhibit-read-only.
That's an interesting thought, and may be worth investigating (offhand
I've no idea whether it's workable), but note that it's not sufficient
to deal with all cases -- any Emacs command which moves point can create
an inconsistent state without modifying the buffer contents.
From unknown Tue Aug 12 08:33:15 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ
Resent-From: Philipp Stephani
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 23 Nov 2016 20:23:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 24837
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Phil Sainty
Cc: 24837@debbugs.gnu.org, 21609@debbugs.gnu.org
Received: via spool by 24837-submit@debbugs.gnu.org id=B24837.147993253413905
(code B ref 24837); Wed, 23 Nov 2016 20:23:02 +0000
Received: (at 24837) by debbugs.gnu.org; 23 Nov 2016 20:22:14 +0000
Received: from localhost ([127.0.0.1]:39619 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1c9e3a-0003cC-6i
for submit@debbugs.gnu.org; Wed, 23 Nov 2016 15:22:14 -0500
Received: from mail-wj0-f181.google.com ([209.85.210.181]:36132)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1c9e3Y-0003bu-9y; Wed, 23 Nov 2016 15:22:12 -0500
Received: by mail-wj0-f181.google.com with SMTP id qp4so16745252wjc.3;
Wed, 23 Nov 2016 12:22:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=MJjT6s1TSvffjhcHXj5JQmXzJE0WFD7nBkUgtk77b9I=;
b=GTv8+F+L5C6Qil3oaGQp5laLFIHjfK4+eNiO7Ds7LA41+JKk4x5vveF2ui9USWh9BO
cVaNYXWhL1MSehJthWsK2sg9M/id51fh0sag4R2X5CiYf7B7yGc12B4qMrAJmVrJjj+e
I18WdERLcN9nJBp2R3JrmLcUc+SSPZ608FpazM+t81XdfgzBdmaQS+4sMu4GfQUWSOEZ
v9PP7b3ukQMbo6hqOgOgSC9VkZboCwmoam139cfS3dsiRx2E1n016HcqoCGA0XwwVur0
BYLgen0ejx7Un39Ocnk7BRpmauikuf0Ccpy7ED1CGxes5llNp+nd8GSjyRAjtT86/cy7
dN0g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=MJjT6s1TSvffjhcHXj5JQmXzJE0WFD7nBkUgtk77b9I=;
b=g8+EguP0mqspz8n5ZuBCe6+n58aKbH+padoGGlsYCg7AXUXv2oVUl+2yJG5vvWhnM5
0VVhU3UUalSvtB04+kU2WY/wgzrF1CGYWIu3NqwQQ/srOELZ6CktBUj0cIkp6VZGz3/F
OZeMorVpOnFhlmvow+84tK3jT3GD1Lj5V6klA78tCeL9eTAO8dAbPoYSDcrrn6XT5m/C
szkxyMVLmbY0+lhdN2sR+pfogRWZBqU2DC5YduEPEtv20iMEBtqUJDKgrD+VgiHgOmTU
BRwuAT+V1Wmj73uq8nZE97My3W/nYCyhyz4zRyj+2fu//POzHUZtZrTp1KUQraqx7/l0
yKFw==
X-Gm-Message-State: AKaTC02wcF3n/kh2YFhznHpPYbmSWjZVO0/q4Qp+phy89DI5ErTwFG3DofFQjBcZCAgZuwd1urmrYlBcAZIR/A==
X-Received: by 10.194.95.35 with SMTP id dh3mr5208106wjb.141.1479932526525;
Wed, 23 Nov 2016 12:22:06 -0800 (PST)
MIME-Version: 1.0
References:
<08c3b161-174d-1fb7-5df4-bbf7f7d47ee9@orcon.net.nz>
In-Reply-To: <08c3b161-174d-1fb7-5df4-bbf7f7d47ee9@orcon.net.nz>
From: Philipp Stephani
Date: Wed, 23 Nov 2016 20:21:56 +0000
Message-ID:
Content-Type: multipart/alternative; boundary=047d7bb0405089021a0541fda476
X-Spam-Score: 0.7 (/)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: 0.7 (/)
--047d7bb0405089021a0541fda476
Content-Type: text/plain; charset=UTF-8
Phil Sainty schrieb am Mi., 23. Nov. 2016 um
21:09 Uhr:
> On 24/11/16 08:44, Philipp Stephani wrote:
> > Phil Sainty schrieb am Mo., 31. Okt. 2016 um
> >> This is a duplicate of bug #21609 -- any command which directly
> >> modifies the state of the terminal buffer can cause the apparent
> >> state to be out of sync with the 'actual' state (i.e. the state
> >> according to the inferior process).
> >
> > Should maybe terminal buffers in char-mode be read-only? The process
> > filter could then use inhibit-read-only.
>
> That's an interesting thought, and may be worth investigating (offhand
> I've no idea whether it's workable), but note that it's not sufficient
> to deal with all cases -- any Emacs command which moves point can create
> an inconsistent state without modifying the buffer contents.
>
>
Hmm, then maybe the entire buffer also needs to be made intangible, except
for the actual position of the terminal cursor?
--047d7bb0405089021a0541fda476
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On 24/11/16 08:44, Philipp Stephani wrote:
> Phil Sainty <psainty@orcon.net.nz> schrieb am Mo., 31. Ok=
t. 2016 um
>> This is a duplicate of bug #21609 -- any command which directly
>> modifies the state of the terminal buffer can cause the apparent
>> state to be out of sync with the 'actual' state (i.e. the =
state
>> according to the inferior process).
>
> Should maybe terminal buffers in char-mode be read-only? The process
> filter could then use inhibit-read-only.
That's an interesting thought, and may be worth investigating (offhand<=
br class=3D"gmail_msg">
I've no idea whether it's workable), but note that it's not suf=
ficient
to deal with all cases -- any Emacs command which moves point can create
an inconsistent state without modifying the buffer contents.
Hmm, then maybe th=
e entire buffer also needs to be made intangible, except for the actual pos=
ition of the terminal cursor?=C2=A0
--047d7bb0405089021a0541fda476--
From unknown Tue Aug 12 08:33:15 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ
Resent-From: Eli Zaretskii
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sat, 02 Sep 2017 14:15:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 24837
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Philipp Stephani
Cc: psainty@orcon.net.nz, 24837@debbugs.gnu.org, 21609@debbugs.gnu.org
Reply-To: Eli Zaretskii
Received: via spool by 24837-submit@debbugs.gnu.org id=B24837.150436170013172
(code B ref 24837); Sat, 02 Sep 2017 14:15:02 +0000
Received: (at 24837) by debbugs.gnu.org; 2 Sep 2017 14:15:00 +0000
Received: from localhost ([127.0.0.1]:43540 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1do9CN-0003QO-QT
for submit@debbugs.gnu.org; Sat, 02 Sep 2017 10:15:00 -0400
Received: from eggs.gnu.org ([208.118.235.92]:32793)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from ) id 1do9CM-0003QA-RH
for 24837@debbugs.gnu.org; Sat, 02 Sep 2017 10:14:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from ) id 1do9CD-0004xI-86
for 24837@debbugs.gnu.org; Sat, 02 Sep 2017 10:14:53 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD
autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50670)
by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from )
id 1do9C2-0004qY-SO; Sat, 02 Sep 2017 10:14:38 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2283
helo=home-c4e4a596f7)
by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
(Exim 4.82) (envelope-from )
id 1do9C1-0001Rl-SS; Sat, 02 Sep 2017 10:14:38 -0400
Date: Sat, 02 Sep 2017 17:14:27 +0300
Message-Id: <83val1xk58.fsf@gnu.org>
From: Eli Zaretskii
In-reply-to:
(message from Philipp Stephani on Wed, 23 Nov 2016 20:21:56 +0000)
References:
<08c3b161-174d-1fb7-5df4-bbf7f7d47ee9@orcon.net.nz>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -5.0 (-----)
> From: Philipp Stephani
> Date: Wed, 23 Nov 2016 20:21:56 +0000
> Cc: 24837@debbugs.gnu.org, 21609@debbugs.gnu.org
>
> Phil Sainty schrieb am Mi., 23. Nov. 2016 um 21:09 Uhr:
>
> On 24/11/16 08:44, Philipp Stephani wrote:
> > Phil Sainty schrieb am Mo., 31. Okt. 2016 um
> >> This is a duplicate of bug #21609 -- any command which directly
> >> modifies the state of the terminal buffer can cause the apparent
> >> state to be out of sync with the 'actual' state (i.e. the state
> >> according to the inferior process).
> >
> > Should maybe terminal buffers in char-mode be read-only? The process
> > filter could then use inhibit-read-only.
>
> That's an interesting thought, and may be worth investigating (offhand
> I've no idea whether it's workable), but note that it's not sufficient
> to deal with all cases -- any Emacs command which moves point can create
> an inconsistent state without modifying the buffer contents.
>
> Hmm, then maybe the entire buffer also needs to be made intangible, except for the actual position of the
> terminal cursor?
This bug is currently one of those marked to block the release of
Emacs 26.1. Given that it existed for quite some time, I tend to
remove the blocking status, but if someone has practical ideas how to
fix this, I think we should do that now.
Thanks.
From unknown Tue Aug 12 08:33:15 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ
Resent-From: Phil Sainty
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 03 Sep 2017 02:59:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 24837
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Eli Zaretskii , Philipp Stephani
Cc: 24837@debbugs.gnu.org, 21609@debbugs.gnu.org
Received: via spool by 24837-submit@debbugs.gnu.org id=B24837.15044075186928
(code B ref 24837); Sun, 03 Sep 2017 02:59:02 +0000
Received: (at 24837) by debbugs.gnu.org; 3 Sep 2017 02:58:38 +0000
Received: from localhost ([127.0.0.1]:44413 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1doL7O-0001nb-4a
for submit@debbugs.gnu.org; Sat, 02 Sep 2017 22:58:38 -0400
Received: from smtp-1.orcon.net.nz ([60.234.4.34]:49270)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1doL7M-0001nH-9S; Sat, 02 Sep 2017 22:58:37 -0400
Received: from [150.107.172.82] (port=13875 helo=[192.168.20.102])
by smtp-1.orcon.net.nz with esmtpa (Exim 4.86_2)
(envelope-from )
id 1doL7A-0002Nt-4j; Sun, 03 Sep 2017 14:58:28 +1200
References:
<08c3b161-174d-1fb7-5df4-bbf7f7d47ee9@orcon.net.nz>
<83val1xk58.fsf@gnu.org>
From: Phil Sainty
Message-ID:
Date: Sun, 3 Sep 2017 14:58:23 +1200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <83val1xk58.fsf@gnu.org>
Content-Type: multipart/mixed; boundary="------------B35E7E1C9200B0EC0FA052D9"
Content-Language: en-US
X-GeoIP: NZ
X-Spam_score: -2.9
X-Spam_score_int: -28
X-Spam_bar: --
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.7 (/)
This is a multi-part message in MIME format.
--------------B35E7E1C9200B0EC0FA052D9
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
On 03/09/17 02:14, Eli Zaretskii wrote:
> This bug is currently one of those marked to block the release of
> Emacs 26.1. Given that it existed for quite some time, I tend to
> remove the blocking status, but if someone has practical ideas how
> to fix this, I think we should do that now.
Well here's a starter for discussion.
I've performed only cursory testing, but at first glance this seems
to do the trick, so I'll see what other people think...
Firstly I'm using Philipp Stephani's suggestion that the buffer be
read-only in `term-char-mode' (and removing that in `term-line-mode';
this code doesn't attempt to remember the pre-existing states if
the user had changed it manually). The default term process filter
`term-emulate-terminal' then binds `buffer-read-only' to nil.
Secondly, I've added a local `post-command-hook' function in
`term-char-mode' which simply moves point back to the local process
mark position.
Might such a simple approach be usable? I'm not very familiar with
the code, so maybe there are glaring holes that I'm not seeing.
-Phil
--------------B35E7E1C9200B0EC0FA052D9
Content-Type: text/x-patch;
name="0001-Avoid-creating-inconsistent-buffer-states-in-term-ch.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="0001-Avoid-creating-inconsistent-buffer-states-in-term-ch.pa";
filename*1="tch"
>From edeb0ae7ae6fefe15f277029792617da030c5a9b Mon Sep 17 00:00:00 2001
From: Phil Sainty
Date: Sun, 3 Sep 2017 14:30:18 +1200
Subject: [PATCH] Avoid creating inconsistent buffer states in
`term-char-mode'.
* lisp/term.el (term-char-mode, term-line-mode, term-emulate-terminal):
Make buffer read-only in `term-char-mode' except for the process filter,
and use post-command-hook function `term-goto-process-mark' to avoid
unexpected changes to point.
(term-goto-process-mark): New function.
---
lisp/term.el | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lisp/term.el b/lisp/term.el
index 12a37ca..3ba6ee7 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1246,6 +1246,11 @@ term-char-mode
(easy-menu-add term-terminal-menu)
(easy-menu-add term-signals-menu)
+ ;; Don't allow changes to the buffer or to point which are not
+ ;; caused by the process filter.
+ (read-only-mode 1)
+ (add-hook 'post-command-hook #'term-goto-process-mark nil t)
+
;; Send existing partial line to inferior (without newline).
(let ((pmark (process-mark (get-buffer-process (current-buffer))))
(save-input-sender term-input-sender))
@@ -1265,6 +1270,8 @@ term-line-mode
you type \\[term-send-input] which sends the current line to the inferior."
(interactive)
(when (term-in-char-mode)
+ (read-only-mode 0)
+ (remove-hook 'post-command-hook #'term-goto-process-mark t)
(use-local-map term-old-mode-map)
(term-update-mode-line)))
@@ -2711,6 +2718,7 @@ term-emulate-terminal
count-bytes ; number of bytes
decoded-substring
save-point save-marker old-point temp win
+ buffer-read-only
(buffer-undo-list t)
(selected (selected-window))
last-win
@@ -3109,6 +3117,14 @@ term-emulate-terminal
(when (get-buffer-window (current-buffer))
(redisplay))))
+(defun term-goto-process-mark ()
+ "Move point to the current process-mark for the term buffer process.
+
+Used as a buffer-local `post-command-hook' in `term-char-mode' to
+prevent commands from putting the buffer into an inconsistent
+state by unexpectedly moving point."
+ (goto-char (process-mark (get-buffer-process (current-buffer)))))
+
(defun term-handle-deferred-scroll ()
(let ((count (- (term-current-row) term-height)))
(when (>= count 0)
--
2.8.3
--------------B35E7E1C9200B0EC0FA052D9--
From unknown Tue Aug 12 08:33:15 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#24837: bug#21609: bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ
Resent-From: Phil Sainty
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Sun, 03 Sep 2017 03:10:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 24837
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Eli Zaretskii , Philipp Stephani
Cc: 24837@debbugs.gnu.org, 21609@debbugs.gnu.org
Received: via spool by 24837-submit@debbugs.gnu.org id=B24837.15044081817930
(code B ref 24837); Sun, 03 Sep 2017 03:10:02 +0000
Received: (at 24837) by debbugs.gnu.org; 3 Sep 2017 03:09:41 +0000
Received: from localhost ([127.0.0.1]:44425 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1doLI5-00023l-EU
for submit@debbugs.gnu.org; Sat, 02 Sep 2017 23:09:41 -0400
Received: from smtp-1.orcon.net.nz ([60.234.4.34]:39739)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1doLI3-00023S-SA; Sat, 02 Sep 2017 23:09:40 -0400
Received: from [150.107.172.82] (port=50489 helo=[192.168.20.102])
by smtp-1.orcon.net.nz with esmtpa (Exim 4.86_2)
(envelope-from )
id 1doLHs-0002yD-IY; Sun, 03 Sep 2017 15:09:28 +1200
From: Phil Sainty
References:
<08c3b161-174d-1fb7-5df4-bbf7f7d47ee9@orcon.net.nz>
<83val1xk58.fsf@gnu.org>
Message-ID: <5087b7b4-21e5-090a-5363-a72647c7cd33@orcon.net.nz>
Date: Sun, 3 Sep 2017 15:09:28 +1200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To:
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-GeoIP: NZ
X-Spam_score: -2.9
X-Spam_score_int: -28
X-Spam_bar: --
X-Spam-Score: -0.7 (/)
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: debbugs-submit-bounces@debbugs.gnu.org
Sender: "Debbugs-submit"
X-Spam-Score: -0.7 (/)
On 03/09/17 14:58, Phil Sainty wrote:
> Firstly I'm using Philipp Stephani's suggestion that the buffer be
> read-only in `term-char-mode' [...] The default term process filter
> `term-emulate-terminal' then binds `buffer-read-only' to nil.
In fact Philipp actually suggested binding `inhibit-read-only' in the
process filter, which is presumably preferable.
From unknown Tue Aug 12 08:33:15 2025
X-Loop: help-debbugs@gnu.org
Subject: bug#24837: bug#21609: bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ
Resent-From: Phil Sainty
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Mon, 04 Sep 2017 09:57:02 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 24837
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords:
To: Eli Zaretskii , Philipp Stephani
Cc: 24837@debbugs.gnu.org, 21609@debbugs.gnu.org
Received: via spool by 24837-submit@debbugs.gnu.org id=B24837.15045189738513
(code B ref 24837); Mon, 04 Sep 2017 09:57:02 +0000
Received: (at 24837) by debbugs.gnu.org; 4 Sep 2017 09:56:13 +0000
Received: from localhost ([127.0.0.1]:47718 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1doo72-0002DC-MO
for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:56:12 -0400
Received: from smtp-4.orcon.net.nz ([60.234.4.59]:53229)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1doo70-0002Cm-PZ; Mon, 04 Sep 2017 05:56:11 -0400
Received: from [150.107.172.28] (port=10839 helo=[192.168.20.102])
by smtp-4.orcon.net.nz with esmtpa (Exim 4.86_2)
(envelope-from )
id 1doo6o-0004d7-9j; Mon, 04 Sep 2017 21:55:58 +1200
From: Phil Sainty
References:
<08c3b161-174d-1fb7-5df4-bbf7f7d47ee9@orcon.net.nz>
<83val1xk58.fsf@gnu.org>
Message-ID: