help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: What is the type of user input?


From: Hattuari
Subject: Re: What is the type of user input?
Date: Fri, 29 Oct 2004 01:54:36 -0400
User-agent: KNode/0.8.1

Kevin Rodgers wrote:

> Hattuari wrote:
>  > Kevin Rodgers wrote:
>  >>gl-type is a string.  Since the paste-gl-type-map property list is
>  >>keyed by symbols, plist-get returns nil.
>  >
>  > That's what I was missing.  I was assuming that 'symbol-name implicitly
>  > meant symbol would evaluate to a string.  Now that I've read the first
>  > several chapters of the Elisp Reference Manual, I have a better idea of
>  > what's going on.
> 
> 'foo is equivalent to (quote foo), which is the symbol whose name is
> "foo".

That's what the book says.

>  > I opted for trying an association array, which also worked.
> 
> I assume you mean association list. 

Yes.  I'm accustomed to thinking in terms of associative arrays, and I guess
force of habit got the better of me.

> But whether you have a (KEY-1 
> VALUE-1 ... KEY-N VALUE-N) property list where they keys are by
> definition symbols or a ((KEY-1 . VALUE-1) ... (KEY-N . VALUE-N)) alist
> where the keys can be arbitrary lisp objects, 

Actually, according to the documentation the key can be  


,----[ §8.4 Property Lists ]
|  The property names and values in a property list can be any Lisp
|  objects, but the names are usually symbols.
`----

> you still have to make
> sure that you pass a key of the correct type to plist-get or assoc,
> respectively.

In the case of plists I guess that's a direct consequence of the requirement
that the key used for lookup has to be the actual object used as the key in
the plist.

>  > I will try your suggestion of using (intern gl-type).  As for reading
>  > gl-type with %S, I'm not sure what that would do for me.  The only use
>  > I know for that is to use it in a string format.
> 
> Oops, I meant S.  (You used s in the interactive spec to read gl-type as
> a string; using S would bind gl-type to the intern'ed symbol.)

Can you provide a reference in the documentation where this use of 'S' is
described?  The only places I'm aware of where 'S' is used as a means of
handling data associated with interactive forms is in formatting strings.
>  > That doesn't tell me anything that I see as addressing my problem.
> Can you
>  > explain how that answers my question as to why the two symbols were not
>  > comparing as I had expected?
> 
> You assumed that since the symbol and the string looked the same when
> displayed in the echo area by (message "%s" ...), that they were
> actually the same. 

No.  What I assumed is that a quoted symbol would evaluate to a string when
looking for keys in a plist. 

-- 
p->m == (*p).m == p[0].m


reply via email to

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