From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuri Khan Subject: Re: keybindings again... Date: Fri, 30 Jun 2017 13:22:56 +0700 Message-ID: References: <3BA1EFA7-056C-4DD6-8D53-85088F901263@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <3BA1EFA7-056C-4DD6-8D53-85088F901263@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sender: "help-gnu-emacs" To: Jean-Christophe Helary Cc: Help Gnu Emacs mailing list , Org-mode List-Id: emacs-orgmode.gnu.org On Fri, Jun 30, 2017 at 12:10 PM, Jean-Christophe Helary wrote: >> I'm trying to assign M-S-RET to org-insert-todo-heading because for some= reason it is not assigned by default: every time I hit ESC S-RET I get ESC= RET only. >> >> It's the limitation of the terminal. > > Do you mean that Shift is not recognized as a modified key by the termina= l ? A brief recap of terminal limitations, from a guy who has never used a real hardware terminal. The protocol by which a terminal passes keystrokes to an application is that of an ASCII character stream, with only minor extensions (these days it=E2=80=99s a UTF-8-encoded character stream). It predates the notion of keyboard as an interactive input device. In that protocol, there are 32 control characters with codes 0 through 31 (decimal). They are associated with Ctrl+@, Ctrl+A, =E2=80=A6, Ctrl+Z, Ctrl+[, Ctrl+\, Ctrl+], Ctrl+^ and Ctrl+_, and terminals pass these character codes when these key combinations are pressed, with or without Shift. Also, there is the control character 127, sometimes written as Ctrl+?. Additionally, the most frequent of these control characters have been given single keys. These are RET =3D Ctrl+M, TAB =3D Ctrl+I, ESC =3D Ctrl+[= , sometimes BS =3D Ctrl+H, and sometimes DEL =3D Ctrl+?. It follows that many terminals emit identical character codes for C-m, C-M, RET and S-RET; C-i, C-I, TAB and S-TAB; C-[, C-{, ESC and S-ESC; and C-?, DEL and S-DEL; the application running on the other side cannot distinguish them. GUI systems, on the other hand, were developed after keyboards had been available for many years. Thus, most of they do allow applications to distinguish any keys with any modifiers. Some GUI terminal emulators have taken advantage of their GUI nature, and started passing distinct escape sequences for some key combinations. For example, Xterm emits ESC [ Z when I press Shift+Tab. Some GUI terminal emulators also let the user customize which character sequences they send on which keys.