all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: 5553@debbugs.gnu.org
Subject: bug#5553: 23.1.92; Archives with wrong coding system
Date: Wed, 10 Feb 2010 00:19:35 +0200	[thread overview]
Message-ID: <87k4umyrrh.fsf@mail.jurta.org> (raw)
In-Reply-To: <87bpfzxana.fsf@mail.jurta.org> (Juri Linkov's message of "Tue, 09 Feb 2010 23:19:27 +0200")

> When `archive-mode' is enabled for an archive file with an unknown file
> extension, using the rule ("\\(PK00\\)?[P]K\003\004" . archive-mode)
> from `magic-fallback-mode-alist', visiting such a file fails with the
> args-out-of-range error.
>
> The following patch should fix this bug using the same regexp as in
> `magic-fallback-mode-alist' and the same coding system as for archive
> file extensions in `auto-coding-alist':

The same problem exists also for images.  `magic-fallback-mode-alist' contains:

  (image-type-auto-detected-p . image-mode)

but visiting an image file with a non-standard file extension
(i.e. not in `auto-mode-alist') doesn't display it as an image.

The following patch fixes this problem, but it seems duplicating
image regexps from `image-type-header-regexps' is too ugly?

=== modified file 'lisp/international/mule.el'
--- lisp/international/mule.el	2010-02-09 05:00:56 +0000
+++ lisp/international/mule.el	2010-02-09 22:16:28 +0000
@@ -1655,7 +1655,14 @@ (defcustom auto-coding-regexp-alist
     ("\\`\xEF\xBB\xBF" . utf-8-with-signature)
     ("\\`;ELC\024\0\0\0" . emacs-mule)	; Emacs 20-compiled
     ;; For `archive-mode' in `magic-fallback-mode-alist':
-    ("\\(PK00\\)?[P]K\003\004" . no-conversion-multibyte)))
+    ("\\(PK00\\)?[P]K\003\004" . no-conversion-multibyte)
+    ;; For `image-mode' in `magic-fallback-mode-alist'
+    ;; (regexps duplicated from `image-type-header-regexps'):
+    ("\\`GIF8[79]a"                 . no-conversion) ; gif
+    ("\\`\x89PNG\r\n\x1a\n"         . no-conversion) ; png
+    ("\\`\\(?:MM\0\\*\\|II\\*\0\\)" . no-conversion) ; tiff
+    ("\\`\xff\xd8"                  . no-conversion) ; jpeg
+    ))
   "Alist of patterns vs corresponding coding systems.
 Each element looks like (REGEXP . CODING-SYSTEM).
 A file whose first bytes match REGEXP is decoded by CODING-SYSTEM on reading.

-- 
Juri Linkov
http://www.jurta.org/emacs/






  reply	other threads:[~2010-02-09 22:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-09 21:19 bug#5553: 23.1.92; Archives with wrong coding system Juri Linkov
2010-02-09 22:19 ` Juri Linkov [this message]
2010-02-09 22:34 ` Eli Zaretskii
2010-02-10  0:09   ` Juri Linkov
2010-02-10 20:14     ` Stefan Monnier
2010-02-10 22:33       ` Juri Linkov
2010-02-11  2:12         ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=87k4umyrrh.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=5553@debbugs.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.