Path: utzoo!attcan!uunet!peregrine!elroy!ames!oliveb!sun!breakpoint!jpayne From: jpayne%breakpoint@Sun.COM (Jonathan Payne) Newsgroups: comp.emacs Subject: theory of keymaps Message-ID: <62324@sun.uucp> Date: 1 Aug 88 22:13:18 GMT Sender: news@sun.uucp Lines: 28 Could somebody explain to be how keymaps work in GNU or Gosling's? In particular, how does local-bind-to-key (or whatever it's called in GNU) work? Does each buffer have a keymap associated with it? If that's so, does it first copy the current global bindings into the local map, and then let you munge around with that local map? Is it a deep copy? See, here's my problem. I wanted to have a keymap associated with buffers that have processes attached to them. But that map is only going to have a few bindings in it, probably (perhaps I really want sparse keymaps, but that's irrelavent to this discussion), since it's just for the few commands that do things differently when they are in process buffers. Anyway, so I was going to read a character, look it up in the process keymap (if appropriate), and if there was something there, execute it. If there was nothing there, then I would try the main keymap. If there was nothing there I would complain. But, what if somebody binds eof-process to ESC C-D. That means that the process keymap has to bind a keymap to the ESC key of the process keymap, and then fill in the slot for C-D. That's fine. But then suppose the user types ESC C-F. It would look up ESC in the proc map and it would be fine, so it would then look for C-F but there would be nothing. But ESC C-F is a perfectly valid key in the mainmap. So, then what? Do I save the keystrokes and try again in the mainmap? Seems pretty fishy to me. So, when I create a local keymap, maybe I should (deep?) copy the main keymap, but then subsequent changes to the main keymap will not be seen by the local keymap ... so ... right. This is confusing me a lot. Perhaps local keymaps shouldn't be whole keymaps in themselves, but rather, specifications of substitutions to make into the main keymap ... I don't know. Can anybody out there clear this up for me?