From: Xue Fuqiao <xfq.free@gmail.com>
To: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: A question about category name in ELisp
Date: Sun, 6 Oct 2013 12:04:25 +0800 [thread overview]
Message-ID: <CAAF+z6HTQqSEGB3wmgrEn9r6cqrAzmHcSfaLRfgsSFqmzABJ+Q@mail.gmail.com> (raw)
In-Reply-To: <83k3hr7uvk.fsf@gnu.org>
On Sat, Oct 5, 2013 at 8:41 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Sat, 5 Oct 2013 18:43:27 +0800
>> From: Xue Fuqiao <xfq.free@gmail.com>
>>
>> I have a question about category and category table. In (info
>> "(elisp) Categories"):
>>
>> Each category has a name, which is an ASCII printing character in
>> the range ‘ ’ to ‘~’. You specify the name of a category when you
>> define it with ‘define-category’.
>> The category table is actually a char-table (*note Char-Tables::).
>> The element of the category table at index C is a "category set"—a
>> bool-vector—that indicates which categories character C belongs to.
>> In this category set, if the element at index CAT is ‘t’, that means
>> category CAT is a member of the set, and that character C belongs to
>> category CAT.
>>
>> >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.
--
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/
next prev parent reply other threads:[~2013-10-06 4:04 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 [this message]
2013-10-06 15:47 ` Eli Zaretskii
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=CAAF+z6HTQqSEGB3wmgrEn9r6cqrAzmHcSfaLRfgsSFqmzABJ+Q@mail.gmail.com \
--to=xfq.free@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.