]> code.delx.au - gnu-emacs/commitdiff
(url-insert-file-contents): Set buffer-file-coding-system
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 26 Mar 2015 19:17:51 +0000 (15:17 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 26 Mar 2015 19:17:51 +0000 (15:17 -0400)
Fixes: debbugs:20010
* lisp/url/url-handlers.el (url-insert-file-contents): Call
after-insert-file-set-coding like insert-file-contents, to set
buffer-file-coding-system.  [Backport]

lisp/url/ChangeLog
lisp/url/url-handlers.el

index 6e0c157e39caa22455421153b408a851368a23f7..c26b080c0507589c3ad5ddccd0e93a1949c0e8b2 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * url-handlers.el (url-insert-file-contents): Call
+       after-insert-file-set-coding like insert-file-contents, to set
+       buffer-file-coding-system (bug#20010).  [Backport]
+
 2014-10-20  Glenn Morris  <rgm@gnu.org>
 
        * url-vars.el (url-bug-address): Make into an obsolete alias.
index 9c16cffd4af0bee6b7ee5ef4b20725739de609d6..e42f552c416492a4d6afd0a05d810f9c3617ef89 100644 (file)
@@ -324,8 +324,13 @@ They count bytes from the beginning of the body."
         (unless (cadr size-and-charset)
           ;; If the headers don't specify any particular charset, use the
           ;; usual heuristic/rules that we apply to files.
-          (decode-coding-inserted-region start (point) url visit beg end replace))
-        (list url (car size-and-charset))))))
+          (decode-coding-inserted-region start (point) url
+                                         visit beg end replace))
+        (let ((inserted (car size-and-charset)))
+          (when (fboundp 'after-insert-file-set-coding)
+            (let ((insval (after-insert-file-set-coding inserted visit)))
+              (if insval (setq inserted insval))))
+          (list url inserted))))))
 
 (put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents)