aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Bothner2016-02-24 14:19:17 +1100
committerLars Ingebrigtsen2016-02-24 14:19:17 +1100
commit6ef8c6ceb8ce7289095fa448a6432dbe08f1c508 (patch)
tree6f7712d715a759a0b6da35c418f277ba0da2c152
parent70c3c79ec000bdf43d8558e0ee0fd8d8b8547245 (diff)
downloademacs-6ef8c6ceb8ce7289095fa448a6432dbe08f1c508.tar.gz
emacs-6ef8c6ceb8ce7289095fa448a6432dbe08f1c508.zip
Make `C-{up,down,left,right}' work in term mode
* lisp/term.el (term-raw-map): Define C-{up,down,left,right} to send the same escape sequence that xterm sends. This makes backward-word and forward-word work in readline (bug#16746).
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/term.el8
2 files changed, 12 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index cf121d0eec3..ce84b48e9ab 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1543,6 +1543,10 @@ symbol-function was changed not to signal `void-function' any more.
1543** Comint, term, and compile do not set the EMACS env var any more. 1543** Comint, term, and compile do not set the EMACS env var any more.
1544Use the INSIDE_EMACS environment variable instead. 1544Use the INSIDE_EMACS environment variable instead.
1545 1545
1546** `C-up', `C-down', `C-left' and `C-right' are now defined in term
1547mode to send the same escape sequences that xterm does. This makes
1548things like forward-word in readline work.
1549
1546+++ 1550+++
1547** `save-excursion' does not save&restore the mark any more. 1551** `save-excursion' does not save&restore the mark any more.
1548Use `save-mark-and-excursion' if you want the old behavior. 1552Use `save-mark-and-excursion' if you want the old behavior.
diff --git a/lisp/term.el b/lisp/term.el
index a2e01ed4a29..c1e827875d1 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -834,6 +834,10 @@ is buffer-local."
834 (define-key map [down] 'term-send-down) 834 (define-key map [down] 'term-send-down)
835 (define-key map [right] 'term-send-right) 835 (define-key map [right] 'term-send-right)
836 (define-key map [left] 'term-send-left) 836 (define-key map [left] 'term-send-left)
837 (define-key map [C-up] 'term-send-ctrl-up)
838 (define-key map [C-down] 'term-send-ctrl-down)
839 (define-key map [C-right] 'term-send-ctrl-right)
840 (define-key map [C-left] 'term-send-ctrl-left)
837 (define-key map [delete] 'term-send-del) 841 (define-key map [delete] 'term-send-del)
838 (define-key map [deletechar] 'term-send-del) 842 (define-key map [deletechar] 'term-send-del)
839 (define-key map [backspace] 'term-send-backspace) 843 (define-key map [backspace] 'term-send-backspace)
@@ -1217,6 +1221,10 @@ without any interpretation."
1217(defun term-send-down () (interactive) (term-send-raw-string "\eOB")) 1221(defun term-send-down () (interactive) (term-send-raw-string "\eOB"))
1218(defun term-send-right () (interactive) (term-send-raw-string "\eOC")) 1222(defun term-send-right () (interactive) (term-send-raw-string "\eOC"))
1219(defun term-send-left () (interactive) (term-send-raw-string "\eOD")) 1223(defun term-send-left () (interactive) (term-send-raw-string "\eOD"))
1224(defun term-send-ctrl-up () (interactive) (term-send-raw-string "\e[1;5A"))
1225(defun term-send-ctrl-down () (interactive) (term-send-raw-string "\e[1;5B"))
1226(defun term-send-ctrl-right () (interactive) (term-send-raw-string "\e[1;5C"))
1227(defun term-send-ctrl-left () (interactive) (term-send-raw-string "\e[1;5D"))
1220(defun term-send-home () (interactive) (term-send-raw-string "\e[1~")) 1228(defun term-send-home () (interactive) (term-send-raw-string "\e[1~"))
1221(defun term-send-insert() (interactive) (term-send-raw-string "\e[2~")) 1229(defun term-send-insert() (interactive) (term-send-raw-string "\e[2~"))
1222(defun term-send-end () (interactive) (term-send-raw-string "\e[4~")) 1230(defun term-send-end () (interactive) (term-send-raw-string "\e[4~"))