bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5062: image-toggle-display overwrites nxml-mode local key map


From: Juri Linkov
Subject: bug#5062: image-toggle-display overwrites nxml-mode local key map
Date: Thu, 03 Dec 2009 02:59:16 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu)

>> Or did you mean a joint mode like `c-mode-and-image-minor-mode',
>> `nxml-mode-and-image-minor-mode', `ps-mode-and-doc-view-minor-mode'?
>> Wouldn't this be too clumsy?
>
> Yes, why would it be too clumsy?
>
> A more flexibel way might be to use define-globalized-minor-mode. The
> turn on function there could make any check. It could for example look
> in a list similar to auto-mode-alist, but for minor modes.
>
> But maybe that would take too long time?

I think Stefan's idea of allowing auto-mode-alist to have entries like
("regexp" (major-mode minor-mode-1 minor-mode-2 ...)) is more universal.

Two basic ways to specify modes are:

1. With Local Variables you can put in the first line

  -*- mode: major-mode; mode: minor-mode-1; mode: minor-mode-2; ... -*-

or the same to the Local Variables list, or to the
Directory Local Variables.

2. With `auto-mode-alist' you can bind filename patterns to major modes,
but not to minor modes.  (major-mode minor-mode-1 minor-mode-2 ...)
would allow to do the same that Local Variables already allows to do, e.g.
("\\.xpm\\'" (c-mode image-minor-mode)),
("\\.svg\\'" (nxml-mode image-minor-mode)),
("\\.ps\\'" (ps-mode doc-view-minor-mode)),
etc.

PS: this feature currently is not too necessary, because in the patch I sent
`image-mode-maybe' was replaced with `image-mode' in `auto-mode-alist'
to display a file as an image by default (the default behavior in 23.1).
And only if someone wants to change this default to display a file as
text initially, this requires either adding `image-mode-maybe' to
`auto-mode-alist' or a combination of normal-mode + image-minor-mode
that can be implemented as a new feature.

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]