Mercurial > emacs
comparison lisp/url/url.el @ 83353:532e0a9335a9
Merged in changes from CVS trunk. Plus added lisp/term tweaks.
Patches applied:
* lorentey@elte.hu--2004/emacs--cvs-trunk--0--base-0
tag of miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-474
* lorentey@elte.hu--2004/emacs--cvs-trunk--0--patch-1
Add CVS metadata files.
* lorentey@elte.hu--2004/emacs--cvs-trunk--0--patch-2
Update from CVS.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-393
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Sun, 04 Sep 2005 03:48:17 +0000 |
parents | 6c13700d1c13 875dcc490074 |
children | db4e74787e6f |
comparison
equal
deleted
inserted
replaced
83352:b258b3492423 | 83353:532e0a9335a9 |
---|---|
1 ;;; url.el --- Uniform Resource Locator retrieval tool | 1 ;;; url.el --- Uniform Resource Locator retrieval tool |
2 | 2 |
3 ;; Copyright (c) 1996, 1997, 1998, 1999, 2001, 2004, 2005 | 3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, |
4 ;; Free Software Foundation, Inc. | 4 ;; 2005 Free Software Foundation, Inc. |
5 | 5 |
6 ;; Author: Bill Perry <wmperry@gnu.org> | 6 ;; Author: Bill Perry <wmperry@gnu.org> |
7 ;; Keywords: comm, data, processes, hypermedia | 7 ;; Keywords: comm, data, processes, hypermedia |
8 | 8 |
9 ;; This file is part of GNU Emacs. | 9 ;; This file is part of GNU Emacs. |
54 (require 'url-methods) | 54 (require 'url-methods) |
55 (require 'url-proxy) | 55 (require 'url-proxy) |
56 (require 'url-parse) | 56 (require 'url-parse) |
57 (require 'url-util) | 57 (require 'url-util) |
58 | 58 |
59 ;; Fixme: customize? convert-standard-filename? | 59 ;; Fixme: customize? convert-standard-filename? |
60 ;;;###autoload | 60 ;;;###autoload |
61 (defvar url-configuration-directory "~/.url") | 61 (defvar url-configuration-directory "~/.url") |
62 | 62 |
63 (defun url-do-setup () | 63 (defun url-do-setup () |
64 "Setup the url package. | 64 "Setup the url package. |
69 ;; Make OS/2 happy | 69 ;; Make OS/2 happy |
70 ;;(push '("http" "80") tcp-binary-process-input-services) | 70 ;;(push '("http" "80") tcp-binary-process-input-services) |
71 | 71 |
72 (mailcap-parse-mailcaps) | 72 (mailcap-parse-mailcaps) |
73 (mailcap-parse-mimetypes) | 73 (mailcap-parse-mimetypes) |
74 | 74 |
75 ;; Register all the authentication schemes we can handle | 75 ;; Register all the authentication schemes we can handle |
76 (url-register-auth-scheme "basic" nil 4) | 76 (url-register-auth-scheme "basic" nil 4) |
77 (url-register-auth-scheme "digest" nil 7) | 77 (url-register-auth-scheme "digest" nil 7) |
78 | 78 |
79 (setq url-cookie-file | 79 (setq url-cookie-file |
80 (or url-cookie-file | 80 (or url-cookie-file |
81 (expand-file-name "cookies" url-configuration-directory))) | 81 (expand-file-name "cookies" url-configuration-directory))) |
82 | 82 |
83 (setq url-history-file | 83 (setq url-history-file |
84 (or url-history-file | 84 (or url-history-file |
85 (expand-file-name "history" url-configuration-directory))) | 85 (expand-file-name "history" url-configuration-directory))) |
86 | 86 |
87 ;; Parse the global history file if it exists, so that it can be used | 87 ;; Parse the global history file if it exists, so that it can be used |
88 ;; for URL completion, etc. | 88 ;; for URL completion, etc. |
89 (url-history-parse-history) | 89 (url-history-parse-history) |
90 (url-history-setup-save-timer) | 90 (url-history-setup-save-timer) |
91 | 91 |
121 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 121 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
122 ;;; Retrieval functions | 122 ;;; Retrieval functions |
123 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 123 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
124 (defun url-retrieve (url callback &optional cbargs) | 124 (defun url-retrieve (url callback &optional cbargs) |
125 "Retrieve URL asynchronously and call CALLBACK with CBARGS when finished. | 125 "Retrieve URL asynchronously and call CALLBACK with CBARGS when finished. |
126 The callback is called when the object has been completely retrieved, with | 126 URL is either a string or a parsed URL. |
127 | |
128 CALLBACK is called when the object has been completely retrieved, with | |
127 the current buffer containing the object, and any MIME headers associated | 129 the current buffer containing the object, and any MIME headers associated |
128 with it. URL is either a string or a parsed URL. | 130 with it. Normally it gets the arguments in the list CBARGS. |
131 However, if what we find is a redirect, CALLBACK is given | |
132 two additional args, `:redirect' and the redirected URL, | |
133 followed by CBARGS. | |
129 | 134 |
130 Return the buffer URL will load into, or nil if the process has | 135 Return the buffer URL will load into, or nil if the process has |
131 already completed." | 136 already completed." |
132 (url-do-setup) | 137 (url-do-setup) |
133 (url-gc-dead-buffers) | 138 (url-gc-dead-buffers) |
222 `(lambda (proc event) | 227 `(lambda (proc event) |
223 (mm-destroy-parts (quote ,handle)))) | 228 (mm-destroy-parts (quote ,handle)))) |
224 (message "Viewing externally") | 229 (message "Viewing externally") |
225 (kill-buffer (current-buffer))) | 230 (kill-buffer (current-buffer))) |
226 (display-buffer (current-buffer)) | 231 (display-buffer (current-buffer)) |
227 (add-hook 'kill-buffer-hook | 232 (add-hook 'kill-buffer-hook |
228 `(lambda () (mm-destroy-parts ',handle)) | 233 `(lambda () (mm-destroy-parts ',handle)) |
229 nil | 234 nil |
230 t))))) | 235 t))))) |
231 | 236 |
232 (defun url-mm-url (url) | 237 (defun url-mm-url (url) |