* Keymap / char-table syntax
@ 2012-04-01 5:10 HD
2012-04-05 6:33 ` HD
0 siblings, 1 reply; 3+ messages in thread
From: HD @ 2012-04-01 5:10 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
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: 727 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Keymap / char-table syntax
[not found] <mailman.257.1333259187.20052.help-gnu-emacs@gnu.org>
@ 2012-04-01 8:17 ` Pascal J. Bourguignon
0 siblings, 0 replies; 3+ messages in thread
From: Pascal J. Bourguignon @ 2012-04-01 8:17 UTC (permalink / raw)
To: help-gnu-emacs
HD <heavydeuterium@gmail.com> writes:
> 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?
(info "(elisp) Char-Table Type")
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Keymap / char-table syntax
2012-04-01 5:10 Keymap / char-table syntax HD
@ 2012-04-05 6:33 ` HD
0 siblings, 0 replies; 3+ messages in thread
From: HD @ 2012-04-05 6:33 UTC (permalink / raw)
To: help-gnu-emacs
[-- 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 --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-05 6:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-01 5:10 Keymap / char-table syntax HD
2012-04-05 6:33 ` HD
[not found] <mailman.257.1333259187.20052.help-gnu-emacs@gnu.org>
2012-04-01 8:17 ` Pascal J. Bourguignon
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.