emacs-devel
[Top][All Lists]
Advanced

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

Problem with doc-view-previous-major-mode


From: Stephen Berman
Subject: Problem with doc-view-previous-major-mode
Date: Thu, 11 Apr 2013 22:30:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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 via email to

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