aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorGlenn Morris2012-11-10 15:13:33 -0800
committerGlenn Morris2012-11-10 15:13:33 -0800
commit6baf66d53bbedd85a443e0d69d1f4311a93f0677 (patch)
tree38d7a00d5f7d5aecb86285d334fa15a31e5fbab1 /doc/misc
parent05a859c1bd9cd07b2c0fad06a0694e88ea929fcf (diff)
parente4e46889223296e8875548d278340b21db449a4a (diff)
downloademacs-6baf66d53bbedd85a443e0d69d1f4311a93f0677.tar.gz
emacs-6baf66d53bbedd85a443e0d69d1f4311a93f0677.zip
Merge from emacs-24; up to 2012-11-08T14:54:03Z!monnier@iro.umontreal.ca
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/ChangeLog29
-rw-r--r--doc/misc/cl.texi151
-rw-r--r--doc/misc/url.texi644
3 files changed, 482 insertions, 342 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 0a32fd82044..2518e72ef1e 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,32 @@
12012-11-10 Chong Yidong <cyd@gnu.org>
2
3 * url.texi (Introduction): Move url-configuration-directory to
4 Customization node.
5 (Parsed URIs): Split into its own node.
6 (URI Encoding): New node.
7 (Defining New URLs): Remove empty chapter.
8 (Retrieving URLs): Add an introduction. Doc fix for url-retrieve.
9 Improve docs for url-queue-*.
10 (Supported URL Types): Copyedits. Delete empty subnodes.
11
12 * url.texi (Introduction): Rename from Getting Started. Rewrite
13 the introduction.
14 (URI Parsing): Rewrite. Omit the obsolete attributes slot.
15
162012-11-10 Glenn Morris <rgm@gnu.org>
17
18 * cl.texi (Obsolete Setf Customization):
19 Revert defsetf example to the more correct let rather than prog1.
20 Give define-modify-macro, defsetf, and define-setf-method
21 gv.el replacements.
22
23 * cl.texi (Overview): Mention EIEIO here, as well as the appendix.
24 (Setf Extensions): Remove obsolete reference.
25 (Obsolete Setf Customization):
26 Move note on lack of setf functions to lispref/variables.texi.
27 Undocument get-setf-method, since it no longer exists.
28 Mention simple defsetf replaced by gv-define-simple-setter.
29
12012-11-03 Glenn Morris <rgm@gnu.org> 302012-11-03 Glenn Morris <rgm@gnu.org>
2 31
3 * cl.texi: Further general copyedits. 32 * cl.texi: Further general copyedits.
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index e182c2600f9..a50be1027f3 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -107,7 +107,8 @@ for various reasons:
107@item 107@item
108Some features are too complex or bulky relative to their benefit 108Some features are too complex or bulky relative to their benefit
109to Emacs Lisp programmers. CLOS and Common Lisp streams are fine 109to Emacs Lisp programmers. CLOS and Common Lisp streams are fine
110examples of this group. 110examples of this group. (The separate package EIEIO implements
111a subset of CLOS functionality. @xref{Top, , Introduction, eieio, EIEIO}.)
111 112
112@item 113@item
113Other features cannot be implemented without modification to the 114Other features cannot be implemented without modification to the
@@ -974,7 +975,7 @@ a
974The generalized variable @code{buffer-substring}, listed above, 975The generalized variable @code{buffer-substring}, listed above,
975also works in this way by replacing a portion of the current buffer. 976also works in this way by replacing a portion of the current buffer.
976 977
977@c FIXME? Also `eq'? (see cl-lib.el) 978@c FIXME? Also `eq'? (see cl-lib.el)
978 979
979@c Currently commented out in cl.el. 980@c Currently commented out in cl.el.
980@ignore 981@ignore
@@ -989,13 +990,10 @@ only interesting when used with places you define yourself with
989@xref{Obsolete Setf Customization}. 990@xref{Obsolete Setf Customization}.
990@end ignore 991@end ignore
991 992
993@c FIXME? Is this still true?
992@item 994@item
993A macro call, in which case the macro is expanded and @code{setf} 995A macro call, in which case the macro is expanded and @code{setf}
994is applied to the resulting form. 996is applied to the resulting form.
995
996@item
997Any form for which a @code{defsetf} or @code{define-setf-method}
998has been made. @xref{Obsolete Setf Customization}.
999@end itemize 997@end itemize
1000 998
1001@c FIXME should this be in lispref? It seems self-evident. 999@c FIXME should this be in lispref? It seems self-evident.
@@ -2867,7 +2865,6 @@ temporary variables.
2867This function creates a new, uninterned symbol (using @code{make-symbol}) 2865This function creates a new, uninterned symbol (using @code{make-symbol})
2868with a unique name. (The name of an uninterned symbol is relevant 2866with a unique name. (The name of an uninterned symbol is relevant
2869only if the symbol is printed.) By default, the name is generated 2867only if the symbol is printed.) By default, the name is generated
2870@c FIXME no longer true?
2871from an increasing sequence of numbers, @samp{G1000}, @samp{G1001}, 2868from an increasing sequence of numbers, @samp{G1000}, @samp{G1001},
2872@samp{G1002}, etc. If the optional argument @var{x} is a string, that 2869@samp{G1002}, etc. If the optional argument @var{x} is a string, that
2873string is used as a prefix instead of @samp{G}. Uninterned symbols 2870string is used as a prefix instead of @samp{G}. Uninterned symbols
@@ -4481,14 +4478,6 @@ The @code{equal} predicate does not distinguish
4481between IEEE floating-point plus and minus zero. The @code{cl-equalp} 4478between IEEE floating-point plus and minus zero. The @code{cl-equalp}
4482predicate has several differences with Common Lisp; @pxref{Predicates}. 4479predicate has several differences with Common Lisp; @pxref{Predicates}.
4483 4480
4484@c FIXME consider moving to lispref
4485@ignore
4486The @code{setf} mechanism is entirely compatible, except that
4487setf-methods return a list of five values rather than five
4488values directly. Also, the new ``@code{setf} function'' concept
4489(typified by @code{(defun (setf foo) @dots{})}) is not implemented.
4490@end ignore
4491
4492The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} 4481The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols}
4493with no @var{obarray} argument. In Common Lisp, this form would 4482with no @var{obarray} argument. In Common Lisp, this form would
4494iterate over all symbols in all packages. Since Emacs obarrays 4483iterate over all symbols in all packages. Since Emacs obarrays
@@ -4907,15 +4896,17 @@ Common Lisp defines three macros, @code{define-modify-macro},
4907@code{defsetf}, and @code{define-setf-method}, that allow the 4896@code{defsetf}, and @code{define-setf-method}, that allow the
4908user to extend generalized variables in various ways. 4897user to extend generalized variables in various ways.
4909In Emacs, these are obsolete, replaced by various features of 4898In Emacs, these are obsolete, replaced by various features of
4910@file{gv.el} in Emacs 24.3. Many of the implementation 4899@file{gv.el} in Emacs 24.3.
4911details in the following are out-of-date. 4900@xref{Adding Generalized Variables,,,elisp,GNU Emacs Lisp Reference Manual}.
4912@c FIXME this whole section needs updating. 4901
4913 4902
4914@defmac define-modify-macro name arglist function [doc-string] 4903@defmac define-modify-macro name arglist function [doc-string]
4915This macro defines a ``read-modify-write'' macro similar to 4904This macro defines a ``read-modify-write'' macro similar to
4916@code{cl-incf} and @code{cl-decf}. The macro @var{name} is defined 4905@code{cl-incf} and @code{cl-decf}. You can replace this macro
4917to take a @var{place} argument followed by additional arguments 4906with @code{gv-letplace}.
4918described by @var{arglist}. The call 4907
4908The macro @var{name} is defined to take a @var{place} argument
4909followed by additional arguments described by @var{arglist}. The call
4919 4910
4920@example 4911@example
4921(@var{name} @var{place} @var{args}@dots{}) 4912(@var{name} @var{place} @var{args}@dots{})
@@ -4938,8 +4929,8 @@ which in turn is roughly equivalent to
4938For example: 4929For example:
4939 4930
4940@example 4931@example
4941(define-modify-macro cl-incf (&optional (n 1)) +) 4932(define-modify-macro incf (&optional (n 1)) +)
4942(define-modify-macro cl-concatf (&rest args) concat) 4933(define-modify-macro concatf (&rest args) concat)
4943@end example 4934@end example
4944 4935
4945Note that @code{&key} is not allowed in @var{arglist}, but 4936Note that @code{&key} is not allowed in @var{arglist}, but
@@ -4948,16 +4939,31 @@ Note that @code{&key} is not allowed in @var{arglist}, but
4948Most of the modify macros defined by Common Lisp do not exactly 4939Most of the modify macros defined by Common Lisp do not exactly
4949follow the pattern of @code{define-modify-macro}. For example, 4940follow the pattern of @code{define-modify-macro}. For example,
4950@code{push} takes its arguments in the wrong order, and @code{pop} 4941@code{push} takes its arguments in the wrong order, and @code{pop}
4951is completely irregular. You can define these macros ``by hand'' 4942is completely irregular.
4952using @code{get-setf-method}, or consult the source 4943
4953to see how to use the internal @code{setf} building blocks. 4944The above @code{incf} example could be written using
4945@code{gv-letplace} as:
4946@example
4947(defmacro incf (place &optional n)
4948 (gv-letplace (getter setter) place
4949 (macroexp-let2 nil v (or n 1)
4950 (funcall setter `(+ ,v ,getter)))))
4951@end example
4952@ignore
4953(defmacro concatf (place &rest args)
4954 (gv-letplace (getter setter) place
4955 (macroexp-let2 nil v (mapconcat 'identity args "")
4956 (funcall setter `(concat ,getter ,v)))))
4957@end ignore
4954@end defmac 4958@end defmac
4955 4959
4956@defmac defsetf access-fn update-fn 4960@defmac defsetf access-fn update-fn
4957This is the simpler of two @code{defsetf} forms. Where 4961This is the simpler of two @code{defsetf} forms, and is
4958@var{access-fn} is the name of a function which accesses a place, 4962replaced by @code{gv-define-simple-setter}.
4959this declares @var{update-fn} to be the corresponding store 4963
4960function. From now on, 4964With @var{access-fn} the name of a function that accesses a place,
4965this declares @var{update-fn} to be the corresponding store function.
4966From now on,
4961 4967
4962@example 4968@example
4963(setf (@var{access-fn} @var{arg1} @var{arg2} @var{arg3}) @var{value}) 4969(setf (@var{access-fn} @var{arg1} @var{arg2} @var{arg3}) @var{value})
@@ -4972,7 +4978,7 @@ will be expanded to
4972 4978
4973@noindent 4979@noindent
4974The @var{update-fn} is required to be either a true function, or 4980The @var{update-fn} is required to be either a true function, or
4975a macro which evaluates its arguments in a function-like way. Also, 4981a macro that evaluates its arguments in a function-like way. Also,
4976the @var{update-fn} is expected to return @var{value} as its result. 4982the @var{update-fn} is expected to return @var{value} as its result.
4977Otherwise, the above expansion would not obey the rules for the way 4983Otherwise, the above expansion would not obey the rules for the way
4978@code{setf} is supposed to behave. 4984@code{setf} is supposed to behave.
@@ -4988,25 +4994,32 @@ something more like
4988 temp) 4994 temp)
4989@end example 4995@end example
4990 4996
4991Some examples of the use of @code{defsetf}, drawn from the standard 4997Some examples are:
4992suite of setf methods, are:
4993 4998
4994@example 4999@example
4995(defsetf car setcar) 5000(defsetf car setcar)
4996(defsetf symbol-value set)
4997(defsetf buffer-name rename-buffer t) 5001(defsetf buffer-name rename-buffer t)
4998@end example 5002@end example
5003
5004These translate directly to @code{gv-define-simple-setter}:
5005
5006@example
5007(gv-define-simple-setter car setcar)
5008(gv-define-simple-setter buffer-name rename-buffer t)
5009@end example
4999@end defmac 5010@end defmac
5000 5011
5001@defmac defsetf access-fn arglist (store-var) forms@dots{} 5012@defmac defsetf access-fn arglist (store-var) forms@dots{}
5002This is the second, more complex, form of @code{defsetf}. It is 5013This is the second, more complex, form of @code{defsetf}.
5003rather like @code{defmacro} except for the additional @var{store-var} 5014It can be replaced by @code{gv-define-setter}.
5004argument. The @var{forms} should return a Lisp form that stores 5015
5005the value of @var{store-var} into the generalized variable formed 5016This form of @code{defsetf} is rather like @code{defmacro} except for
5006by a call to @var{access-fn} with arguments described by @var{arglist}. 5017the additional @var{store-var} argument. The @var{forms} should
5007The @var{forms} may begin with a string which documents the @code{setf} 5018return a Lisp form that stores the value of @var{store-var} into the
5008method (analogous to the doc string that appears at the front of a 5019generalized variable formed by a call to @var{access-fn} with
5009function). 5020arguments described by @var{arglist}. The @var{forms} may begin with
5021a string which documents the @code{setf} method (analogous to the doc
5022string that appears at the front of a function).
5010 5023
5011For example, the simple form of @code{defsetf} is shorthand for 5024For example, the simple form of @code{defsetf} is shorthand for
5012 5025
@@ -5021,20 +5034,28 @@ macros like @code{cl-incf} that invoke this
5021setf-method will insert temporary variables as needed to make 5034setf-method will insert temporary variables as needed to make
5022sure the apparent order of evaluation is preserved. 5035sure the apparent order of evaluation is preserved.
5023 5036
5024Another example drawn from the standard package: 5037Another standard example:
5025 5038
5026@example 5039@example
5027(defsetf nth (n x) (store) 5040(defsetf nth (n x) (store)
5028 (list 'setcar (list 'nthcdr n x) store)) 5041 `(setcar (nthcdr ,n ,x) ,store))
5042@end example
5043
5044You could write this using @code{gv-define-setter} as:
5045
5046@example
5047(gv-define-setter nth (store n x)
5048 `(setcar (nthcdr ,n ,x) ,store))
5029@end example 5049@end example
5030@end defmac 5050@end defmac
5031 5051
5032@defmac define-setf-method access-fn arglist forms@dots{} 5052@defmac define-setf-method access-fn arglist forms@dots{}
5033This is the most general way to create new place forms. When 5053This is the most general way to create new place forms. You can
5034a @code{setf} to @var{access-fn} with arguments described by 5054replace this by @code{gv-define-setter} or @code{gv-define-expander}.
5035@var{arglist} is expanded, the @var{forms} are evaluated and 5055
5036must return a list of five items: 5056When a @code{setf} to @var{access-fn} with arguments described by
5037@c FIXME Is this still true? 5057@var{arglist} is expanded, the @var{forms} are evaluated and must
5058return a list of five items:
5038 5059
5039@enumerate 5060@enumerate
5040@item 5061@item
@@ -5063,6 +5084,9 @@ This is exactly like the Common Lisp macro of the same name,
5063except that the method returns a list of five values rather 5084except that the method returns a list of five values rather
5064than the five values themselves, since Emacs Lisp does not 5085than the five values themselves, since Emacs Lisp does not
5065support Common Lisp's notion of multiple return values. 5086support Common Lisp's notion of multiple return values.
5087(Note that the @code{setf} implementation provided by @file{gv.el}
5088does not use this five item format. Its use here is only for
5089backwards compatibility.)
5066 5090
5067Once again, the @var{forms} may begin with a documentation string. 5091Once again, the @var{forms} may begin with a documentation string.
5068 5092
@@ -5078,45 +5102,22 @@ turn out to be unnecessary, so there is little reason for the
5078setf-method itself to optimize. 5102setf-method itself to optimize.
5079@end defmac 5103@end defmac
5080 5104
5105@c Removed in Emacs 24.3, not possible to make a compatible replacement.
5106@ignore
5081@defun get-setf-method place &optional env 5107@defun get-setf-method place &optional env
5082This function returns the setf-method for @var{place}, by 5108This function returns the setf-method for @var{place}, by
5083invoking the definition previously recorded by @code{defsetf} 5109invoking the definition previously recorded by @code{defsetf}
5084or @code{define-setf-method}. The result is a list of five 5110or @code{define-setf-method}. The result is a list of five
5085values as described above. You can use this function to build 5111values as described above. You can use this function to build
5086your own @code{cl-incf}-like modify macros. 5112your own @code{cl-incf}-like modify macros.
5087@c These no longer exist.
5088@ignore
5089(Actually, it is better to use the internal functions
5090@code{cl-setf-do-modify} and @code{cl-setf-do-store}, which are a bit
5091easier to use and which also do a number of optimizations; consult the
5092source code for the @code{cl-incf} function for a simple example.)
5093@end ignore
5094 5113
5095The argument @var{env} specifies the ``environment'' to be 5114The argument @var{env} specifies the ``environment'' to be
5096passed on to @code{macroexpand} if @code{get-setf-method} should 5115passed on to @code{macroexpand} if @code{get-setf-method} should
5097need to expand a macro in @var{place}. It should come from 5116need to expand a macro in @var{place}. It should come from
5098an @code{&environment} argument to the macro or setf-method 5117an @code{&environment} argument to the macro or setf-method
5099that called @code{get-setf-method}. 5118that called @code{get-setf-method}.
5100
5101@c FIXME No longer true.
5102See also the source code for the setf-method for
5103@c Also @code{apply}, but that is commented out.
5104@code{substring}, which works by calling @code{get-setf-method} on a
5105simpler case, then massaging the result.
5106@end defun 5119@end defun
5107 5120@end ignore
5108@c FIXME does not belong here any more, maybe in lispref?
5109Modern Common Lisp defines a second, independent way to specify
5110the @code{setf} behavior of a function, namely ``@code{setf}
5111functions'' whose names are lists @code{(setf @var{name})}
5112rather than symbols. For example, @code{(defun (setf foo) @dots{})}
5113defines the function that is used when @code{setf} is applied to
5114@code{foo}. This package does not currently support @code{setf}
5115functions. In particular, it is a compile-time error to use
5116@code{setf} on a form which has not already been @code{defsetf}'d
5117or otherwise declared; in newer Common Lisps, this would not be
5118an error since the function @code{(setf @var{func})} might be
5119defined later.
5120 5121
5121 5122
5122@node GNU Free Documentation License 5123@node GNU Free Documentation License
diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index 898a9994a86..fdb3ab452f2 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
21This file documents the Emacs Lisp URL loading package. 21This is the manual for the @code{url} Emacs Lisp library.
22 22
23Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. 23Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc.
24 24
@@ -57,10 +57,10 @@ 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* General Facilities:: URLs can be cached, accessed via a gateway 64* General Facilities:: URLs can be cached, accessed via a gateway
65 and tracked in a history list. 65 and tracked in a history list.
66* Customization:: Variables you can alter. 66* Customization:: Variables you can alter.
@@ -70,93 +70,129 @@ developing GNU and promoting software freedom.''
70* Concept Index:: 70* Concept Index::
71@end menu 71@end menu
72 72
73@node Getting Started 73@node Introduction
74@chapter Getting Started 74@chapter Introduction
75@cindex URLs, definition 75@cindex URL
76@cindex URIs 76@cindex URI
77@cindex uniform resource identifier
78@cindex uniform resource locator
77 79
78@dfn{Uniform Resource Locators} (URLs) are a specific form of 80A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted
79@dfn{Uniform Resource Identifiers} (URI) described in RFC 2396 which 81name, such as an Internet address, that identifies some name or
80updates RFC 1738 and RFC 1808. RFC 2016 defines uniform resource 82resource. The format of URIs is described in RFC 3986, which updates
81agents. 83and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A
84@dfn{Uniform Resource Locator} (URL) is an older but still-common
85term, which basically refers to a URI corresponding to a resource that
86can be accessed (usually over a network) in a specific way.
82 87
83URIs have the form @var{scheme}:@var{scheme-specific-part}, where the 88 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 89
87FTP, NFS, HTTP, HTTPS, @code{rlogin}, @code{telnet}, tn3270, 90@example
88IRC and gopher URLs all have the form 91ftp://ftp.is.co.za/rfc/rfc1808.txt
92http://www.ietf.org/rfc/rfc2396.txt
93ldap://[2001:db8::7]/c=GB?objectClass?one
94mailto:John.Doe@@example.com
95news:comp.infosystems.www.servers.unix
96tel:+1-816-555-1212
97telnet://192.0.2.16:80/
98urn:oasis:names:specification:docbook:dtd:xml:4.1.2
99@end example
100
101 This manual describes the @code{url} library, an Emacs Lisp library
102for parsing URIs and retrieving the resources to which they refer.
103(The library is so-named for historical reasons; nowadays, the ``URI''
104terminology is regarded as the more general one, and ``URL'' is
105technically obsolete despite its widespread vernacular usage.)
106
107@node URI Parsing
108@chapter URI Parsing
109
110 A URI consists of several @dfn{components}, each having a different
111meaning. For example, the URI
89 112
90@example 113@example
91@var{scheme}://@r{[}@var{userinfo}@@@r{]}@var{hostname}@r{[}:@var{port}@r{]}@r{[}/@var{path}@r{]} 114http://www.gnu.org/software/emacs/
92@end example 115@end example
116
93@noindent 117@noindent
94where @samp{@r{[}} and @samp{@r{]}} delimit optional parts. 118specifies the scheme component @samp{http}, the hostname component
95@var{userinfo} sometimes takes the form @var{username}:@var{password} 119@samp{www.gnu.org}, and the path component @samp{/software/emacs/}.
96but you should beware of the security risks of sending cleartext 120
97passwords. @var{hostname} may be a domain name or a dotted decimal 121@cindex parsed URIs
98address. If the @samp{:@var{port}} is omitted then the library will 122 The format of URIs is specified by RFC 3986. The @code{url} library
99use the ``well known'' port for that service when accessing URLs. With 123provides the Lisp function @code{url-generic-parse-url}, a (mostly)
100the possible exception of @code{telnet}, it is rare for ports to be 124standard-compliant URI parser, as well as function
101specified, and it is possible using a non-standard port may have 125@code{url-recreate-url}, which converts a parsed URI back into a URI
102undesired consequences if a different service is listening on that 126string.
103port (e.g., an HTTP URL specifying the SMTP port can cause mail to be 127
104sent). @c , but @xref{Other Variables, url-bad-port-list}. 128@defun url-generic-parse-url uri-string
105The meaning of the @var{path} component depends on the service. 129This function returns a parsed version of the string @var{uri-string}.
130@end defun
106 131
107@menu 132@defun url-recreate-url uri-obj
108* Configuration:: 133@cindex unparsing URLs
109* Parsed URLs:: URLs are parsed into vector structures. 134Given a parsed URI, this function returns the corresponding URI string.
110@end menu 135@end defun
111 136
112@node Configuration 137@cindex parsed URI
113@section Configuration 138 The return value of @code{url-generic-parse-url}, and the argument
139expected by @code{url-recreate-url}, is a @dfn{parsed URI}: a CL
140structure whose slots hold the various components of the URI.
141@xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, for
142details about CL structures. Most of the other functions in the
143@code{url} library act on parsed URIs.
114 144
115@defvar url-configuration-directory 145@menu
116@cindex @file{~/.url} 146* Parsed URIs:: Format of parsed URI structures.
117@cindex configuration files 147* URI Encoding:: Non-@acronym{ASCII} characters in URIs.
118The directory in which URL configuration files, the cache etc., 148@end menu
119reside. The old default was @file{~/.url}, and this directory
120is still used if it exists. The new default is a @file{url/}
121directory in @code{user-emacs-directory}, which is normally
122@file{~/.emacs.d}.
123@end defvar
124 149
125@node Parsed URLs 150@node Parsed URIs
126@section Parsed URLs 151@section Parsed URI structures
127@cindex parsed URLs
128The library functions typically operate on @dfn{parsed} versions of
129URLs. These are actually CL structures (vectors) of the form:
130 152
131@example 153 Each parsed URI structure contains the following slots:
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}]
133@end example
134 154
135@noindent where 155@table @code
136@table @var
137@item type 156@item type
138is the type of the URL scheme, e.g., @code{http} 157The URI scheme (a string, e.g.@: @code{http}). @xref{Supported URL
158Types}, for a list of schemes that the @code{url} library knows how to
159process. This slot can also be @code{nil}, if the URI is not fully
160specified.
161
139@item user 162@item user
140is the username associated with it, or @code{nil}; 163The user name (a string), or @code{nil}.
164
141@item password 165@item password
142is the user password associated with it, or @code{nil}; 166The user password (a string), or @code{nil}. The use of this URI
167component is strongly discouraged; nowadays, passwords are transmitted
168by other means, not as part of a URI.
169
143@item host 170@item host
144is the host name associated with it, or @code{nil}; 171The host name (a string), or @code{nil}. If present, this is
172typically a domain name or IP address.
173
145@item port 174@item port
146is the port number associated with it, or @code{nil}; 175The port number (an integer), or @code{nil}. Omitting this component
176usually means to use the ``standard'' port associated with the URI
177scheme.
178
147@item filename 179@item filename
148is the ``file'' part of it, or @code{nil}. This doesn't necessarily 180The combination of the ``path'' and ``query'' components of the URI (a
149actually refer to a file; 181string), or @code{nil}. If the query component is present, it is the
182substring following the first @samp{?} character, and the path
183component is the substring before the @samp{?}. The meaning of these
184components is scheme-dependent; they do not necessarily refer to a
185file on a disk.
186
150@item target 187@item target
151is the target part, or @code{nil}; 188The fragment component (a string), or @code{nil}. The fragment
152@item attributes 189component specifies a ``secondary resource'', such as a section of a
153is the attributes associated with it, or @code{nil}; 190webpage.
191
154@item fullness 192@item fullness
155is @code{t} for a fully-specified URL, with a host part indicated by 193This is @code{t} if the URI is fully specified, i.e.@: the
156@samp{//} after the scheme part. 194hierarchical components of the URI (the hostname and/or username
157@item use-cookies 195and/or password) are preceded by @samp{//}.
158is @code{nil} to neither send or store cookies to the server, @code{t}
159otherwise.
160@end table 196@end table
161 197
162@findex url-type 198@findex url-type
@@ -168,64 +204,165 @@ otherwise.
168@findex url-target 204@findex url-target
169@findex url-attributes 205@findex url-attributes
170@findex url-fullness 206@findex url-fullness
171These attributes have accessors named @code{url-@var{part}}, where 207These slots have accessors named @code{url-@var{part}}, where
172@var{part} is the name of one of the elements above, e.g., 208@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 209@code{host} slot is the function @code{url-host}. The @code{url-port}
174using @code{setf}: 210accessor returns the default port for the URI scheme if the parsed
211URI's @var{port} slot is @code{nil}.
212
213 The slots can be set using @code{setf}. For example:
175 214
176@example 215@example
177(setf (url-port url) 80) 216(setf (url-port url) 80)
178@end example 217@end example
179 218
180If @var{port} is @var{nil}, @code{url-port} returns the default port 219@node URI Encoding
181of the protocol. 220@section URI Encoding
182 221
183There are functions for parsing and unparsing between the string and 222@cindex percent encoding
184vector forms. 223 The @code{url-generic-parse-url} parser does not obey RFC 3986 in
224one respect: it allows non-@acronym{ASCII} characters in URI strings.
225
226 Strictly speaking, RFC 3986 compatible URIs may only consist of
227@acronym{ASCII} characters; non-@acronym{ASCII} characters are
228represented by converting them to UTF-8 byte sequences, and performing
229@dfn{percent encoding} on the bytes. For example, the o-umlaut
230character is converted to the UTF-8 byte sequence @samp{\xD3\xA7},
231then percent encoded to @samp{%D3%A7}. (Certain ``reserved''
232@acronym{ASCII} characters must also be percent encoded when they
233appear in URI components.)
234
235 The function @code{url-encode-url} can be used to convert a URI
236string containing arbitrary characters to one that is properly
237percent-encoded in accordance with RFC 3986.
238
239@defun url-encode-url url-string
240This function return a properly URI-encoded version of
241@var{url-string}. It also performs @dfn{URI normalization},
242e.g.@: converting the scheme component to lowercase if it was
243previously uppercase.
244@end defun
185 245
186@defun url-generic-parse-url url 246 To convert between a string containing arbitrary characters and a
187Return a parsed version of the string @var{url}. 247percent-encoded all-@acronym{ASCII} string, use the functions
248@code{url-hexify-string} and @code{url-unhex-string}:
249
250@defun url-hexify-string string &optional allowed-chars
251This function performs percent-encoding on @var{string}, and returns
252the result.
253
254If @var{string} is multibyte, it is first converted to a UTF-8 byte
255string. Each byte corresponding to an allowed character is left
256as-is, while all other bytes are converted to a three-character
257sequence: @samp{%} followed by two upper-case hex digits.
258
259@vindex url-unreserved-chars
260@cindex unreserved characters
261The allowed characters are specified by @var{allowed-chars}. If this
262argument is @code{nil}, the allowed characters are those specified as
263@dfn{unreserved characters} by RFC 3986 (see the variable
264@code{url-unreserved-chars}). Otherwise, @var{allowed-chars} should
265be a vector whose @var{n}-th element is non-@code{nil} if character
266@var{n} is allowed.
188@end defun 267@end defun
189 268
190@defun url-recreate-url url 269@defun url-unhex-string string &optional allow-newlines
191@cindex unparsing URLs 270This function replaces percent-encoding sequences in @var{string} with
192Recreates a URL string from the parsed @var{url}. 271their character equivalents, and returns the resulting string.
272
273If @var{allow-newlines} is non-@code{nil}, it allows the decoding of
274carriage returns and line feeds, which are normally forbidden in URIs.
193@end defun 275@end defun
194 276
195@node Retrieving URLs 277@node Retrieving URLs
196@chapter Retrieving URLs 278@chapter Retrieving URLs
197 279
280 The @code{url} library defines the following three functions for
281retrieving the data specified by a URL. The actual retrieval protocol
282depends on the URL's URI scheme, and is performed by lower-level
283scheme-specific functions. (Those lower-level functions are not
284documented here, and generally should not be called directly.)
285
286 In each of these functions, the @var{url} argument can be either a
287string or a parsed URL structure. If it is a string, that string is
288passed through @code{url-encode-url} before using it, to ensure that
289it is properly URI-encoded (@pxref{URI Encoding}).
290
198@defun url-retrieve-synchronously url 291@defun url-retrieve-synchronously url
199Retrieve @var{url} synchronously and return a buffer containing the 292This function synchronously retrieves the data specified by @var{url},
200data. @var{url} is either a string or a parsed URL structure. Return 293and returns a buffer containing the data. The return value is
201@code{nil} if there are no data associated with it (the case for dired, 294@code{nil} if there is no data associated with the URL (as is the case
202info, or mailto URLs that need no further processing). 295for @code{dired}, @code{info}, and @code{mailto} URLs).
203@end defun 296@end defun
204 297
205@defun url-retrieve url callback &optional cbargs silent no-cookies 298@defun url-retrieve url callback &optional cbargs silent no-cookies
206Retrieve @var{url} asynchronously and call @var{callback} with args 299This function retrieves @var{url} asynchronously, calling the function
207@var{cbargs} when finished. The callback is called when the object 300@var{callback} when the object has been completely retrieved. The
208has been completely retrieved, with the current buffer containing the 301return value is the buffer into which the data will be inserted, or
209object and any MIME headers associated with it. @var{url} is either a 302@code{nil} if the process has already completed.
210string or a parsed URL structure. Returns the buffer @var{url} will 303
211load into, or @code{nil} if the process has already completed. 304The callback function is called this way:
212If the optional argument @var{silent} is non-@code{nil}, suppress 305
213progress messages. If the optional argument @var{no-cookies} is 306@example
214non-@code{nil}, do not store or send cookies. 307(apply @var{callback} @var{status} @var{cbargs})
308@end example
309
310@noindent
311where @var{status} is a plist representing what happened during the
312retrieval, with most recent events first, or an empty list if no
313events have occurred. Each pair in the plist is one of:
314
315@table @code
316@item (:redirect @var{redirected-to})
317This means that the request was redirected to the URL
318@var{redirected-to}.
319
320@item (:error (@var{error-symbol} . @var{data}))
321This means that an error occurred. If so desired, the error can be
322signaled with @code{(signal @var{error-symbol} @var{data})}.
323@end table
324
325When the callback function is called, the current buffer is the one
326containing the retrieved data (if any). The buffer also contains any
327MIME headers associated with the data retrieval.
328
329If the optional argument @var{silent} is non-@code{nil}, progress
330messages are suppressed. If the optional argument @var{no-cookies} is
331non-@code{nil}, cookies are not stored or sent.
215@end defun 332@end defun
216 333
217@vindex url-queue-parallel-processes
218@vindex url-queue-timeout
219@defun url-queue-retrieve url callback &optional cbargs silent no-cookies 334@defun url-queue-retrieve url callback &optional cbargs silent no-cookies
220This acts like the @code{url-retrieve} function, but with limits on 335This function acts like @code{url-retrieve}, but with limits on the
221the degree of parallelism. The option @code{url-queue-parallel-processes} 336number of concurrently-running network processes. The option
222controls the number of concurrent processes, and the option 337@code{url-queue-parallel-processes} controls the number of concurrent
223@code{url-queue-timeout} sets a timeout in seconds. 338processes, and the option @code{url-queue-timeout} sets a timeout in
339seconds.
340
341To use this function, you must @code{(require 'url-queue)}.
224@end defun 342@end defun
225 343
344@vindex url-queue-parallel-processes
345@defopt url-queue-parallel-processes
346The value of this option is an integer specifying the maximum number
347of concurrent @code{url-queue-retrieve} network processes. If the
348number of @code{url-queue-retrieve} calls is larger than this number,
349later ones are queued until ealier ones are finished.
350@end defopt
351
352@vindex url-queue-timeout
353@defopt url-queue-timeout
354The value of this option is a number specifying the maximum lifetime
355of a @code{url-queue-retrieve} network process, once it is started.
356If a process is not finished by then, it is killed and removed from
357the queue.
358@end defopt
359
226@node Supported URL Types 360@node Supported URL Types
227@chapter Supported URL Types 361@chapter Supported URL Types
228 362
363This chapter describes functions and variables affecting URL retrieval
364for specific schemes.
365
229@menu 366@menu
230* http/https:: Hypertext Transfer Protocol. 367* http/https:: Hypertext Transfer Protocol.
231* file/ftp:: Local files and FTP archives. 368* file/ftp:: Local files and FTP archives.
@@ -236,48 +373,31 @@ controls the number of concurrent processes, and the option
236* irc:: Internet Relay Chat. 373* irc:: Internet Relay Chat.
237* data:: Embedded data URLs. 374* data:: Embedded data URLs.
238* nfs:: Networked File System 375* nfs:: Networked File System
239@c * finger::
240@c * gopher::
241@c * netrek::
242@c * prospero::
243* cid:: Content-ID.
244* about::
245* ldap:: Lightweight Directory Access Protocol 376* ldap:: Lightweight Directory Access Protocol
246* imap:: IMAP mailboxes.
247* man:: Unix man pages. 377* man:: Unix man pages.
248@end menu 378@end menu
249 379
250@node http/https 380@node http/https
251@section @code{http} and @code{https} 381@section @code{http} and @code{https}
252 382
253The scheme @code{http} is Hypertext Transfer Protocol. The library 383The @code{http} scheme refers to the Hypertext Transfer Protocol. The
254supports version 1.1, specified in RFC 2616. (This supersedes 1.0, 384@code{url} library supports HTTP version 1.1, specified in RFC 2616.
255defined in RFC 1945) HTTP URLs have the following form, where most of 385Its default port is 80.
256the parts are optional: 386
257@example 387 The @code{https} scheme is a secure version of @code{http}, with
258http://@var{user}:@var{password}@@@var{host}:@var{port}/@var{path}?@var{searchpart}#@var{fragment} 388transmission via SSL. It is defined in RFC 2069, and its default port
259@end example 389is 443. When using @code{https}, the @code{url} library performs SSL
260@c The @code{:@var{port}} part is optional, and @var{port} defaults to 390encryption via the @code{ssl} library, by forcing the @code{ssl}
261@c 80. The @code{/@var{path}} part, if present, is a slash-separated 391gateway method to be used. @xref{Gateways in general}.
262@c series elements. The @code{?@var{searchpart}}, if present, is the
263@c query for a search or the content of a form submission. The
264@c @code{#fragment} part, if present, is a location in the document.
265
266The scheme @code{https} is a secure version of @code{http}, with
267transmission via SSL. It is defined in RFC 2069. Its default port is
268443. This scheme depends on SSL support in Emacs via the
269@file{ssl.el} library and is actually implemented by forcing the
270@code{ssl} gateway method to be used. @xref{Gateways in general}.
271 392
272@defopt url-honor-refresh-requests 393@defopt url-honor-refresh-requests
273This controls honoring of HTTP @samp{Refresh} headers by which 394If this option is non-@code{nil} (the default), the @code{url} library
274servers can direct clients to reload documents from the same URL or a 395honors the HTTP @samp{Refresh} header, which is used by servers to
275or different one. @code{nil} means they will not be honored, 396direct clients to reload documents from the same URL or a or different
276@code{t} (the default) means they will always be honored, and 397one. If the value is @code{nil}, the @samp{Refresh} header is
277otherwise the user will be asked on each request. 398ignored; any other value means to ask the user on each request.
278@end defopt 399@end defopt
279 400
280
281@menu 401@menu
282* Cookies:: 402* Cookies::
283* HTTP language/coding:: 403* HTTP language/coding::
@@ -409,26 +529,32 @@ emacs-mime, The Emacs MIME Manual}.
409@cindex compressed files 529@cindex compressed files
410@cindex dired 530@cindex dired
411 531
532The @code{ftp} and @code{file} schemes are defined in RFC 1808. The
533@code{url} library treats @samp{ftp:} and @samp{file:} as synonymous.
534Such URLs have the form
535
412@example 536@example
413ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 537ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
414file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 538file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
415@end example 539@end example
416 540
417These schemes are defined in RFC 1808. 541@noindent
418@samp{ftp:} and @samp{file:} are synonymous in this library. They 542If the URL specifies a local file, it is retrieved by reading the file
419allow reading arbitrary files from hosts. Either @samp{ange-ftp} 543contents in the usual way. If it specifies a remote file, it is
420(Emacs) or @samp{efs} (XEmacs) is used to retrieve them from remote 544retrieved using the Ange-FTP package. @xref{Remote Files,,, emacs,
421hosts. Local files are accessed directly. 545The GNU Emacs Manual}.
422 546
423Compressed files are handled, but support is hard-coded so that 547 When retrieving a compressed file, it is automatically uncompressed
424@code{jka-compr-compression-info-list} and so on have no affect. 548if it has the file suffix @file{.z}, @file{.gz}, @file{.Z},
425Suffixes recognized are @samp{.z}, @samp{.gz}, @samp{.Z} and 549@file{.bz2}, or @file{.xz}. (The list of supported suffixes is
426@samp{.bz2}. 550hard-coded, and cannot be altered by customizing
551@code{jka-compr-compression-info-list}.)
427 552
428@defopt url-directory-index-file 553@defopt url-directory-index-file
429The filename to look for when indexing a directory, default 554This option specifies the filename to look for when a @code{file} or
430@samp{"index.html"}. If this file exists, and is readable, then it 555@code{ftp} URL specifies a directory. The default is
431will be viewed instead of using @code{dired} to view the directory. 556@file{index.html}. If this file exists and is readable, it is viewed.
557Otherwise, Emacs visits the directory using Dired.
432@end defopt 558@end defopt
433 559
434@node info 560@node info
@@ -437,47 +563,53 @@ will be viewed instead of using @code{dired} to view the directory.
437@cindex Texinfo 563@cindex Texinfo
438@findex Info-goto-node 564@findex Info-goto-node
439 565
566The @code{info} scheme is non-standard. Such URLs have the form
567
440@example 568@example
441info:@var{file}#@var{node} 569info:@var{file}#@var{node}
442@end example 570@end example
443 571
444Info URLs are not officially defined. They invoke 572@noindent
445@code{Info-goto-node} with argument @samp{(@var{file})@var{node}}. 573and are retrieved by invoking @code{Info-goto-node} with argument
446@samp{#@var{node}} is optional, defaulting to @samp{Top}. 574@samp{(@var{file})@var{node}}. If @samp{#@var{node}} is omitted, the
575@samp{Top} node is opened.
447 576
448@node mailto 577@node mailto
449@section mailto 578@section mailto
450 579
451@cindex mailto 580@cindex mailto
452@cindex email 581@cindex email
453A mailto URL will send an email message to the address in the 582A @code{mailto} URL specifies an email message to be sent to a given
454URL, for example @samp{mailto:foo@@bar.com} would compose a 583email address. For example, @samp{mailto:foo@@bar.com} specifies
455message to @samp{foo@@bar.com}. 584sending a message to @samp{foo@@bar.com}. The ``retrieval method''
456 585for such URLs is to open a mail composition buffer in which the
457@defopt url-mail-command 586appropriate content (e.g.@: the recipient address) has been filled in.
458@vindex mail-user-agent
459The function called whenever url needs to send mail. This should
460normally be left to default from @var{mail-user-agent}. @xref{Mail
461Methods, , Mail-Composition Methods, emacs, The GNU Emacs Manual}.
462@end defopt
463 587
464An @samp{X-Url-From} header field containing the URL of the document 588 As defined in RFC 2368, a @code{mailto} URL has the form
465that contained the mailto URL is added if that URL is known.
466 589
467RFC 2368 extends the definition of mailto URLs in RFC 1738.
468The form of a mailto URL is
469@example 590@example
470@samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]} 591@samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]}
471@end example 592@end example
472@noindent where an arbitrary number of @var{header}s can be added. If the
473@var{header} is @samp{body}, then @var{contents} is put in the body
474otherwise a @var{header} header field is created with @var{contents}
475as its contents. Note that the URL library does not consider any
476headers ``dangerous'' so you should check them before sending the
477message.
478 593
479@c Fixme: update 594@noindent
480Email messages are defined in @sc{rfc}822. 595where an arbitrary number of @var{header}s can be added. If the
596@var{header} is @samp{body}, then @var{contents} is put in the message
597body; otherwise, a @var{header} header field is created with
598@var{contents} as its contents. Note that the @code{url} library does
599not perform any checking of @var{header} or @var{contents}, so you
600should check them before sending the message.
601
602@defopt url-mail-command
603@vindex mail-user-agent
604The value of this variable is the function called whenever url needs
605to send mail. This should normally be left its default, which is the
606standard mail-composition command @code{compose-mail}. @xref{Sending
607Mail,,, emacs, The GNU Emacs Manual}.
608@end defopt
609
610 If the document containing the @code{mailto} URL itself possessed a
611known URL, Emacs automatically inserts an @samp{X-Url-From} header
612field into the mail buffer, specifying that URL.
481 613
482@node news/nntp/snews 614@node news/nntp/snews
483@section @code{news}, @code{nntp} and @code{snews} 615@section @code{news}, @code{nntp} and @code{snews}
@@ -487,11 +619,13 @@ Email messages are defined in @sc{rfc}822.
487@cindex NNTP 619@cindex NNTP
488@cindex snews 620@cindex snews
489 621
490@c draft-gilman-news-url-01 622The @code{news}, @code{nntp}, and @code{snews} schemes, defined in RFC
491The network news URL scheme take the following forms following RFC 6231738, are used for reading Usenet newsgroups. For compatibility with
4921738 except that for compatibility with other clients, host and port 624non-standard-compliant news clients, the @code{url} library allows
493fields may be included in news URLs though they are properly only 625host and port fields to be included in @code{news} URLs, even though
494allowed for nntp an snews. 626they are properly only allowed for @code{nntp} and @code{snews}.
627
628 @code{news} and @code{nntp} URLs have the following form:
495 629
496@table @samp 630@table @samp
497@item news:@var{newsgroup} 631@item news:@var{newsgroup}
@@ -506,24 +640,22 @@ Retrieves a list of all available newsgroups;
506Similar to the @samp{news} versions. 640Similar to the @samp{news} versions.
507@end table 641@end table
508 642
509@samp{:@var{port}} is optional and defaults to :119. 643 The default port for @code{nntp} (and @code{news}) is 119. The
510 644difference between an @code{nntp} URL and a @code{news} URL is that an
511@samp{snews} is the same as @samp{nntp} except that the default port 645@code{nttp} URL may specify an article by its number. The
512is :563. 646@samp{snews} scheme is the same as @samp{nntp}, except that it is
513@cindex SSL 647tunneled through SSL and has default port 563.
514(It is tunneled through SSL.)
515 648
516An @samp{nntp} URL is the same as a news URL, except that the URL may 649 These URLs are retrieved via the Gnus package.
517specify an article by its number.
518 650
519@defopt url-news-server
520This variable can be used to override the default news server.
521Usually this will be set by the Gnus package, which is used to fetch
522news.
523@cindex environment variable 651@cindex environment variable
524@vindex NNTPSERVER 652@vindex NNTPSERVER
525It may be set from the conventional environment variable 653@defopt url-news-server
526@code{NNTPSERVER}. 654This variable specifies the default news server from which to fetch
655news, if no server was specified in the URL. The default value,
656@code{nil}, means to use the server specified by the standard
657environment variable @samp{NNTPSERVER}, or @samp{news} if that
658environment variable is unset.
527@end defopt 659@end defopt
528 660
529@node rlogin/telnet/tn3270 661@node rlogin/telnet/tn3270
@@ -534,12 +666,15 @@ It may be set from the conventional environment variable
534@cindex terminal emulation 666@cindex terminal emulation
535@findex terminal-emulator 667@findex terminal-emulator
536 668
537These URL schemes from RFC 1738 for logon via a terminal emulator have 669These URL schemes are defined in RFC 1738, and are used for logging in
538the form 670via a terminal emulator. They have the form
671
539@example 672@example
540telnet://@var{user}:@var{password}@@@var{host}:@var{port} 673telnet://@var{user}:@var{password}@@@var{host}:@var{port}
541@end example 674@end example
542but the @code{:@var{password}} component is ignored. 675
676@noindent
677but the @var{password} component is ignored.
543 678
544To handle rlogin, telnet and tn3270 URLs, a @code{rlogin}, 679To handle rlogin, telnet and tn3270 URLs, a @code{rlogin},
545@code{telnet} or @code{tn3270} (the program names and arguments are 680@code{telnet} or @code{tn3270} (the program names and arguments are
@@ -553,39 +688,43 @@ Well-known ports are used if the URL does not specify a port.
553@cindex ZEN IRC 688@cindex ZEN IRC
554@cindex ERC 689@cindex ERC
555@cindex rcirc 690@cindex rcirc
556@c Fixme: reference (was http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt) 691
557@dfn{Internet Relay Chat} (IRC) is handled by handing off the @sc{irc} 692 The @code{irc} scheme is defined in the Internet Draft at
558session to a function named in @code{url-irc-function}. 693@url{http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt} (which
694was never approved as an RFC). Such URLs have the form
695
696@example
697irc://@var{host}:@var{port}/@var{target},@var{needpass}
698@end example
699
700@noindent
701and are retrieved by opening an @acronym{IRC} session using the
702function specified by @code{url-irc-function}.
559 703
560@defopt url-irc-function 704@defopt url-irc-function
561A function to actually open an IRC connection. 705The value of this option is a function, which is called to open an IRC
562This function 706connection for @code{irc} URLs. This function must take five
563must take five arguments, @var{host}, @var{port}, @var{channel}, 707arguments, @var{host}, @var{port}, @var{channel}, @var{user} and
564@var{user} and @var{password}. The @var{channel} argument specifies the 708@var{password}. The @var{channel} argument specifies the channel to
565channel to join immediately, this can be @code{nil}. By default this is 709join immediately, and may be @code{nil}.
566@code{url-irc-rcirc}. 710
711The default is @code{url-irc-rcirc}, which uses the Rcirc package.
712Other options are @code{url-irc-erc} (which uses ERC) and
713@code{url-irc-zenirc} (which uses ZenIRC).
567@end defopt 714@end defopt
568@defun url-irc-rcirc host port channel user password
569Processes the arguments and lets @code{rcirc} handle the session.
570@end defun
571@defun url-irc-erc host port channel user password
572Processes the arguments and lets @code{ERC} handle the session.
573@end defun
574@defun url-irc-zenirc host port channel user password
575Processes the arguments and lets @code{zenirc} handle the session.
576@end defun
577 715
578@node data 716@node data
579@section data 717@section data
580@cindex data URLs 718@cindex data URLs
581 719
720 The @code{data} scheme, defined in RFC 2397, contains MIME data in
721the URL itself. Such URLs have the form
722
582@example 723@example
583data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data} 724data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data}
584@end example 725@end example
585 726
586Data URLs contain MIME data in the URL itself. They are defined in 727@noindent
587RFC 2397.
588
589@var{media-type} is a MIME @samp{Content-Type} string, possibly 728@var{media-type} is a MIME @samp{Content-Type} string, possibly
590including parameters. It defaults to 729including parameters. It defaults to
591@samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be 730@samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be
@@ -598,14 +737,14 @@ present, the @var{data} are base64-encoded.
598@cindex Network File System 737@cindex Network File System
599@cindex automounter 738@cindex automounter
600 739
740The @code{nfs} scheme, defined in RFC 2224, is similar to @code{ftp}
741except that it points to a file on a remote host that is handled by an
742NFS automounter on the local host. Such URLs have the form
743
601@example 744@example
602nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 745nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
603@end example 746@end example
604 747
605The @samp{nfs:} scheme is defined in RFC 2224. It is similar to
606@samp{ftp:} except that it points to a file on a remote host that is
607handled by the automounter on the local host.
608
609@defvar url-nfs-automounter-directory-spec 748@defvar url-nfs-automounter-directory-spec
610@end defvar 749@end defvar
611A string saying how to invoke the NFS automounter. Certain @samp{%} 750A string saying how to invoke the NFS automounter. Certain @samp{%}
@@ -628,15 +767,6 @@ A literal @samp{%}.
628 767
629Each can be used any number of times. 768Each can be used any number of times.
630 769
631@node cid
632@section cid
633@cindex Content-ID
634
635RFC 2111
636
637@node about
638@section about
639
640@node ldap 770@node ldap
641@section ldap 771@section ldap
642@cindex LDAP 772@cindex LDAP
@@ -644,50 +774,21 @@ RFC 2111
644 774
645The LDAP scheme is defined in RFC 2255. 775The LDAP scheme is defined in RFC 2255.
646 776
647@node imap
648@section imap
649@cindex IMAP
650
651RFC 2192
652
653@node man 777@node man
654@section man 778@section man
655@cindex @command{man} 779@cindex @command{man}
656@cindex Unix man pages 780@cindex Unix man pages
657@findex man 781@findex man
658 782
783The @code{man} scheme is a non-standard one. Such URLs have the form
784
659@example 785@example
660@samp{man:@var{page-spec}} 786@samp{man:@var{page-spec}}
661@end example 787@end example
662 788
663This is a non-standard scheme. @var{page-spec} is passed directly to 789@noindent
664the Lisp @code{man} function. 790and are retrieved by passing @var{page-spec} to the Lisp function
665 791@code{man}.
666@node Defining New URLs
667@chapter Defining New URLs
668
669@menu
670* Naming conventions::
671* Required functions::
672* Optional functions::
673* Asynchronous fetching::
674* Supporting file-name-handlers::
675@end menu
676
677@node Naming conventions
678@section Naming conventions
679
680@node Required functions
681@section Required functions
682
683@node Optional functions
684@section Optional functions
685
686@node Asynchronous fetching
687@section Asynchronous fetching
688
689@node Supporting file-name-handlers
690@section Supporting file-name-handlers
691 792
692@node General Facilities 793@node General Facilities
693@chapter General Facilities 794@chapter General Facilities
@@ -1108,11 +1209,9 @@ You can use this function to do completion of URLs from the history.
1108@node Customization 1209@node Customization
1109@chapter Customization 1210@chapter Customization
1110 1211
1111@section Environment Variables
1112
1113@cindex environment variables 1212@cindex environment variables
1114The following environment variables affect the library's operation at 1213 The following environment variables affect the @code{url} library's
1115startup. 1214operation at startup.
1116 1215
1117@table @code 1216@table @code
1118@item TMPDIR 1217@item TMPDIR
@@ -1122,10 +1221,21 @@ If this is defined, @var{url-temporary-directory} is initialized from
1122it. 1221it.
1123@end table 1222@end table
1124 1223
1125@section General User Options 1224 The following user options affect the general operation of
1225@code{url} library.
1126 1226
1127The following user options, settable with Customize, affect the 1227@defopt url-configuration-directory
1128general operation of the package. 1228@cindex configuration files
1229The value of this variable specifies the name of the directory where
1230the @code{url} library stores its various configuration files, cache
1231files, etc.
1232
1233The default value specifies a subdirectory named @file{url/} in the
1234standard Emacs user data directory specified by the variable
1235@code{user-emacs-directory} (normally @file{~/.emacs.d}). However,
1236the old default was @file{~/.url}, and this directory is used instead
1237if it exists.
1238@end defopt
1129 1239
1130@defopt url-debug 1240@defopt url-debug
1131@cindex debugging 1241@cindex debugging