Mats Lidell writes:
(use-local-map (append (make-sparse-keymap) (current-local-map)))
As I get it keymaps are objects in XEmacs so appending them
GNU Emacs also have functions for dealing with keymaps so even
there maybe appending keymaps isn't the best thing!? Maybe use
inheritance there as well?
Dunno. You'd have to ask on emacs-devel. I don't know how they
implement inheritance. Shared list structure may be how they do it.
Is this the proper XEmacs implementation of the code above?
(use-local-map (let ((map (make-sparse-keymap)))
(set-keymap-parent map (current-local-map))
It should work in GNU Emacs as well.
BTW, that `let' shouldn't be necessary. :-/ (But it is.) I really
don't understand why these APIs return the parent(s) (which
necessarily were passed into the code, and so are conveniently
available to the calling code), rather than the new keymap (which
might be created here). Then you could do:
(set-keymap-parent (make-sparse-keymap) (current-local-map)))
Isn't that ever so much nicer?
Finally - Does this code make sense?
Looks good to me.
XEmacs-Beta mailing list