[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keymap / char-table syntax

From: HD
Subject: Re: Keymap / char-table syntax
Date: Wed, 4 Apr 2012 23:33:53 -0700

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.
(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 <address@hidden> wrote:
When I evaluate "(pp esc-map)" it pretty-prints a keymap that starts with the lines

 #^[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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]