diff options
| author | Chong Yidong | 2012-11-09 03:03:49 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-11-09 03:03:49 +0800 |
| commit | 82f84fa3cdebaa4083621e7226f7abab3b8ba88f (patch) | |
| tree | dadb28318e8a0998b144a3cbf55a19655a8f9042 | |
| parent | fedb154e30405ae0f4be8a582a6252a4d3eb75b5 (diff) | |
| download | emacs-82f84fa3cdebaa4083621e7226f7abab3b8ba88f.tar.gz emacs-82f84fa3cdebaa4083621e7226f7abab3b8ba88f.zip | |
Update the URL library manual.
* doc/misc/url.texi (Introduction): Rename from Getting Started.
Rewrite the introduction.
(URI Parsing): Rewrite. Omit the obsolete attributes slot.
| -rw-r--r-- | doc/misc/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/misc/url.texi | 198 | ||||
| -rw-r--r-- | etc/NEWS | 9 |
3 files changed, 126 insertions, 87 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 700d432ef44..d7af0d79c68 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-11-08 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * url.texi (Introduction): Rename from Getting Started. Rewrite | ||
| 4 | the introduction. | ||
| 5 | (URI Parsing): Rewrite. Omit the obsolete attributes slot. | ||
| 6 | |||
| 1 | 2012-11-07 Glenn Morris <rgm@gnu.org> | 7 | 2012-11-07 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * cl.texi (Obsolete Setf Customization): | 9 | * cl.texi (Obsolete Setf Customization): |
diff --git a/doc/misc/url.texi b/doc/misc/url.texi index 898a9994a86..9124edfcf73 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | @end direntry | 18 | @end direntry |
| 19 | 19 | ||
| 20 | @copying | 20 | @copying |
| 21 | This file documents the Emacs Lisp URL loading package. | 21 | This file documents @code{url} Emacs Lisp library. |
| 22 | 22 | ||
| 23 | Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. | 23 | Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. |
| 24 | 24 | ||
| @@ -57,7 +57,8 @@ developing GNU and promoting software freedom.'' | |||
| 57 | @end ifnottex | 57 | @end ifnottex |
| 58 | 58 | ||
| 59 | @menu | 59 | @menu |
| 60 | * Getting Started:: Preparing your program to use URLs. | 60 | * Introduction:: About the @code{url} library. |
| 61 | * URI Parsing:: Parsing (and unparsing) URIs. | ||
| 61 | * Retrieving URLs:: How to use this package to retrieve a URL. | 62 | * Retrieving URLs:: How to use this package to retrieve a URL. |
| 62 | * Supported URL Types:: Descriptions of URL types currently supported. | 63 | * Supported URL Types:: Descriptions of URL types currently supported. |
| 63 | * Defining New URLs:: How to define a URL loader for a new protocol. | 64 | * Defining New URLs:: How to define a URL loader for a new protocol. |
| @@ -70,93 +71,132 @@ developing GNU and promoting software freedom.'' | |||
| 70 | * Concept Index:: | 71 | * Concept Index:: |
| 71 | @end menu | 72 | @end menu |
| 72 | 73 | ||
| 73 | @node Getting Started | 74 | @node Introduction |
| 74 | @chapter Getting Started | 75 | @chapter Introduction |
| 75 | @cindex URLs, definition | 76 | @cindex URL |
| 76 | @cindex URIs | 77 | @cindex URI |
| 78 | @cindex uniform resource identifier | ||
| 79 | @cindex uniform resource locator | ||
| 77 | 80 | ||
| 78 | @dfn{Uniform Resource Locators} (URLs) are a specific form of | 81 | A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted |
| 79 | @dfn{Uniform Resource Identifiers} (URI) described in RFC 2396 which | 82 | name, such as an Internet address, which identifies some name or |
| 80 | updates RFC 1738 and RFC 1808. RFC 2016 defines uniform resource | 83 | resource. The format of URIs is described in RFC 3986, which updates |
| 81 | agents. | 84 | and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A |
| 85 | @dfn{Uniform Resource Locator} (URL) is an older but still-common | ||
| 86 | term, which basically refers to a URI corresponding to a resource | ||
| 87 | which can be accessed over a network. | ||
| 82 | 88 | ||
| 83 | URIs have the form @var{scheme}:@var{scheme-specific-part}, where the | 89 | Here are some examples of URIs (taken from RFC 3986): |
| 84 | @var{scheme}s supported by this library are described below. | ||
| 85 | @xref{Supported URL Types}. | ||
| 86 | |||
| 87 | FTP, NFS, HTTP, HTTPS, @code{rlogin}, @code{telnet}, tn3270, | ||
| 88 | IRC and gopher URLs all have the form | ||
| 89 | 90 | ||
| 90 | @example | 91 | @example |
| 91 | @var{scheme}://@r{[}@var{userinfo}@@@r{]}@var{hostname}@r{[}:@var{port}@r{]}@r{[}/@var{path}@r{]} | 92 | ftp://ftp.is.co.za/rfc/rfc1808.txt |
| 93 | http://www.ietf.org/rfc/rfc2396.txt | ||
| 94 | ldap://[2001:db8::7]/c=GB?objectClass?one | ||
| 95 | mailto:John.Doe@@example.com | ||
| 96 | news:comp.infosystems.www.servers.unix | ||
| 97 | tel:+1-816-555-1212 | ||
| 98 | telnet://192.0.2.16:80/ | ||
| 99 | urn:oasis:names:specification:docbook:dtd:xml:4.1.2 | ||
| 92 | @end example | 100 | @end example |
| 93 | @noindent | ||
| 94 | where @samp{@r{[}} and @samp{@r{]}} delimit optional parts. | ||
| 95 | @var{userinfo} sometimes takes the form @var{username}:@var{password} | ||
| 96 | but you should beware of the security risks of sending cleartext | ||
| 97 | passwords. @var{hostname} may be a domain name or a dotted decimal | ||
| 98 | address. If the @samp{:@var{port}} is omitted then the library will | ||
| 99 | use the ``well known'' port for that service when accessing URLs. With | ||
| 100 | the possible exception of @code{telnet}, it is rare for ports to be | ||
| 101 | specified, and it is possible using a non-standard port may have | ||
| 102 | undesired consequences if a different service is listening on that | ||
| 103 | port (e.g., an HTTP URL specifying the SMTP port can cause mail to be | ||
| 104 | sent). @c , but @xref{Other Variables, url-bad-port-list}. | ||
| 105 | The meaning of the @var{path} component depends on the service. | ||
| 106 | |||
| 107 | @menu | ||
| 108 | * Configuration:: | ||
| 109 | * Parsed URLs:: URLs are parsed into vector structures. | ||
| 110 | @end menu | ||
| 111 | 101 | ||
| 112 | @node Configuration | 102 | This manual describes the @code{url} library, an Emacs Lisp library |
| 113 | @section Configuration | 103 | for parsing URIs and retrieving the resources to which they refer. |
| 104 | (The library is so-named due to historical reasons; nowadays, the | ||
| 105 | ``URI'' terminology is regarded as the more general one, and ``URL'' | ||
| 106 | is technically obsolete despite its widespread vernacular usage.) | ||
| 114 | 107 | ||
| 115 | @defvar url-configuration-directory | 108 | @defvar url-configuration-directory |
| 116 | @cindex @file{~/.url} | ||
| 117 | @cindex configuration files | 109 | @cindex configuration files |
| 118 | The directory in which URL configuration files, the cache etc., | 110 | The value of this variable specifies the name of the directory in |
| 119 | reside. The old default was @file{~/.url}, and this directory | 111 | which the @code{url} library stores its various configuration files, |
| 120 | is still used if it exists. The new default is a @file{url/} | 112 | cache files, etc. |
| 121 | directory in @code{user-emacs-directory}, which is normally | 113 | |
| 122 | @file{~/.emacs.d}. | 114 | The default value specifies a subdirectory named @file{url/} in the |
| 115 | standard Emacs user data directory specified by the variable | ||
| 116 | @code{user-emacs-directory} (normally @file{~/.emacs.d}). However, | ||
| 117 | the old default was @file{~/.url}, and this directory is used instead | ||
| 118 | if it exists. | ||
| 123 | @end defvar | 119 | @end defvar |
| 124 | 120 | ||
| 125 | @node Parsed URLs | 121 | @node URI Parsing |
| 126 | @section Parsed URLs | 122 | @chapter URI Parsing |
| 127 | @cindex parsed URLs | 123 | |
| 128 | The library functions typically operate on @dfn{parsed} versions of | 124 | A URI consists of several @dfn{components}, each having a different |
| 129 | URLs. These are actually CL structures (vectors) of the form: | 125 | meaning. For example, the URI |
| 130 | 126 | ||
| 131 | @example | 127 | @example |
| 132 | [cl-struct-url @var{type} @var{user} @var{password} @var{host} @var{port} @var{filename} @var{target} @var{attributes} @var{fullness} @var{use-cookies}] | 128 | http://www.gnu.org/software/emacs/ |
| 133 | @end example | 129 | @end example |
| 134 | 130 | ||
| 135 | @noindent where | 131 | @noindent |
| 136 | @table @var | 132 | specifies the scheme component @samp{http}, the hostname component |
| 133 | @samp{www.gnu.org}, and the path component @samp{/software/emacs/}. | ||
| 134 | |||
| 135 | @cindex parsed URIs | ||
| 136 | The URI format is specified by RFC 3986. The @code{url} library | ||
| 137 | provides the Lisp function @code{url-generic-parse-url}, a | ||
| 138 | standard-compliant URI parser, as well as the unparser | ||
| 139 | @code{url-recreate-url}: | ||
| 140 | |||
| 141 | @defun url-generic-parse-url url | ||
| 142 | This function returns a parsed version of the string @var{url}. | ||
| 143 | @end defun | ||
| 144 | |||
| 145 | @defun url-recreate-url uri | ||
| 146 | @cindex unparsing URLs | ||
| 147 | Given a parsed URI, this function returns a corresponding URI string. | ||
| 148 | @end defun | ||
| 149 | |||
| 150 | @cindex parsed URI | ||
| 151 | The return value of @code{url-generic-parse-url}, and the argument | ||
| 152 | expected by @code{url-recreate-url}, is a @dfn{parsed URI}, in the | ||
| 153 | form of a CL structure whose slots hold the various components of the | ||
| 154 | URI. @xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, | ||
| 155 | for details about CL structures. Most of the other functions in the | ||
| 156 | @code{url} library act on parsed URIs. Each parsed URI structure | ||
| 157 | contains the following slots: | ||
| 158 | |||
| 159 | @table @code | ||
| 137 | @item type | 160 | @item type |
| 138 | is the type of the URL scheme, e.g., @code{http} | 161 | The URI scheme (a string, e.g.@: @code{http}). @xref{Supported URL |
| 162 | Types}, for a list of schemes that the @code{url} library knows how to | ||
| 163 | process. This slot can also be @code{nil}, if the URI is not fully | ||
| 164 | specified. | ||
| 165 | |||
| 139 | @item user | 166 | @item user |
| 140 | is the username associated with it, or @code{nil}; | 167 | The user name (a string), or @code{nil}. |
| 168 | |||
| 141 | @item password | 169 | @item password |
| 142 | is the user password associated with it, or @code{nil}; | 170 | The user password (a string), or @code{nil}. The use of this URI |
| 171 | component is strongly discouraged; nowadays, passwords are transmitted | ||
| 172 | by other means, not as part of a URI. | ||
| 173 | |||
| 143 | @item host | 174 | @item host |
| 144 | is the host name associated with it, or @code{nil}; | 175 | The host name (a string), or @code{nil}. If present, this is |
| 176 | typically a domain name or IP address. | ||
| 177 | |||
| 145 | @item port | 178 | @item port |
| 146 | is the port number associated with it, or @code{nil}; | 179 | The port number (an integer), or @code{nil}. Omitting this component |
| 180 | usually means to use the ``standard'' port associated with the URI | ||
| 181 | scheme. | ||
| 182 | |||
| 147 | @item filename | 183 | @item filename |
| 148 | is the ``file'' part of it, or @code{nil}. This doesn't necessarily | 184 | The combination of the ``path'' and ``query'' components of the URI (a |
| 149 | actually refer to a file; | 185 | string), or @code{nil}. If the query component is present, it is the |
| 186 | substring following the first @samp{?} character, and the path | ||
| 187 | component is the substring before the @samp{?}. The meaning of these | ||
| 188 | components depends on the service; they do not necessarily refer to a | ||
| 189 | file on a disk. | ||
| 190 | |||
| 150 | @item target | 191 | @item target |
| 151 | is the target part, or @code{nil}; | 192 | The fragment component (a string), or @code{nil}. The fragment |
| 152 | @item attributes | 193 | component specifies a ``secondary resource'', such as a section of a |
| 153 | is the attributes associated with it, or @code{nil}; | 194 | webpage. |
| 195 | |||
| 154 | @item fullness | 196 | @item fullness |
| 155 | is @code{t} for a fully-specified URL, with a host part indicated by | 197 | This is @code{t} if the URI is fully specified, i.e.@: the |
| 156 | @samp{//} after the scheme part. | 198 | hierarchical components of the URI (the hostname and/or username |
| 157 | @item use-cookies | 199 | and/or password) are preceded by @samp{//}. |
| 158 | is @code{nil} to neither send or store cookies to the server, @code{t} | ||
| 159 | otherwise. | ||
| 160 | @end table | 200 | @end table |
| 161 | 201 | ||
| 162 | @findex url-type | 202 | @findex url-type |
| @@ -168,30 +208,18 @@ otherwise. | |||
| 168 | @findex url-target | 208 | @findex url-target |
| 169 | @findex url-attributes | 209 | @findex url-attributes |
| 170 | @findex url-fullness | 210 | @findex url-fullness |
| 171 | These attributes have accessors named @code{url-@var{part}}, where | 211 | The above slots have accessors named @code{url-@var{part}}, where |
| 172 | @var{part} is the name of one of the elements above, e.g., | 212 | @var{part} is the slot name. For example, the accessor for the |
| 173 | @code{url-host}. These attributes can be set with the same accessors | 213 | @code{host} slot is the function @code{url-host}. The @code{url-port} |
| 174 | using @code{setf}: | 214 | accessor returns the default port for the URI scheme if the parsed |
| 215 | URI's @var{port} slot is @code{nil}. | ||
| 216 | |||
| 217 | The slots can be set using @code{setf}. For example: | ||
| 175 | 218 | ||
| 176 | @example | 219 | @example |
| 177 | (setf (url-port url) 80) | 220 | (setf (url-port url) 80) |
| 178 | @end example | 221 | @end example |
| 179 | 222 | ||
| 180 | If @var{port} is @var{nil}, @code{url-port} returns the default port | ||
| 181 | of the protocol. | ||
| 182 | |||
| 183 | There are functions for parsing and unparsing between the string and | ||
| 184 | vector forms. | ||
| 185 | |||
| 186 | @defun url-generic-parse-url url | ||
| 187 | Return a parsed version of the string @var{url}. | ||
| 188 | @end defun | ||
| 189 | |||
| 190 | @defun url-recreate-url url | ||
| 191 | @cindex unparsing URLs | ||
| 192 | Recreates a URL string from the parsed @var{url}. | ||
| 193 | @end defun | ||
| 194 | |||
| 195 | @node Retrieving URLs | 223 | @node Retrieving URLs |
| 196 | @chapter Retrieving URLs | 224 | @chapter Retrieving URLs |
| 197 | 225 | ||
| @@ -454,7 +454,9 @@ specifying URL types which should be converted to remote file names at | |||
| 454 | the FFAP prompt. The default is now '("ftp"). | 454 | the FFAP prompt. The default is now '("ftp"). |
| 455 | 455 | ||
| 456 | ** Generic-x | 456 | ** Generic-x |
| 457 | `javascript-generic-mode' is now an obsolete alias for `js-mode'. | 457 | |
| 458 | --- | ||
| 459 | *** `javascript-generic-mode' is now an obsolete alias for `js-mode'. | ||
| 458 | 460 | ||
| 459 | ** Ibuffer | 461 | ** Ibuffer |
| 460 | 462 | ||
| @@ -531,6 +533,7 @@ python-send-string | python-shell-send-string | |||
| 531 | python-switch-to-python | python-shell-switch-to-shell | 533 | python-switch-to-python | python-shell-switch-to-shell |
| 532 | python-describe-symbol | python-eldoc-at-point | 534 | python-describe-symbol | python-eldoc-at-point |
| 533 | 535 | ||
| 536 | --- | ||
| 534 | ** reStructuredText mode | 537 | ** reStructuredText mode |
| 535 | 538 | ||
| 536 | *** Rebind nearly all keys making room for more keys and complying | 539 | *** Rebind nearly all keys making room for more keys and complying |
| @@ -561,6 +564,7 @@ the experience for Sphinx users. | |||
| 561 | 564 | ||
| 562 | *** Support `imenu' and `which-func'. | 565 | *** Support `imenu' and `which-func'. |
| 563 | 566 | ||
| 567 | --- | ||
| 564 | ** SH Script mode | 568 | ** SH Script mode |
| 565 | 569 | ||
| 566 | *** Pairing of parens/quotes uses electric-pair-mode instead of skeleton-pair. | 570 | *** Pairing of parens/quotes uses electric-pair-mode instead of skeleton-pair. |
| @@ -575,6 +579,7 @@ the experience for Sphinx users. | |||
| 575 | for a new asynchronous shell command when the default output buffer | 579 | for a new asynchronous shell command when the default output buffer |
| 576 | `*Async Shell Command*' is already taken by another running command. | 580 | `*Async Shell Command*' is already taken by another running command. |
| 577 | 581 | ||
| 582 | --- | ||
| 578 | ** SQL Mode | 583 | ** SQL Mode |
| 579 | 584 | ||
| 580 | *** DB2 added `sql-db2-escape-newlines' | 585 | *** DB2 added `sql-db2-escape-newlines' |
| @@ -605,7 +610,7 @@ definitions. See the manual for details. | |||
| 605 | *** Remote processes are now supported also on remote Windows host. | 610 | *** Remote processes are now supported also on remote Windows host. |
| 606 | 611 | ||
| 607 | ** URL | 612 | ** URL |
| 608 | 613 | +++ | |
| 609 | *** Structs made by `url-generic-parse-url' have nil `attributes' slot. | 614 | *** Structs made by `url-generic-parse-url' have nil `attributes' slot. |
| 610 | Previously, this slot stored semicolon-separated attribute-value pairs | 615 | Previously, this slot stored semicolon-separated attribute-value pairs |
| 611 | appended to some imap URLs, but this is not compatible with RFC 3986. | 616 | appended to some imap URLs, but this is not compatible with RFC 3986. |