all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: HD <heavydeuterium@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Keymap / char-table syntax
Date: Wed, 4 Apr 2012 23:33:53 -0700	[thread overview]
Message-ID: <CAHW1dShKFymkAsfZ=M=F4j8z0FNGWeNm0g+WXHnH+xDKHsZUHg@mail.gmail.com> (raw)
In-Reply-To: <CAHW1dSgKmPXmx+h4rtV38xZn+2_V=kNLpHhoH0MDjYPag_tsEQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2581 bytes --]

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 <heavydeuterium@gmail.com> 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
>

[-- Attachment #2: Type: text/html, Size: 3235 bytes --]

  reply	other threads:[~2012-04-05  6:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-01  5:10 Keymap / char-table syntax HD
2012-04-05  6:33 ` HD [this message]
     [not found] <mailman.257.1333259187.20052.help-gnu-emacs@gnu.org>
2012-04-01  8:17 ` Pascal J. Bourguignon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHW1dShKFymkAsfZ=M=F4j8z0FNGWeNm0g+WXHnH+xDKHsZUHg@mail.gmail.com' \
    --to=heavydeuterium@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.