diff options
| author | Stefan Monnier | 2015-03-15 14:21:04 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-03-15 14:21:04 -0400 |
| commit | 8599360928a0169b232fe1d67cc8228edd4f790c (patch) | |
| tree | 2d1ab09ea9ccd19704dfcfbddbe7784ec7e87893 | |
| parent | 4e5eb85425214d62cd3962914565b281b74504ce (diff) | |
| download | emacs-8599360928a0169b232fe1d67cc8228edd4f790c.tar.gz emacs-8599360928a0169b232fe1d67cc8228edd4f790c.zip | |
(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.
| -rw-r--r-- | lisp/url/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/url/url-handlers.el | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 0f464135840..8733614387a 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2015-03-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * url-handlers.el (url-insert-file-contents): Call | ||
| 4 | after-insert-file-set-coding like insert-file-contents, to set | ||
| 5 | buffer-file-coding-system (bug#20010). | ||
| 6 | |||
| 1 | 2015-01-22 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2015-01-22 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | Don't downcase system diagnostics' first letters | 9 | Don't downcase system diagnostics' first letters |
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index 23006e1e087..ff3eafd19da 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; url-handlers.el --- file-name-handler stuff for URL loading | 1 | ;;; url-handlers.el --- file-name-handler stuff for URL loading -*- lexical-binding:t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1996-1999, 2004-2015 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1996-1999, 2004-2015 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -228,7 +228,7 @@ the arguments that would have been passed to OPERATION." | |||
| 228 | ;; a local process. | 228 | ;; a local process. |
| 229 | nil))) | 229 | nil))) |
| 230 | 230 | ||
| 231 | (defun url-handler-file-remote-p (filename &optional identification connected) | 231 | (defun url-handler-file-remote-p (filename &optional identification _connected) |
| 232 | (let ((url (url-generic-parse-url filename))) | 232 | (let ((url (url-generic-parse-url filename))) |
| 233 | (if (and (url-type url) (not (equal (url-type url) "file"))) | 233 | (if (and (url-type url) (not (equal (url-type url) "file"))) |
| 234 | ;; Maybe we can find a suitable check for CONNECTED. For now, | 234 | ;; Maybe we can find a suitable check for CONNECTED. For now, |
| @@ -250,7 +250,7 @@ the arguments that would have been passed to OPERATION." | |||
| 250 | ;; The actual implementation | 250 | ;; The actual implementation |
| 251 | ;;;###autoload | 251 | ;;;###autoload |
| 252 | (defun url-copy-file (url newname &optional ok-if-already-exists | 252 | (defun url-copy-file (url newname &optional ok-if-already-exists |
| 253 | keep-time preserve-uid-gid) | 253 | _keep-time _preserve-uid-gid) |
| 254 | "Copy URL to NEWNAME. Both args must be strings. | 254 | "Copy URL to NEWNAME. Both args must be strings. |
| 255 | Signals a `file-already-exists' error if file NEWNAME already exists, | 255 | Signals a `file-already-exists' error if file NEWNAME already exists, |
| 256 | unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil. | 256 | 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." | |||
| 334 | (unless (cadr size-and-charset) | 334 | (unless (cadr size-and-charset) |
| 335 | ;; If the headers don't specify any particular charset, use the | 335 | ;; If the headers don't specify any particular charset, use the |
| 336 | ;; usual heuristic/rules that we apply to files. | 336 | ;; usual heuristic/rules that we apply to files. |
| 337 | (decode-coding-inserted-region start (point) url visit beg end replace)) | 337 | (decode-coding-inserted-region start (point) url |
| 338 | (list url (car size-and-charset)))))) | 338 | visit beg end replace)) |
| 339 | (let ((inserted (car size-and-charset))) | ||
| 340 | (when (fboundp 'after-insert-file-set-coding) | ||
| 341 | (let ((insval (after-insert-file-set-coding inserted visit))) | ||
| 342 | (if insval (setq inserted insval)))) | ||
| 343 | (list url inserted)))))) | ||
| 339 | 344 | ||
| 340 | (put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents) | 345 | (put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents) |
| 341 | 346 | ||