emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 118b6a9: (url-insert-file-contents): Set buffer-f


From: Stefan Monnier
Subject: [Emacs-diffs] emacs-24 118b6a9: (url-insert-file-contents): Set buffer-file-coding-system
Date: Thu, 26 Mar 2015 19:17:54 +0000

branch: emacs-24
commit 118b6a92f51f7ac10f83f7b0210afd31fbd694f4
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    (url-insert-file-contents): Set buffer-file-coding-system
    
    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       |    6 ++++++
 lisp/url/url-handlers.el |    9 +++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 6e0c157..c26b080 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-26  Stefan Monnier  <address@hidden>
+
+       * 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  <address@hidden>
 
        * url-vars.el (url-bug-address): Make into an obsolete alias.
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 9c16cff..e42f552 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -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)
 



reply via email to

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