unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juri Linkov <juri@jurta.org>
Cc: Tassilo Horn <tassilo@member.fsf.org>,
	Brent Goodrick <bgoodr@gmail.com>,
	5062@emacsbugs.donarmstrong.com
Subject: bug#5062: 23.1.50; image-toggle-display overwrites nxml-mode local key map
Date: Sun, 29 Nov 2009 13:33:06 -0500	[thread overview]
Message-ID: <jwvpr71nuqb.fsf-monnier+emacsbugreports@gnu.org> (raw)
In-Reply-To: <87fx7x5np9.fsf@mail.jurta.org> (Juri Linkov's message of "Sun, 29 Nov 2009 18:03:50 +0200")

> Even though doc-view is a superset of image-mode, currently I see no way
> to merge them cleanly.

As mentioned, it may not be easy or even desirable to merge
them completely.  But we should strive to keep them as close as possible
and to make doc-view use image-mode.el functions and data
wherever possible.  Maybe if one cannot be a derived mode of them other,
we could make a "shared parent" mode (like an abstract class).

> But using the same handling of major/minor modes
> would be good.  The patch below leaves the role for `image-minor-mode'
> to only provide the `C-c C-c' binding, and also toggles between
> `image-mode' and `image-mode-maybe' in `image-toggle-display' .

I haven't looked in detail (partly because it doesn't apply to the
current code because of some other change I installed in the mean time),
but it looks good.

> One open question is about using `image-mode-maybe'.  With this
> patch, it's essentially a combination of a non-image major mode
> (`normal-mode' with image-mode entries removed from `auto-mode-alist')
> and `image-minor-mode'.  So when `image-mode-maybe' is present in
> `auto-mode-alist' this means "to set a non-image major mode and
> image-minor-mode".

> It would be more nice to get rid of `image-mode-maybe', and to use
> `image-minor-mode' in `auto-mode-alist'.  But I don't know how to
> specify both a non-image major mode and image-minor-mode
> at the same time using `auto-mode-alist'.

IIRC auto-mode-alist can point to minor-modes (the auto-mode-alist entry
needs to look something like ("regexp" minor-mode t)), but I don't think
it can be used here (the constraints on how it can be used are very
strict since it needs to "consume" a suffix and be called before the
major-mode).  Maybe we could extend auto-mode-alist to allow things like
("regexp" (major-mode minor-mode-1 minor-mode-2 ...)).

> The approach currently used in doc-view for PS files is more ugly than
> using `image-mode-maybe'.  It adds to ps-mode.el the line:
>   (declare-function doc-view-minor-mode "doc-view")

To the extent that postscript would always use image-minor-mode anyway,
I think the way it's done now is at least as clean if not cleaner than
relying on image-mode-maybe (image-mode-maybe is fairly hackish).

> I think this should be changed to use the solution described above
> adding e.g. `doc-view-mode-maybe' (or a better name) as a combination
> of a non-image major mode and image minor-mode.

I don't think that would be an improvement.  This is in contrast to XPM
and SVG formats where they get combined with major-modes that are also
used for non-image documents, so it wouldn't make sense for nxml-mode or
c-mode to always enable image-minor-mode.


        Stefan





  reply	other threads:[~2009-11-29 18:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <878wdixvgt.fsf@mail.jurta.org>
2009-11-28  0:44 ` bug#5062: 23.1.50; image-toggle-display overwrites nxml-mode local key map Brent Goodrick
2009-11-28  2:25   ` Stefan Monnier
2009-11-28 15:26     ` Brent Goodrick
2009-11-28 17:49     ` Juri Linkov
2009-11-28 20:21       ` Stefan Monnier
2009-11-28 22:54         ` Juri Linkov
2009-11-29 15:36           ` Stefan Monnier
2009-11-29 16:03             ` Juri Linkov
2009-11-29 18:33               ` Stefan Monnier [this message]
2009-11-29 22:00                 ` Lennart Borgman
2009-11-29 22:08                   ` Juri Linkov
2009-11-29 23:16                     ` Lennart Borgman
2009-12-03  0:59                       ` bug#5062: " Juri Linkov
2009-12-03  1:37                         ` Lennart Borgman
2009-12-03  3:08                           ` Kevin Rodgers
2009-12-03  3:31                             ` Lennart Borgman
2009-12-03  3:30                           ` Stefan Monnier
2009-12-03  0:57                 ` bug#5062: 23.1.50; " Juri Linkov
2009-12-03  3:28                   ` Stefan Monnier
2009-12-03  5:00                   ` Jason Rumney
2009-12-04  0:05                     ` Juri Linkov
2009-12-04 22:00   ` bug#5062: marked as done (23.1.50; image-toggle-display overwrites nxml-mode local key map) Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvpr71nuqb.fsf-monnier+emacsbugreports@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=5062@emacsbugs.donarmstrong.com \
    --cc=bgoodr@gmail.com \
    --cc=juri@jurta.org \
    --cc=tassilo@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).