From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Omar Polo Newsgroups: gmane.emacs.help Subject: Re: The correspondence of the command-name and its key-sequence. Date: Sat, 09 Jan 2021 11:00:20 +0100 Message-ID: <87h7nqe8gb.fsf@omarpolo.com> References: <62acbe7b-18f5-4b76-9f05-265218a58db7@default> <87mtxiecxq.fsf@omarpolo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24588"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.13; emacs 28.0.50 Cc: help-gnu-emacs To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 09 11:01:10 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kyB3W-0006Ij-E8 for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 11:01:10 +0100 Original-Received: from localhost ([::1]:34292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyB3V-00042R-Fw for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 05:01:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyB2u-00042G-E2 for help-gnu-emacs@gnu.org; Sat, 09 Jan 2021 05:00:32 -0500 Original-Received: from mail.omarpolo.com ([144.91.116.244]:54907) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyB2q-0004nV-Je for help-gnu-emacs@gnu.org; Sat, 09 Jan 2021 05:00:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omarpolo.com; s=20200327; t=1610186422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G2O0qlpilj1JtvT2kVo5zrJjoSLWGdgs7tQ6UlmV76c=; b=FBmKMRMxekaO8XulzwfhPYhsKaWq4sd7awzcfwWY2aAtjN+voQ1DlDyvYgpDXBlsq5BLHo VmAeWwrCCRMjTnX7VTyJwQyYOq4CYwqwjUhiNLsyudoxZ6KPyvEBCAi1hWZfMqzOzZGLn1 8PJuREK5IiC8RTBC4Db0vJDPpILXcrk= Original-Received: from localhost (host-80-116-112-105.retail.telecomitalia.it [80.116.112.105]) by mail.omarpolo.com (OpenSMTPD) with ESMTPSA id f63c08d3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 9 Jan 2021 11:00:22 +0100 (CET) Original-Received: from venera (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id e857e59a; Sat, 9 Jan 2021 11:00:21 +0100 (CET) In-reply-to: Received-SPF: pass client-ip=144.91.116.244; envelope-from=op@omarpolo.com; helo=mail.omarpolo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127122 Archived-At: Hongyi Zhao writes: > On Sat, Jan 9, 2021 at 4:23 PM Omar Polo wrote: >[..] >> >> You shouldn't mix the hexadecimal and decimal representation of the >> characters. The ASCII characters 0x01-0x1a (inclusive), i.e. the >> characters in the range 1-26 (decimal), are the ctrl- variant of the A-Z >> ASCII characters (0x41-0x5a). > > Why is the ASCII table designed into this strange layout? I have no clue. I wasn't there when they designed it :) >> I don't remember if the following is right, so please correct me if I'm >> wrong, but the keyboards (the old ones I mean) when pressing the ctrl- >> key along with a letter would apply a bitmask on that key. If you look >> at this wikipedia page[0], you'll see that the ASCII character 0x01 >> "Start of Heading" is mapped to C-a. Now, if you look at the byte >> representation of the 'A' character in ASCII it is >> >> 4 1 (decimal) >> 0010 0001 (hexadecimal) >> >> and that SOH is >> >> 0 1 (decimal) >> 0000 0001 (hexadecimal) >> >> >> and so on, B is mapped to to STX, C to ETX, ... G to the BELL character, >> ... I to the hard tab. > > The `man acsii' says the following: > > HT '\t' (horizontal tab) > > Why you describe it as the hard tab? A Freudian slip. I intended to write horizontal tab :) >> So it seems that CTRL(key) is (key & 0xDF). > > I still don=E2=80=99t quite understand how this is derived. it clears the 3rd bit (counting from left to right). For instance, for I <-> tab you get 4 9 (decimal) 0010 1001 (binary) which becomes 0 9 (decimal) 0000 1001 (binary) ^ this one As you can see, that bit get cleared. 0xDF is 1101 1111, so it should "select" every bit but that one. Note that this works even after the Z. [ (that's right after the Z) gets mapped to C-[, which is ESC. \ gets mapped to "field separator" etc ( [ is 0011 1010, ESC is 0001 1010 ) >> (Again, correct me if I'm >> wrong. I recall reading something like this time ago, but I couldn't >> find the source now) >> >> Now, exactly why C-g was chosen for to the keyboard-quit, is something I >> don't know, but the fact that by default it produces a BELL character >> (on ttys at least) may be a hint. >> >> [0]:https://en.wikipedia.org/wiki/C0_and_C1_control_codes#Basic_ASCII_co= ntrol_codes > > Thanks a lot for this interesting and presumably feasible analysis. > > Best,