unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: 24837@debbugs.gnu.org,
	bug-gnu-emacs
	<bug-gnu-emacs-bounces+psainty=orcon.net.nz@gnu.org>
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	[thread overview]
Message-ID: <a35b435658a9e801aa49f43d393f02f6@mail.orcon.net.nz> (raw)
In-Reply-To: <wvr4twbsfw2z.fsf@a.muc.corp.google.com>

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).

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 "<C-left>")
        (lambda () (interactive) (term-send-raw-string "\eb")))
      (define-key term-raw-map (kbd "<M-left>")
        (lambda () (interactive) (term-send-raw-string "\eb")))
      (define-key term-raw-map (kbd "<C-right>")
        (lambda () (interactive) (term-send-raw-string "\ef")))
      (define-key term-raw-map (kbd "<M-right>")
        (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))))







  reply	other threads:[~2016-10-31 20:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-31 14:10 bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ Philipp Stephani
2016-10-31 20:46 ` Phil Sainty [this message]
2016-11-23 19:44   ` Philipp Stephani
2016-11-23 20:08     ` bug#21609: " Phil Sainty
2016-11-23 20:21       ` Philipp Stephani
2017-09-02 14:14         ` Eli Zaretskii
2017-09-03  2:58           ` Phil Sainty
2017-09-03  3:09             ` bug#21609: " Phil Sainty
2017-09-04  9:55             ` Phil Sainty
2017-09-04 10:10               ` bug#24837: " Phil Sainty
2017-09-04 11:59                 ` bug#21609: " Phil Sainty
2017-09-24 10:59             ` Philipp Stephani
2017-09-25  0:48               ` bug#21609: " Phil Sainty
2017-09-25  3:09                 ` Phil Sainty
2017-09-29  8:37                   ` Eli Zaretskii
2017-10-08 12:39                     ` bug#21609: " Phil Sainty
2017-10-09 14:04                       ` Phil Sainty
2017-10-09 15:32                         ` Eli Zaretskii
2017-10-10 10:16                           ` bug#28777: Clarifying the temporary documentation update marks in etc/NEWS Phil Sainty
2017-10-10 12:25                             ` Eli Zaretskii
2017-10-10 11:11                           ` bug#24837: bug#21609: bug#24837: 26.0.50; term.el: In char mode, displayed and executed commands can differ Phil Sainty
2017-10-10 12:35                             ` Eli Zaretskii
2017-10-12 10:54                               ` Phil Sainty
2017-10-12 12:04                                 ` bug#21609: " Eli Zaretskii
2017-10-21  8:20                                 ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=a35b435658a9e801aa49f43d393f02f6@mail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=24837@debbugs.gnu.org \
    --cc=bug-gnu-emacs-bounces+psainty=orcon.net.nz@gnu.org \
    --cc=p.stephani2@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).