From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: HD Newsgroups: gmane.emacs.help Subject: Re: Keymap / char-table syntax Date: Wed, 4 Apr 2012 23:33:53 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8f6436b04929c604bce8b93f X-Trace: dough.gmane.org 1333607732 15333 80.91.229.3 (5 Apr 2012 06:35:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 Apr 2012 06:35:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Apr 05 08:35:31 2012 Return-path: Envelope-to: geh-help-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 1SFgI6-0002i2-Au for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Apr 2012 08:35:30 +0200 Original-Received: from localhost ([::1]:37583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFgGn-0007BY-0a for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Apr 2012 02:34:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFgGf-0007BO-TI for help-gnu-emacs@gnu.org; Thu, 05 Apr 2012 02:34:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SFgGa-0002NP-TE for help-gnu-emacs@gnu.org; Thu, 05 Apr 2012 02:34:01 -0400 Original-Received: from mail-ob0-f169.google.com ([209.85.214.169]:38860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SFgGa-0002L3-JP for help-gnu-emacs@gnu.org; Thu, 05 Apr 2012 02:33:56 -0400 Original-Received: by obbta14 with SMTP id ta14so1675231obb.0 for ; Wed, 04 Apr 2012 23:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=opR3WajXHCVNKrTbaDSa3RY0ziRJJiqRagulAIvnIZQ=; b=Zjwg4N3ezwsrro8EUvRGtO267vzGlEOBKUJE/Y7cpv2Bn9KWYVpNDO9Qy2CjGVXVGo 29OBn+xbHpsVV96nSfnXnrGdnPT1yf1zUuex8wggs6LUzZXE/Zo2T7bVZfsUFZSdPmOb fi/tt7HeSjuR8y8eGRpXSrVDijMBrO8NnNf7svywq5vHizRGctyYRGvikWOJ7j4IVvkM hQjoz4aOB0EHcEPh0D9yJWisVk0mQ4ZOmneHZbiDaFfeIXOGTq1aV9MjP+6V6FQwTDtf 3EmAxRuvLcNWATG30tL8mr0A2XLafcfUKMh84TEs4sJvV4nZ4IyD0pDheciKgwBkLU2o Ermw== Original-Received: by 10.182.202.104 with SMTP id kh8mr1918962obc.1.1333607633856; Wed, 04 Apr 2012 23:33:53 -0700 (PDT) Original-Received: by 10.182.55.131 with HTTP; Wed, 4 Apr 2012 23:33:53 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84335 Archived-At: --e89a8f6436b04929c604bce8b93f Content-Type: text/plain; charset=ISO-8859-1 Ok. Still working on this... Looking in the source of src/print.c I found the definition of "#^^[" it signifies a sub char-table, as I sort of suspected by the pp command's indentation.. Here's print.c if (CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)) { /* We print a char-table as if it were a vector, lumping the parent and default slots in with the character slots. But we add #^ as a prefix. */ /* Make each lowest sub_char_table start a new line. Otherwise we'll make a line extremely long, which results in slow redisplay. */ if (SUB_CHAR_TABLE_P (obj) && XINT (XSUB_CHAR_TABLE (obj)->depth) == 3) PRINTCHAR ('\n'); PRINTCHAR ('#'); PRINTCHAR ('^'); if (SUB_CHAR_TABLE_P (obj)) PRINTCHAR ('^'); <---- The second caret! aha .... Then from lisp.h... /* Depth of this sub char-table. It should be 1, 2, or 3. A sub char-table of depth 1 contains 16 elments, and each element covers 4096 (128*32) characters. A sub char-table of depth 2 contains 32 elements, and each element covers 128 characters. A sub char-table of depth 3 contains 128 elements, and each element is for one character. */ Lisp_Object depth; OK, so the contents of the esc-map, a standard keymap, use this as mentioned in my first post. eg (pp esc-map) => "(keymap #^[ nil nil keymap #^^[3 0 mark-sexp beginning-of-defun ....)" and then (aref (nth 1 esc-map) 0) => mark-sexp What i don't understand is why when i use aref to fetch the 0th element of the char-table as above, why it returns the 0th element of the sub-char table. This does not seem to be in either the elisp or emacs manual as Pascal B was quick to assume. I feel like it's a long shot- but does anyone have any answers? On Sat, Mar 31, 2012 at 10:10 PM, HD wrote: > Hello. > When I evaluate "(pp esc-map)" it pretty-prints a keymap that starts with > the lines > > (keymap > #^[nil nil keymap > #^^[3 0 mark-sexp beginning-of-defun backward-sexp ... > > ...and so on > > Can someone explain this syntax? > eg Why is keymap the 3rd element in the char-table, and what does the "nil > nil" before it signify? > What is "#^^[3 0" ? What do the 3 and 0 mean here? > > why does "(aref (nth 1 esc-map) 0)" return "mark-sexp"? > > I couldn't find answers in the manuals for emacs or elisp, except maybe > that "#^[ nil nil keymap" means character code 3 corresponds to a keymap in > this char-table > > -HD > --e89a8f6436b04929c604bce8b93f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Ok. Still working on this...
Looking in the source of src/print.c I fou= nd the definition of "#^^["=A0 it signifies a sub char-table, as = I sort of suspected by the pp command's indentation..

Here's= print.c

=A0=A0=A0 =A0 if (CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj))
=A0=A0=A0 =A0=A0=A0 {
=A0=A0=A0 =A0=A0=A0=A0=A0 /* We print a char-table= as if it were a vector,
=A0=A0=A0 =A0=A0=A0 =A0lumping the parent and d= efault slots in with the
=A0=A0=A0 =A0=A0=A0 =A0character slots.=A0 But = we add #^ as a prefix.=A0 */

=A0=A0=A0 =A0=A0=A0=A0=A0 /* Make each = lowest sub_char_table start a new line.
=A0=A0=A0 =A0=A0=A0 =A0Otherwise we'll make a line extremely long, whic= h
=A0=A0=A0 =A0=A0=A0 =A0results in slow redisplay.=A0 */
=A0=A0=A0 = =A0=A0=A0=A0=A0 if (SUB_CHAR_TABLE_P (obj)
=A0=A0=A0 =A0=A0=A0 =A0 &= & XINT (XSUB_CHAR_TABLE (obj)->depth) =3D=3D 3)
=A0=A0=A0 =A0=A0= =A0 PRINTCHAR ('\n');
=A0=A0=A0 =A0=A0=A0=A0=A0 PRINTCHAR ('#');
=A0=A0=A0 =A0=A0=A0= =A0=A0 PRINTCHAR ('^');
=A0=A0=A0 =A0=A0=A0=A0=A0 if (SUB_CHAR_T= ABLE_P (obj))
=A0=A0=A0 =A0=A0=A0 PRINTCHAR ('^');=A0=A0=A0=A0= =A0 <---- The second caret! aha
....


Then from lisp.h... =A0=A0=A0 /* Depth of this sub char-table.=A0 It should be 1, 2, or 3.=A0 A= sub
=A0=A0=A0=A0=A0=A0 char-table of depth 1 contains 16 elments, and e= ach element
=A0=A0=A0=A0=A0=A0 covers 4096 (128*32) characters.=A0 A sub= char-table of depth 2
=A0=A0=A0=A0=A0=A0 contains 32 elements, and each= element covers 128 characters.=A0 A
=A0=A0=A0=A0=A0=A0 sub char-table of depth 3 contains 128 elements, and eac= h element
=A0=A0=A0=A0=A0=A0 is for one character.=A0 */
=A0=A0=A0 Li= sp_Object depth;

OK, so the contents of the esc-map, a standard keym= ap, use this as mentioned in my first post.
eg
(pp esc-map)
=A0=3D> "(keymap #^[ nil nil keymap=A0 #^^[3 = 0 mark-sexp beginning-of-defun ....)"

and then
(aref (nth 1 = esc-map) 0)
=3D> mark-sexp

What i don't understand is why = when i use aref to fetch the 0th element of the char-table as above, why it= returns the 0th element of the sub-char table.

This does not seem to be in either the elisp or emacs manual as Pascal = B was quick to assume.


I feel like it's a long shot- but doe= s anyone have any answers?


On Sat, Mar 31, 2012 at 10:10 PM, HD <heavydeuterium@gmail.com&= gt; wrote:
Hello.
When I evaluate "(pp esc-map)" it pretty-prints a keyma= p that starts with the lines

(keymap
=A0#^[nil nil keymap
=A0= =A0=A0 #^^[3 0 mark-sexp beginning-of-defun backward-sexp ...

...and= so on

Can someone explain this syntax?
eg Why is keymap the 3rd element in= the char-table, and what does the "nil nil" before it signify?What is "#^^[3 0" ? What do the 3 and 0 mean here?

why does "(aref (nth 1 esc-map) 0)" return "mark-sexp"?=

I couldn't find answers in the manuals for emacs or elisp, except m= aybe that "#^[ nil nil keymap" means character code 3 corresponds= to a keymap in this char-table

-HD

--e89a8f6436b04929c604bce8b93f--