`equalp' on char tables

Ben Wing ben at 666.com
Mon Feb 1 07:36:31 EST 2010


On Mon, Feb 1, 2010 at 6:10 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> Aidan Kehoe writes:
>
>  >  > But currently `equalp' on keymaps is the same as `equal'. Should that
>  >  > change?
>  >
>  > No; the key sequences "M-? A" and "M-? a" are not semantically the same for
>  > emacs users in the way that "hello" and "Hello", as strings, are.
>
> I agree with Aidan.  Key sequences aren't strings.
>
>

Actually, even for hashtables, `equalp' doesn't compare the keys using
`equalp' but only the values.  The equivalent for a keymap would be
comparing the definitions using `equalp', although that still probably
doesn't make sense as the definitions will either be key sequences or
functions of some sort.  I suppose what *would* make some sense, going
on the definition of `equalp' as comparing for "similarity of
structure" would be to equate key definitions like "\M-x" and [(meta
x)] -- although perhaps that's done already by some appropriate
frobbing in `define-key'.

Answer: no it isn't done already:

(setq x (make-keymap))
#<keymap size 0 0x1c73a5f1>

(define-key x "a" "\M-x")
"ø"

(define-key x "b" [(meta x)])
[(meta x)]

(lookup-key x "a")
"ø"

(lookup-key x "b")
[(meta x)]


If anyone wants to implement this, be my guest.



More information about the XEmacs-Beta mailing list