unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: emacs-devel@gnu.org
Subject: Problem with doc-view-previous-major-mode
Date: Thu, 11 Apr 2013 22:30:58 +0200	[thread overview]
Message-ID: <878v4odd31.fsf@rosalinde.fritz.box> (raw)

If you visit a .docx file, you see an image of its content, since
auto-mode-alist assigns that extension to doc-view-mode-maybe.  Then if
you type C-c C-c, the display switches to a listing of the archive
contents, since .docx files are assigned by magic-fallback-mode-alist to
archive-mode.  (The same thing should also happen with ODF files ending
in .odt, .ods, etc., but doesn't, due to bug#14188.)  At least, this is
what happens with -Q.  But I have customized the global value of
major-mode to text-mode, and when I type C-c C-c on the image of a .docx
file, instead of getting the archive listing I only see the binary
content in text-mode.  The reason for this is that in doc-view-mode,
doc-view-previous-major-mode is assigned the global value of major-mode,
unless this is fundamental-mode, and then doc-view-fallback-mode calls
the mode function stored in doc-view-previous-major-mode, in my case
text-mode.  But if doc-view-previous-major-mode is nil, then
doc-view-fallback-mode calls normal-mode, which calls set-auto-mode,
which eventually checks magic-fallback-mode-alist and so switches to
archive-mode.  For my case, using non-nil doc-view-previous-major-mode
gives a worse result than calling normal-mode.  Is it possible to just
always fall back by calling normal-mode?  Or when is it really
preferable to switch to the "previous" major mode (which really means
the global value of major-mode)?

Steve Berman




             reply	other threads:[~2013-04-11 20:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11 20:30 Stephen Berman [this message]
2013-04-12  1:57 ` Problem with doc-view-previous-major-mode Stefan Monnier
2013-04-12  8:09   ` Stephen Berman
2013-04-12 16:24     ` Stefan Monnier
2013-04-13 14:57       ` Stephen Berman
2013-04-14  2:56 ` Stefan Monnier
2013-04-14 12:55   ` Stephen Berman

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=878v4odd31.fsf@rosalinde.fritz.box \
    --to=stephen.berman@gmx.net \
    --cc=emacs-devel@gnu.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).