From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: The correspondence of the command-name and its key-sequence. Date: Mon, 11 Jan 2021 16:04:19 +0800 Message-ID: References: <62acbe7b-18f5-4b76-9f05-265218a58db7@default> <87mtxiecxq.fsf@omarpolo.com> <87h7nqe8gb.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="18525"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Omar Polo Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 11 09:04:55 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 1kysC7-0004i7-Mi for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 09:04:55 +0100 Original-Received: from localhost ([::1]:46720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kysC6-0003wQ-O8 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 11 Jan 2021 03:04:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kysBl-0003wJ-Gc for help-gnu-emacs@gnu.org; Mon, 11 Jan 2021 03:04:33 -0500 Original-Received: from mail-yb1-xb33.google.com ([2607:f8b0:4864:20::b33]:33676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kysBj-00026F-Nz for help-gnu-emacs@gnu.org; Mon, 11 Jan 2021 03:04:33 -0500 Original-Received: by mail-yb1-xb33.google.com with SMTP id o144so16112761ybc.0 for ; Mon, 11 Jan 2021 00:04:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=lxYFdXpfQ3tn+0z3V/LEsW7eR6qQwCPvyly/PYT2xh8=; b=FB/TSFWLZZG5pJSU2K7fD2ty+tnlWeQC83frj5FyfN5AeU32tmrn0XqEFjbcYcnfnm edSaew8p6T2g3hzcunBq69I/lDqW+n3vq4D96KY7UAyMOpPTNqIKdIorVrWZlZqCyq5M S2igAA0B/4nU2/wRXjhW84IJZJWZv5EDy8R6M++LE1JrweL3LMWg+l1Necldu2JxMwce qjmEd1S7vYw3EZkVIJKpqyVUGcwd6jRCxy7oVnbs5pJDyC7I5mFcRdEQ2u8ft8Smz4Cr dH5HcnTQ8nDirj8Bb5krKFyvbV96cLB8HRXWn4BRMeusOYsR+KV+G2yaEX25HVKFETXj wpUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=lxYFdXpfQ3tn+0z3V/LEsW7eR6qQwCPvyly/PYT2xh8=; b=qrQtreodObTQigybqcML/J3NQhK0fq+G6+DDLlVE9csGnH9TjWJAx+qVSu6s+A6pOz 8yFW9/zsnVucEq+xN2/riUNhPrpSI2e/2r9dKpEF7nQWQMIPqzVg4WnrVQOx57KwMur9 G8KXY5iYwOOLN3TJAWDcLhkucNkFc6qIDYW38VdlYDoi8pZJEnKWVeygBMgA0KVGsMOy fzE9e4+rZ8fsReh79lCLCSV9O2z3JYqRT4chqykHXC8oY8nEDjU4TJvoL/00meynf24l ZMrWS+2IdBPXJ8WzGvB2t79KEBmTtotJBoLjHnCy/Zw4JimkDTEsNrx3e+8RTPJhDGU0 gIpg== X-Gm-Message-State: AOAM530SgRH3qIikW1hxfgWTQyCG2f7pi82ymHKSZ72RPWc7hxFJW9E/ EdYd+Im+o0PxPVdxPKdx8E5ko20U2ttAyk22DX8= X-Google-Smtp-Source: ABdhPJwDiQHSyAnUlVmXDy87ZfcgkgpA+nWr+sp/DdpVLBB0DwWTTECtzwwO+qlgf93M6y+9QKsaDa9Oi+zt5qdAcX0= X-Received: by 2002:a25:1386:: with SMTP id 128mr21967301ybt.374.1610352270486; Mon, 11 Jan 2021 00:04:30 -0800 (PST) In-Reply-To: <87h7nqe8gb.fsf@omarpolo.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::b33; envelope-from=hongyi.zhao@gmail.com; helo=mail-yb1-xb33.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:127179 Archived-At: On Sat, Jan 9, 2021 at 6:00 PM Omar Polo wrote: > > > 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 loo= k > >> 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 characte= r, > >> ... 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 Why the \ has two forms in the ascii document as shown below: $ man ascii | grep -F '\\' 034 28 1C FS (file separator) 134 92 5C \ '= \\' As you can see, the document gives two forms of it: \ '\\' > > ( [ 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_= control_codes > > > > Thanks a lot for this interesting and presumably feasible analysis. > > > > Best, > --=20 Assoc. Prof. Hongyi Zhao Theory and Simulation of Materials Hebei Polytechnic University of Science and Technology engineering NO. 552 North Gangtie Road, Xingtai, China