help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Error opening an APK file


From: Stefan Monnier
Subject: Re: Error opening an APK file
Date: Fri, 20 Sep 2019 08:14:37 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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

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