GNU bug report logs -
#24837
26.0.50; term.el: In char mode, displayed and executed commands can differ
Previous Next
Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>
Date: Mon, 31 Oct 2016 14:11:02 UTC
Severity: important
Merged with 21609
Found in versions 24.5, 26.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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))))
This bug report was last modified 7 years and 267 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.