From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ Date: Tue, 01 Nov 2016 09:46:32 +1300 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1477946863 31039 195.159.176.226 (31 Oct 2016 20:47:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 31 Oct 2016 20:47:43 +0000 (UTC) User-Agent: Orcon Webmail Cc: 24837@debbugs.gnu.org, bug-gnu-emacs To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 31 21:47:39 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1JU7-0004OF-Eb for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Oct 2016 21:47:11 +0100 Original-Received: from localhost ([::1]:38511 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1JU9-0003yE-Uo for geb-bug-gnu-emacs@m.gmane.org; Mon, 31 Oct 2016 16:47:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1JU3-0003xx-ML for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2016 16:47:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1JTy-0006bg-Nz for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2016 16:47:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51193) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c1JTy-0006ba-Ju for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2016 16:47:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c1JTy-0008Vy-DB for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2016 16:47:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2016 20:47: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: Original-Received: via spool by 24837-submit@debbugs.gnu.org id=B24837.147794680132699 (code B ref 24837); Mon, 31 Oct 2016 20:47:02 +0000 Original-Received: (at 24837) by debbugs.gnu.org; 31 Oct 2016 20:46:41 +0000 Original-Received: from localhost ([127.0.0.1]:38359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1JTd-0008VL-HM for submit@debbugs.gnu.org; Mon, 31 Oct 2016 16:46:41 -0400 Original-Received: from [219.88.242.59] (port=38669 helo=mail.orcon.net.nz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c1JTb-0008V8-9v for 24837@debbugs.gnu.org; Mon, 31 Oct 2016 16:46:40 -0400 Original-Received: from webmail-1.orcon.net.nz ([10.253.37.40]) by mail.orcon.net.nz (8.14.3/8.14.3/Debian-9.4) with ESMTP id u9VKkWSa046494; Tue, 1 Nov 2016 09:46:32 +1300 Original-Received: from mail.orcon.net.nz (localhost [IPv6:::1]) by webmail-1.orcon.net.nz (Postfix) with ESMTP id 3DE8F201F0B0; Tue, 1 Nov 2016 09:46:32 +1300 (NZDT) Original-Received: from wlg-office-ffw.catalyst.net.nz ([202.78.240.7]) via [10.253.37.253] by mail.orcon.net.nz with HTTP (HTTP/1.1 POST); Tue, 01 Nov 2016 09:46:32 +1300 In-Reply-To: X-Sender: psainty@orcon.net.nz X-Bayes-Prob: 0.0001 (Score 0: No Bayes scoring rules defined, tokens from: outbound) X-CanIt-Geo: ip=202.78.240.7; country=NZ; latitude=-41.0000; longitude=174.0000; http://maps.google.com/maps?q=-41.0000,174.0000&z=6 X-CanItPRO-Stream: base:outbound X-Canit-Stats-ID: 02S2kKwce - 3939be640f2e - 20161101 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 10.250.8.6 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:125189 Archived-At: 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- the same command > that is displayed is sent to the shell, or it should disable > C- 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). In my own config I use the following, and something along these lines might form a useful solution? It would be convenient if there was a symbol property to identify standard commands which should be disabled, but that may well be excessive/unworkable in practice. For killing and yanking text, many cases might be accounted for by detecting the issue within `kill-region' and `insert-for-yank' respectively. That isn't comprehensive (at minimum rectangles are different), but might still be worth considering. (eval-after-load "term" '(progn ;; Fix forward/backward word when (term-in-char-mode). (define-key term-raw-map (kbd "") (lambda () (interactive) (term-send-raw-string "\eb"))) (define-key term-raw-map (kbd "") (lambda () (interactive) (term-send-raw-string "\eb"))) (define-key term-raw-map (kbd "") (lambda () (interactive) (term-send-raw-string "\ef"))) (define-key term-raw-map (kbd "") (lambda () (interactive) (term-send-raw-string "\ef"))) ;; Disable killing and yanking in char mode (term-raw-map). (mapc (lambda (func) (eval `(define-key term-raw-map [remap ,func] (lambda () (interactive) (ding))))) '(backward-kill-paragraph backward-kill-sentence backward-kill-sexp backward-kill-word bookmark-kill-line kill-backward-chars kill-backward-up-list kill-forward-chars kill-line kill-paragraph kill-rectangle kill-region kill-sentence kill-sexp kill-visual-line kill-whole-line kill-word subword-backward-kill subword-kill yank yank-pop yank-rectangle))))