diff options
| author | Stefan Monnier | 2004-09-20 21:27:10 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-09-20 21:27:10 +0000 |
| commit | d4fdad607eda3f6e76b62b608c5eb2126fc37eec (patch) | |
| tree | 326be720a4cb31b0ab889dafe2edea5dac6b8eaf | |
| parent | 46cdaf2476204e5933ba1573381d114ed3a4b29f (diff) | |
| download | emacs-d4fdad607eda3f6e76b62b608c5eb2126fc37eec.tar.gz emacs-d4fdad607eda3f6e76b62b608c5eb2126fc37eec.zip | |
(url-insert-file-contents): Decode contents.
| -rw-r--r-- | lisp/url/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/url/url-handlers.el | 21 |
2 files changed, 16 insertions, 9 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index e19df5d2ef6..69851ac5046 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2004-09-20 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * url-handlers.el (url-insert-file-contents): Decode contents. | ||
| 4 | |||
| 1 | 2004-04-16 Stefan Monnier <monnier@iro.umontreal.ca> | 5 | 2004-04-16 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 6 | ||
| 3 | * url-util.el (url-debug): Use with-current-buffer. | 7 | * url-util.el (url-debug): Use with-current-buffer. |
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el index 6c540e8d61b..56497b00119 100644 --- a/lisp/url/url-handlers.el +++ b/lisp/url/url-handlers.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; url-handlers.el --- file-name-handler stuff for URL loading | 1 | ;;; url-handlers.el --- file-name-handler stuff for URL loading |
| 2 | 2 | ||
| 3 | ;; Copyright (c) 1996,97,98,1999,2004 Free Software Foundation, Inc. | 3 | ;; Copyright (c) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc. |
| 4 | ;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu> | 4 | ;; Copyright (c) 1993 - 1996 by William M. Perry <wmperry@cs.indiana.edu> |
| 5 | 5 | ||
| 6 | ;; Keywords: comm, data, processes, hypermedia | 6 | ;; Keywords: comm, data, processes, hypermedia |
| @@ -170,8 +170,7 @@ A prefix arg makes KEEP-TIME non-nil." | |||
| 170 | (handle nil)) | 170 | (handle nil)) |
| 171 | (if (not buffer) | 171 | (if (not buffer) |
| 172 | (error "Opening input file: No such file or directory, %s" url)) | 172 | (error "Opening input file: No such file or directory, %s" url)) |
| 173 | (save-excursion | 173 | (with-current-buffer buffer |
| 174 | (set-buffer buffer) | ||
| 175 | (setq handle (mm-dissect-buffer t))) | 174 | (setq handle (mm-dissect-buffer t))) |
| 176 | (mm-save-part-to-file handle newname) | 175 | (mm-save-part-to-file handle newname) |
| 177 | (kill-buffer buffer) | 176 | (kill-buffer buffer) |
| @@ -194,18 +193,22 @@ accessible." | |||
| 194 | (if (not buffer) | 193 | (if (not buffer) |
| 195 | (error "Opening input file: No such file or directory, %s" url)) | 194 | (error "Opening input file: No such file or directory, %s" url)) |
| 196 | (if visit (setq buffer-file-name url)) | 195 | (if visit (setq buffer-file-name url)) |
| 197 | (save-excursion | 196 | (with-current-buffer buffer |
| 198 | (set-buffer buffer) | ||
| 199 | (setq handle (mm-dissect-buffer t)) | 197 | (setq handle (mm-dissect-buffer t)) |
| 200 | (set-buffer (mm-handle-buffer handle)) | 198 | (set-buffer (mm-handle-buffer handle)) |
| 201 | (if beg | 199 | (setq data (if beg (buffer-substring beg end) |
| 202 | (setq data (buffer-substring beg end)) | 200 | (buffer-string)))) |
| 203 | (setq data (buffer-string)))) | ||
| 204 | (kill-buffer buffer) | 201 | (kill-buffer buffer) |
| 205 | (mm-destroy-parts handle) | 202 | (mm-destroy-parts handle) |
| 206 | (if replace (delete-region (point-min) (point-max))) | 203 | (if replace (delete-region (point-min) (point-max))) |
| 207 | (save-excursion | 204 | (save-excursion |
| 208 | (insert data)) | 205 | (let ((start (point))) |
| 206 | (insert data) | ||
| 207 | ;; FIXME: for text/plain data, we sometimes receive a `charset' | ||
| 208 | ;; annotation which we could use as a hint of the locale in use | ||
| 209 | ;; at the remote site. Not sure how/if that should be done. --Stef | ||
| 210 | (decode-coding-inserted-region | ||
| 211 | start (point) buffer-file-name visit beg end replace))) | ||
| 209 | (list url (length data)))) | 212 | (list url (length data)))) |
| 210 | 213 | ||
| 211 | (defun url-file-name-completion (url directory) | 214 | (defun url-file-name-completion (url directory) |