Subject: Re: bug#5062: 23.1.50; image-toggle-display overwrites nxml-mode local key map

From: Brent Goodrick <[email-masked]>
Date: Sat, 28 Nov 2009 07:26:13 -0800

On Fri, Nov 27, 2009 at 6:25 PM, Stefan Monnier
<[email-masked]> wrote:
>
> > 2. Run emacs -Q and wait for it to load and map into the display.
> > 3. Type C-x C-f /tmp/test.svg and see that the image of the file is
> > displayed.
> > 4. Type C-c C-c and note that the XML is shown. All correct behavior
> > so far.
> > 5. Type C-h k C-M-n and notice that the key for C-M-n is bound to
> > `forward-list' which is not correct because the .svg file is a xml
>
> Indeed, SVG files should be handled like postscript files, i.e. use
> image-minor-mode rather than image-mode.
> Can someone figure out how to to do that?

Hmmm, seems that image-minor-mode is enabled in this case, with a
major mode of nxml-mode.  But image-minor-mode ultimately calls
image-toggle-display, and image-toggle-display is calling
use-local-map to obliterate whatever map is already there.
image-minor-mode can also call use-local-map, too.  All of that
arrangement seems to be set up by the image-mode-maybe function.

I wonder what the correct "policy" is for a minor mode w.r.t.
keybindings that can shadow a major mode?  Should the major mode's
keymap be the top-most local keymap, with all minor modes as parent
maps of that top-most local keymap? Or is it the other way around,
with each minor mode "pushing" its own local mode map to be top-most,
and causing the current major modes local map to be that parent of
that new one that was "pushed"?

bg