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: Sat, 9 Jan 2021 17:33:39 +0800 Message-ID: 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="31067"; 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 Sat Jan 09 10:34:22 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 1kyAda-0007zH-Hq for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 10:34:22 +0100 Original-Received: from localhost ([::1]:47624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kyAdZ-0003px-Jx for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 09 Jan 2021 04:34:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kyAd8-0003pq-Oc for help-gnu-emacs@gnu.org; Sat, 09 Jan 2021 04:33:54 -0500 Original-Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]:45480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kyAd7-0000MD-2a for help-gnu-emacs@gnu.org; Sat, 09 Jan 2021 04:33:54 -0500 Original-Received: by mail-lf1-x12f.google.com with SMTP id x20so28806267lfe.12 for ; Sat, 09 Jan 2021 01:33:52 -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=4tR4yOeTRcjzwDt0El8kd63aBU6TCFqwzeTELeXyuDo=; b=q+hI+j8Evr8X++AQWHpsc/sAwmCk0vwbOEYXdi9xcZntBBOLnOchHi2C1JQjKQ7sdr r4HSRJu9mb3r2TisIIwg2vrPjrnHMtZ8fxSyb8DalfhYSwIORLLDBhyRkP3QTQcc3KF+ x/f7FsU8blep/MvSDL9ns9lRlqfgYDXMSe5uZa/wNwUYW1vAxxm9a7r9Tdy+QCqsn4lc KwJ4THHPa1jiIWi7z6gnVGbecOmE/71h31nxUmSXt1NBIpbNUiqCZrBJXW7eJu4hcOvu II18Lh1WTt7nS2r2CyAZLbZGTSa+zC4V3V/QsTLrCS3URwzGZIN2rpN8othKKS1RikcA H9aA== 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=4tR4yOeTRcjzwDt0El8kd63aBU6TCFqwzeTELeXyuDo=; b=BzJsIw+ChFT8zlVaWdY/u71GwQIj2H/mb86XbhzkPRY6Vo8ItONrisBcCzcW8/Cynf jd3Gamcn1BOhHSCUO93M6FMaPsScOGuBNPmQ+tvesvwE2W1ra3d8a9sFdZdTsGqT6CD6 PH7w7sOwSgn+kLhXVRtGBGgNu1dpwWMzij+yQPfKAikw8WKRVbCZ+3arbhh71McA4eXa RMaJwxudw5mSOTwHY0cY8EjOoIqMjh94kOP30fRlc+BC52Yl/jF0S6GG6JmAGVuVin7O t8Ky67I4rQRuqE4uL+RPxR6WGIweGRLv9UyTkyWoz/92KXk05F29zx0cCfChqVwroKJg GRmA== X-Gm-Message-State: AOAM5338CC3ms25i1PeOLDmIGB1qvql4dKO8i61iL+79NrmoWdCKXKEt A+8bIxZF+jXb1dlQodCZOEN3T735Y7iLINXBT5Y= X-Google-Smtp-Source: ABdhPJxWbSAx5nU0R6kMTdVjWmgh/gTdL29wi18qu0YZeAG/QSd5u8LqAwy9X79M92NlVoq1B1saB5ndC5nfb9tCB2I= X-Received: by 2002:a2e:96cc:: with SMTP id d12mr3081037ljj.246.1610184831187; Sat, 09 Jan 2021 01:33:51 -0800 (PST) In-Reply-To: <87mtxiecxq.fsf@omarpolo.com> Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=hongyi.zhao@gmail.com; helo=mail-lf1-x12f.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:127121 Archived-At: On Sat, Jan 9, 2021 at 4:23 PM Omar Polo wrote: > > > Hongyi Zhao writes: > > > On Sat, Jan 9, 2021 at 2:34 PM Drew Adams wrote= : > >> > >> > But, it's still very hard for me to understand the correspondence of > >> > the command-name and its key-sequence. To summarize, why use C-g to > >> > represent the command keyboard-quit, instead of other more directly > >> > related forms, say, C-q. > >> > >> I think you're asking why `C-g' is used for quitting/canceling an acti= on, instead of, for example `C-q' (since `q' is mnemonic for "quit"). > > > > That's exactly what I mean. > > q is also a mnemonic for "quote" which, given the lisp background, seems > appropriate ;) > > C-h C-q > > > C-q runs the command quoted-insert [...] > > >> [.. lots of interesting information about the bell characters ..] > >> > >> "For example, the character or "G", whose ASCII code is 71 in base 10,= or 100 0111 in binary, would be transformed into the binary code 000 0111 = (7 in decimal), which is assigned to the bell character." > > > > I find another may be far-fetched relation based on your above > > notes/hints/comments: > > > > werner@X10DAi:~$ printf "%d %x\n" "'q" "'q" > > 113 71 > > werner@X10DAi:~$ printf "%d %x\n" "'G" "'G" > > 71 47 > > > > As you can see, the hexadecimal point code of "q" is the same as the > > decimal point code of "G" in form. > > > > BR, > > 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 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? > > So it seems that CTRL(key) is (key & 0xDF). I still don=E2=80=99t quite understand how this is derived. > (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_con= trol_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