emacs-devel
[Top][All Lists]
Advanced

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

Re: char-table-range


From: Luc Teirlinck
Subject: Re: char-table-range
Date: Wed, 18 Feb 2004 19:28:55 -0600 (CST)

Richard Stallman wrote:

   Is there any other convenient way to get the default value and always
   the default value?  For instance, by using a generic character?

That seems to work.

       I did not realize that currently, for charsets different from ascii and
       eight-bit-{control,graphic}, char-table-range actually returns the
       entire range of values if the value is not uniform.

   That seems like a good thing for it to to.

Yes, but Handa remarked that the return value is given in a form
(sub-char-table) which is not supposed to be exported to Lisp.

I am currently reading the Elisp chapter on sequences.  In the section
on chartables several things are wrongly, incompletely or ambiguously
documented.  I will take care of that, but I do not want to "document"
bugs.

Apart from the problem we are discussing right now, there are two
other things that seem surprising to me about chartables.  I am not
necessarily claiming that they are bugs or misfeatures, I just want to
make sure that they are not before documenting them.

One seems very closely related to what we are currently discussing:

While it does seem possible to get the default value by specifying a
generic character, there is a strange subtle asymmetry between
_setting_ the default value for, say, ipa, and setting the
corresponding generic character (6272 in this case).

Setting the default value using `set-char-table-default' does _not_
override non-nil pre-existing values in the charset _except_ for the
generic character itself.  Setting the generic character itself
overrides the entire charset.  Is this intentional?  If yes, I will
clearly document it (because it is confusing).

The second thing that looks _somewhat_ strange (but maybe it is OK) is
that (make-char-table subtype init) will also set extra slots to INIT.
This is somewhat unexpected because a logical default for characters
would seldom seem to make sense for extra slots as well.  Maybe this
is intentional anyway.  In that case I will document it.

ielm run illustrating all of the above:

===File ~/chartable-ielm====================================
*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (put 'five-slots 'char-table-extra-slots 5)
5
ELISP> (setq cc (make-char-table 'five-slots 2))
#^[t 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 nil five-slots 2 2 2 2 
2]

ELISP> (char-table-extra-slot cc 3)
2
ELISP> (make-char 'ipa)
6272
ELISP> (split-char 6320)
(ipa 48)

ELISP> (aset cc 6320 7)
7
ELISP> (aset cc 6272 1)
1
ELISP> (aref cc 6320)
1
ELISP> (aset cc 6320 7)
7
ELISP> (set-char-table-default cc 6272 8)
8
ELISP> (aref cc 6272)
8
ELISP> (aref cc 6320)
7
ELISP> (char-table-range cc 'ipa)
#^^[nil 8 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 
nil nil nil nil nil nil nil nil nil nil nil 7 nil nil nil nil nil nil nil nil 
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 
nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil 
nil nil nil nil nil nil nil nil nil nil nil]

ELISP> 
============================================================




reply via email to

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