GNU bug report logs - #20891
emacs: Back off if .doc is not an Office document

Previous Next

Package: emacs;

Reported by: era+emacs <at> iki.fi

Date: Wed, 24 Jun 2015 11:20:03 UTC

Severity: minor

Tags: fixed

Found in version 24.4+1-4ubuntu5

Fixed in version 27.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Robert Pluim <rpluim <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: era+emacs <at> iki.fi, Andreas Schwab <schwab <at> suse.de>, larsi <at> gnus.org, 20891 <at> debbugs.gnu.org, stefan <at> marxist.se
Subject: bug#20891: emacs: Back off if .doc is not an Office document
Date: Fri, 15 Nov 2019 10:14:19 +0100
>>>>> On Thu, 14 Nov 2019 18:42:40 +0200, Eli Zaretskii <eliz <at> gnu.org> said:

    Eli> So we want to remove docx? from auto-mode-alist and instead to add the
    Eli> magic signature to magic-mode-alist?  But then AFAIK MS Word documents
    Eli> had different signatures for different versions, so we should have
    Eli> several.  And a literal docx should be left in auto-mode-alist, right?

Yes. The following detects a word 97 file for me, and a text .doc file
opens in fundamental-mode.

diff --git i/lisp/files.el w/lisp/files.el
index 053583b4cb..ea3d3deb34 100644
--- i/lisp/files.el
+++ w/lisp/files.el
@@ -2798,7 +2798,7 @@ auto-mode-alist
      ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)
      ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MS-DOS
      ("\\.[eE]?[pP][sS]\\'" . ps-mode)
-     ("\\.\\(?:PDF\\|DVI\\|OD[FGPST]\\|DOCX?\\|XLSX?\\|PPTX?\\|pdf\\|djvu\\|dvi\\|od[fgpst]\\|docx?\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe)
+     ("\\.\\(?:PDF\\|DVI\\|OD[FGPST]\\|DOCX\\|XLSX?\\|PPTX?\\|pdf\\|djvu\\|dvi\\|od[fgpst]\\|docx\\|xlsx?\\|pptx?\\)\\'" . doc-view-mode-maybe)
      ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode)
      ("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
      ("BROWSE\\'" . ebrowse-tree-mode)
@@ -3062,6 +3062,7 @@ magic-fallback-mode-alist
             (comment-re (concat "\\(?:!--" incomment-re "*-->[ \t\r\n]*<\\)")))
        (concat "[ \t\r\n]*<" comment-re "*!DOCTYPE "))
      . sgml-mode)
+    ("\320\317\021\340\241\261\032\341" . doc-view-mode-maybe)
     ("%!PS" . ps-mode)
     ("# xmcd " . conf-unix-mode)))
   "Like `magic-mode-alist' but has lower priority than `auto-mode-alist'.




This bug report was last modified 5 years and 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.