unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Error opening an APK file
Date: Fri, 20 Sep 2019 08:14:37 -0400	[thread overview]
Message-ID: <jwvef0bgo6p.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 838sqjtom0.fsf@gnu.org

Eli Zaretskii [2019-09-20 10:26:31] wrote:

>> From: Pascal Quesseveur <pquessev@gmail.com>
>> Date: Thu, 19 Sep 2019 09:15:00 +0200
>> 
>> >"EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>> 
>>   EZ> Are you saying that just renaming a .apk file to .zip solves the
>>   EZ> problem?
>> 
>> Yes. In files.el auto-mode-alist associates archive-mode for archive
>> file extensions: arc, zip, ...  The comment says:
>> 
>>      ;; The list of archive file extensions should be in sync with
>>      ;; `auto-coding-alist' with `no-conversion' coding system.
>> 
>> In fact, auto-coding-alist in mule.el associates archive file
>> extensions with no-conversion-multibyte.
>
> And if you add apk to auto-coding-alist, the problem goes away?

How 'bout a patch along the lines of the one below?


        Stefan


diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index ec6f647688..c570caa993 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1844,12 +1843,9 @@ auto-coding-alist
   ;; .exe and .EXE are added to support archive-mode looking at DOS
   ;; self-extracting exe archives.
   (mapcar (lambda (arg) (cons (purecopy (car arg)) (cdr arg)))
-	  '(("\\.\\(\
-arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
-ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
-     . no-conversion-multibyte)
+   '((archive-mode . no-conversion)
     ("\\.\\(exe\\|EXE\\)\\'" . no-conversion)
-    ("\\.\\(sx[dmicw]\\|odt\\|tar\\|t[bg]z\\)\\'" . no-conversion)
+     (tar-mode . no-conversion)
     ("\\.\\(gz\\|Z\\|bz\\|bz2\\|xz\\|gpg\\)\\'" . no-conversion)
     ("\\.\\(jpe?g\\|png\\|gif\\|tiff?\\|p[bpgn]m\\)\\'" . no-conversion)
     ("\\.pdf\\'" . no-conversion)
@@ -1936,13 +1932,27 @@ auto-coding-alist-lookup
   "Return the coding system specified by `auto-coding-alist' for FILENAME."
   (let ((alist auto-coding-alist)
 	(case-fold-search (file-name-case-insensitive-p filename))
+        (mmode nil)
 	coding-system)
     (while (and alist (not coding-system))
-      (if (string-match (car (car alist)) filename)
+      (if (if (stringp (car (car alist)))
+              (string-match (car (car alist)) filename)
+            (unless (or mmode (not (boundp 'auto-mode-alist)))
+              (setq mmode (or (assoc-default filename auto-mode-alist
+                                             #'string-match)
+                              t)))
+            (eq mmode (caar alist)))
 	  (setq coding-system (cdr (car alist)))
 	(setq alist (cdr alist))))
     coding-system))




  reply	other threads:[~2019-09-20 12:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18  8:52 Error opening an APK file Pascal Quesseveur
2019-09-18 12:35 ` Eli Zaretskii
2019-09-18 14:20   ` Pascal Quesseveur
2019-09-18 14:29     ` Eli Zaretskii
2019-09-18 15:11       ` Pascal Quesseveur
2019-09-18 15:27         ` Eli Zaretskii
2019-09-18 16:48           ` Pascal Quesseveur
2019-09-19  7:15           ` Pascal Quesseveur
2019-09-20  7:26             ` Eli Zaretskii
2019-09-20 12:14               ` Stefan Monnier [this message]
2019-09-20 12:23                 ` Robert Pluim
2019-09-20 12:40                   ` Stefan Monnier
2019-09-20 12:47                     ` Robert Pluim
2019-09-20 14:35                     ` Eli Zaretskii
2019-09-20 15:13                       ` Stefan Monnier
2019-09-20 16:02                         ` Eli Zaretskii
2019-09-20 13:01                   ` Eli Zaretskii
2019-09-20 13:17                     ` Robert Pluim
2019-09-20 14:37                 ` Eli Zaretskii

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=jwvef0bgo6p.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@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.
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).