emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 8599360: (url-insert-file-contents): Set buffer-fil


From: Stefan Monnier
Subject: [Emacs-diffs] master 8599360: (url-insert-file-contents): Set buffer-file-coding-system
Date: Sun, 15 Mar 2015 18:21:11 +0000

branch: master
commit 8599360928a0169b232fe1d67cc8228edd4f790c
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.
---
 lisp/url/ChangeLog       |    6 ++++++
 lisp/url/url-handlers.el |   15 ++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 0f46413..8733614 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-15  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).
+
 2015-01-22  Paul Eggert  <address@hidden>
 
        Don't downcase system diagnostics' first letters
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 23006e1..ff3eafd 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -1,4 +1,4 @@
-;;; url-handlers.el --- file-name-handler stuff for URL loading
+;;; url-handlers.el --- file-name-handler stuff for URL loading  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1996-1999, 2004-2015 Free Software Foundation, Inc.
 
@@ -228,7 +228,7 @@ the arguments that would have been passed to OPERATION."
       ;; a local process.
       nil)))
 
-(defun url-handler-file-remote-p (filename &optional identification connected)
+(defun url-handler-file-remote-p (filename &optional identification _connected)
   (let ((url (url-generic-parse-url filename)))
     (if (and (url-type url) (not (equal (url-type url) "file")))
        ;; Maybe we can find a suitable check for CONNECTED.  For now,
@@ -250,7 +250,7 @@ the arguments that would have been passed to OPERATION."
 ;; The actual implementation
 ;;;###autoload
 (defun url-copy-file (url newname &optional ok-if-already-exists
-                         keep-time preserve-uid-gid)
+                         _keep-time _preserve-uid-gid)
   "Copy URL to NEWNAME.  Both args must be strings.
 Signals a `file-already-exists' error if file NEWNAME already exists,
 unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.
@@ -334,8 +334,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]