all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: A question about category name in ELisp
Date: Sun, 06 Oct 2013 18:47:45 +0300	[thread overview]
Message-ID: <83y5665rku.fsf@gnu.org> (raw)
In-Reply-To: <CAAF+z6HTQqSEGB3wmgrEn9r6cqrAzmHcSfaLRfgsSFqmzABJ+Q@mail.gmail.com>

> Date: Sun, 6 Oct 2013 12:04:25 +0800
> From: Xue Fuqiao <xfq.free@gmail.com>
> 
> >> >From the second paragraph, my impression about a category table is
> >> something like this:
> >>
> >> |     | a   | -   | .   | "   |
> >> |-----+-----+-----+-----+-----|
> >> | bv1 | bv2 | bv3 | bv4 | bv5 |
> >>
> >> (The first row contains the indices of the char-table (i.e., the
> >> "index C" above), and the second row contains the elements at index
> >> C1, C2, ... (i.e., it's a category set, which is a bool-vector.))
> >>
> >> As with all arrays, bool-vector indices start from 0, so CAT should be
> >> an integer.  But according to my understanding, CAT is a category
> >> name, which should be an ASCII printing character (instead of just an
> >> integer, from the first paragraph).  Why?  Am I missing something?
> >
> > You need to read about char-table, your assumption about its structure
> > is wrong.  In particular, a char-table is not a flat array, and it is
> > indexed by characters, not by zero-based integers.
> 
> Thanks, but IIUC I think bool-vector (the "category set") is not a
> char-table.  The "category table" is a char-table.

Indeed, and you've drawn a schematics of the category table above,
which is what I was alluding to.  Your picture of the category table
is incorrect, as a char-table is not a flat array.

Another thing that you seem to be missing is that every character is
also a small integer, so a bool-vector of length 128 can be indexed
by any ASCII character.  And a category set is a set of 128 slots, as
you can see by evaluating this:

  (aref (category-table) ?a)

(You can use any ASCII character instead of ?a.)



  reply	other threads:[~2013-10-06 15:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05 10:43 A question about category name in ELisp Xue Fuqiao
2013-10-05 12:41 ` Eli Zaretskii
2013-10-06  4:04   ` Xue Fuqiao
2013-10-06 15:47     ` Eli Zaretskii [this message]
2013-10-07  0:56       ` Xue Fuqiao

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=83y5665rku.fsf@gnu.org \
    --to=eliz@gnu.org \
    --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.