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

Re: always text/plain on ASCII text



On 2019-01-25 10:39, Katsumi Yamaoka wrote:
> First of all, please don't use defcutom for w3m-content-type-alist
> because its default value inherits the value of mailcap-mime-data
> that inherits the contents of user's ~/.mailcap file.  So, the
> default value will vary and the use of defcustom is unsuitable with
> it (I've made mailcap-mime-data defcustom'd in Emacs mistakenly
>  once before but withdrawn).

Then it seems that I gave bad advice to the original poster who asked
how to correct his issue. On the other hand, the element of this alist
that I think was causing him trouble was not from the part of the alist
that is being imported from mailcap information; it is hard-coded by
emacs-w3m as an element of the local variable `additions'. Maybe, in one
form or another, that portion of the alist should be made defcustom?
Possibly, `additions' could be renamed as its own variable?

> Anyway, there are three reasons your custom type mismatching.
>
> 1. emacs-w3m bug
>
> (defvar w3m-content-type-alist
> [...]
> 	   ("application/x-bzip2" "\\.bz2\\'" nil nil nil)
> 	   ("application/x-gzip" "\\.gz\\'" nil nil nil)))
>
>   Maybe those `nil' nil nil' should be fixed to `nil nil'.

Patch attached.


On 2019-01-25 11:18, Katsumi Yamaoka wrote:
> In [emacs-w3m:13082]
> On Fri, 25 Jan 2019 10:39:13 +0900, Katsumi Yamaoka wrote:
> > Anyway, there are three reasons your custom type mismatching.
>
> Oops, there are four reasons, sorry.

On the contrary, thanks for the guidance. Even if the defcustom can't be
used in this case, the exercise and corrections can be useful for the
future.

> assoc-delete-all is a function only in Emacs 27.

Useful, indeed! I'm using debian, which has only very recently upgraded
to emacs 26 - I hope this feature doesn't suffer the same fate as
when-let, if-let, when-let*, if-let*.

BTW, on my personal git repo where I'm experimenting with some ideas,
the original poster's question would never arise, because the url would
be caught as an unknown, and the user would be prompted for what to do,
given a choice from operations of all entries on the alist. Right now,
proposing that patch would be a mess, but it might become easier once
the real project repository has a git option.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
diff -u -r1.3682 ChangeLog
--- ChangeLog	22 Oct 2018 08:55:03 -0000	1.3682
+++ ChangeLog	25 Jan 2019 04:19:53 -0000
@@ -1,3 +1,8 @@
+2018-06-08  Boruch Baum  <boruch_baum@xxxxxxx>
+
+	* w3m.el (w3m-content-type-alist): Remove extraneous fields from two
+	elements (bzip2, gzip) in the alist ([emacs-w3m:13081]).
+
 2018-10-22  Katsumi Yamaoka  <yamaoka@xxxxxxx>

 	* w3m.el (w3m-decode-encoded-contents): Use the conventional way if

--- w3m.el	22 Oct 2018 08:55:03 -0000	1.1718
+++ w3m.el	25 Jan 2019 04:19:55 -0000
@@ -220,7 +220,7 @@

 (defconst emacs-w3m-version
   (eval-when-compile
-    (let ((rev "$Revision: 1.1718 $"))
+    (let ((rev "$Revision$"))
       (and (string-match "\\.\\([0-9]+\\) \\$\\'" rev)
 	   (setq rev (- (string-to-number (match-string 1 rev)) 1136))
 	   (format "1.4.%d" (+ rev 50)))))
@@ -1202,8 +1202,8 @@
 	   ("application/rdf+xml" "\\.rdf\\'" nil "text/plain")
 	   ("application/rss+xml" "\\.rss\\'" nil "text/plain")
 	   ("application/xhtml+xml" nil nil "text/html")
-	   ("application/x-bzip2" "\\.bz2\\'" nil nil nil)
-	   ("application/x-gzip" "\\.gz\\'" nil nil nil)))
+	   ("application/x-bzip2" "\\.bz2\\'" nil nil)
+	   ("application/x-gzip" "\\.gz\\'" nil nil)))
 	(extensions (copy-sequence mailcap-mime-extensions))
 	elem ext type exts tem viewer rest)
     ;; items w/ file extensions