From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Problem with doc-view-previous-major-mode Date: Thu, 11 Apr 2013 22:30:58 +0200 Message-ID: <878v4odd31.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365712280 8017 80.91.229.3 (11 Apr 2013 20:31:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Apr 2013 20:31:20 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 11 22:31:24 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UQO9O-0002UA-JZ for ged-emacs-devel@m.gmane.org; Thu, 11 Apr 2013 22:31:18 +0200 Original-Received: from localhost ([::1]:51333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQO9O-0000lA-7U for ged-emacs-devel@m.gmane.org; Thu, 11 Apr 2013 16:31:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQO9L-0000ku-6p for emacs-devel@gnu.org; Thu, 11 Apr 2013 16:31:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQO9K-0003G2-Bn for emacs-devel@gnu.org; Thu, 11 Apr 2013 16:31:15 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:35047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQO9K-0003EG-5F for emacs-devel@gnu.org; Thu, 11 Apr 2013 16:31:14 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UQO9E-0002Gy-St for emacs-devel@gnu.org; Thu, 11 Apr 2013 22:31:08 +0200 Original-Received: from i59f574f1.versanet.de ([89.245.116.241]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 11 Apr 2013 22:31:08 +0200 Original-Received: from stephen.berman by i59f574f1.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 11 Apr 2013 22:31:08 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 23 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: i59f574f1.versanet.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158840 Archived-At: 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