[gnu.emacs.bug] Running info screws up text-mode bindings; copy-keymap alternative

ram-ashwin@YALE.ARPA (Ashwin Ram) (11/04/88)

GNU Emacs 18.48.0 of Thu Oct 27 1988 on leo.ring.cs.yale.edu (domain/ix)

When I do a M-x info, the ^C^C binding in my text-mode buffers gets screwed
up (it puts the text-mode buffer into info-mode).  Presumably the problem is
with the following code in lisp/info.el:

(defvar Info-edit-map nil
  "Local keymap used within `e' command of Info.")
(if Info-edit-map
    nil
  (setq Info-edit-map (copy-keymap text-mode-map))
  (define-key Info-edit-map "\C-c\C-c" 'Info-cease-edit))

Info-edit-map should be independent of text-mode-map, but copy-keymap does
not do this correctly.

-----

Situations like this occur pretty often (e.g., TeX-shell is a copy of
shell-mode).  Rather than making a deep copy of a keymap just to change one
or two bindings (inefficient), or using a shallow copy (incorrect), why not
allow a keymap to have a "superior" keymap that it inherits bindings from?
At present, all bindings are inherited from the global-map unless explicitly
overruled by a local map.  I suggest that this idea should be extended so
that a keymap can specify where to default to.  E.g., Info-edit-map -->
text-mode-map --> global-map.  This might be represented, say, by
representing the superior keymap, if any, as a non-nil lastcdr of the keymap,
and adding user functions to access and change this.

-- Ashwin.

ARPA:    Ram-Ashwin@cs.yale.edu
UUCP:    {decvax,ucbvax,harvard,cmcl2,...}!yale!Ram-Ashwin
BITNET:  Ram@yalecs