From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Per Bothner Newsgroups: gmane.emacs.bugs Subject: bug#16746: support ctrl-left, ctrl-right etc for term-mode Date: Thu, 13 Feb 2014 13:09:50 -0800 Message-ID: <52FD349E.1030405@bothner.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090600020501090500010407" X-Trace: ger.gmane.org 1392326775 24106 80.91.229.3 (13 Feb 2014 21:26:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Feb 2014 21:26:15 +0000 (UTC) Cc: Jakub Jankiewicz To: 16746@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 13 22:26:21 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WE3nY-0002bS-TY for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Feb 2014 22:26:21 +0100 Original-Received: from localhost ([::1]:48812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE3nY-0002mE-Dg for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Feb 2014 16:26:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE3nO-0002m1-8i for bug-gnu-emacs@gnu.org; Thu, 13 Feb 2014 16:26:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WE3nH-0002Td-4p for bug-gnu-emacs@gnu.org; Thu, 13 Feb 2014 16:26:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50087) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE3nH-0002TT-2Q for bug-gnu-emacs@gnu.org; Thu, 13 Feb 2014 16:26:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WE3nG-0004Fu-IK for bug-gnu-emacs@gnu.org; Thu, 13 Feb 2014 16:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Per Bothner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Feb 2014 21:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16746 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.139232675316338 (code B ref -1); Thu, 13 Feb 2014 21:26:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Feb 2014 21:25:53 +0000 Original-Received: from localhost ([127.0.0.1]:51269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WE3n7-0004FR-37 for submit@debbugs.gnu.org; Thu, 13 Feb 2014 16:25:53 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41659) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WE3ZI-0003r8-Q1 for submit@debbugs.gnu.org; Thu, 13 Feb 2014 16:11:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WE3Z1-0005D7-Cc for submit@debbugs.gnu.org; Thu, 13 Feb 2014 16:11:31 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:59627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE3Z1-0005Cr-9D for submit@debbugs.gnu.org; Thu, 13 Feb 2014 16:11:19 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE3Yv-0007XC-82 for bug-gnu-emacs@gnu.org; Thu, 13 Feb 2014 16:11:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WE3Yp-0005BZ-8h for bug-gnu-emacs@gnu.org; Thu, 13 Feb 2014 16:11:13 -0500 Original-Received: from aibo.runbox.com ([91.220.196.211]:39317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WE3Yp-0005AM-0t for bug-gnu-emacs@gnu.org; Thu, 13 Feb 2014 16:11:07 -0500 Original-Received: from [10.9.9.209] (helo=mailfront04.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1WE3Ym-0007CQ-NV; Thu, 13 Feb 2014 22:11:04 +0100 Original-Received: from 70-36-239-203.dsl.dynamic.sonic.net ([70.36.239.203] helo=localhost.localdomain) by mailfront04.runbox.com with esmtpsa (uid:757155 ) (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) id 1WE3Xe-0000oE-O5; Thu, 13 Feb 2014 22:09:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Thu, 13 Feb 2014 16:25:51 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:85525 Archived-At: This is a multi-part message in MIME format. --------------090600020501090500010407 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit The attached patch translates ctrl-left, ctrl-right, ctrl-up, and ctrl-down to the same escape sequences as xterm sends. This means among other things that ctrl-left and ctrl-right get interpreted as backward-word and forward-word in readline. -- --Per Bothner per@bothner.com http://per.bothner.com/ --------------090600020501090500010407 Content-Type: text/x-patch; name="term-ctrl-arrow.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="term-ctrl-arrow.patch" 2014-02-13 Per Bothner * term.el: Translate C-left, C-right, C-up, C-down to appropriate (xterm-compatible) escape sequences. === modified file 'lisp/term.el' --- lisp/term.el 2014-01-22 10:29:23 +0000 +++ lisp/term.el 2014-02-13 20:17:22 +0000 @@ -887,6 +887,10 @@ (define-key map [down] 'term-send-down) (define-key map [right] 'term-send-right) (define-key map [left] 'term-send-left) + (define-key map [C-up] 'term-send-ctrl-up) + (define-key map [C-down] 'term-send-ctrl-down) + (define-key map [C-right] 'term-send-ctrl-right) + (define-key map [C-left] 'term-send-ctrl-left) (define-key map [delete] 'term-send-del) (define-key map [deletechar] 'term-send-del) (define-key map [backspace] 'term-send-backspace) @@ -1275,6 +1279,10 @@ (defun term-send-down () (interactive) (term-send-raw-string "\eOB")) (defun term-send-right () (interactive) (term-send-raw-string "\eOC")) (defun term-send-left () (interactive) (term-send-raw-string "\eOD")) +(defun term-send-ctrl-up () (interactive) (term-send-raw-string "\e[1;5A")) +(defun term-send-ctrl-down () (interactive) (term-send-raw-string "\e[1;5B")) +(defun term-send-ctrl-right () (interactive) (term-send-raw-string "\e[1;5C")) +(defun term-send-ctrl-left () (interactive) (term-send-raw-string "\e[1;5D")) (defun term-send-home () (interactive) (term-send-raw-string "\e[1~")) (defun term-send-insert() (interactive) (term-send-raw-string "\e[2~")) (defun term-send-end () (interactive) (term-send-raw-string "\e[4~")) --------------090600020501090500010407--