Next: Concept Index Prev: Data Structures Up: Programming Interface
I have done quite a bit of work trying to make a semi-clean
interface to the internals of W3. Here is a list of functions that you
can use to take advantage of the World Wide Web.
This will set the current buffer to be `w3-working-buffer',
creating it if necessary, and erase it. This should usually be
called before retrieving URLs.
This will take a buffer of HTML markup (which should be in
`w3-working-buffer'), and convert it into LaTeX. This is an
adaptation of the simple sed scripts from Cern. Does as good a
job as the html2latex program, and I usually prefer its formatting
This functions takes a file extension and returns the corresponding
MIME-type, as defined in `w3-mime-extensions'. For example,
`(w3-extension-to-mime ".gif")' would return `"image/gif"'.
This function takes a URL as its only argument. It then attempts to
retrieve the URL using the specified method, using data (if any)
as the body of the MIME request. For example: `(w3-fetch
"http://cs.indiana.edu/")' would retrieve the Indiana University
CS home page and parse it as HTML.
This function takes a string, and removes all HTML[+] entity
references from it, replacing them with the correct character(s).
It consults the variable `w3-html-entities' for the entity names
and translations. For example, `(w3-fix-entities-in-string
">testing<&")' would return `">testing<&"'.
This function takes a string, and returns the first unique buffer
name using that string as a base. For example
`(w3-generate-new-buffer-name "new-buff")' would return
`"new-buff<1>"' if buffer `new-buff' already existed.
This functions returns a string that represents a unique filename
in the /tmp directory. For example,
`(w3-generate-unique-filename)' would return
`"/tmp/w3-tmp129440"'. The filename is arrived at by using a
unique prefix (w3-tmp), the uid of the current user (12944 in my
case), and a number that is incremented if a file already exists.
Return the name of a buffer (if any) that is visiting URL.
`w3-create-mime-request (fname ref-url)'
Create a MIME request for the file fname. The Referer: field of
the HTTP/1.0 request is set to the value of ref-url if necessary.
Returns a string that can be sent to an HTTP server. The request
uses several variables that control how the request looks.
If the value of `w3-current-server' is found in the assoc list of
`w3-bad-server-list', then the basic HTTP/0.9 request type is used.
This loses lots of information and server-side typing of files,
but it is necessary for some older HTTP/0.9 servers that can't
understand the newer, longer HTTP/1.0 requests.
If the value of `w3-request-extra-headers' is non-`nil', then it
will be used as extra MIME headers in the
This function returns the url at a point specified by an optional
argument. If no argument is given to the function (point) is used.
Tries to find the url closest to that point, but does not change
the users position in the buffer. Has a preference for looking
backward when not directly on a URL.
This function takes a string and replaces any characters that are
not acceptable in a URL with the "escaped" encoding that is
standard for URLs (replaces the character with a % followed by the
hexadecimal representation of the ASCII value of the character).
For example, `(w3-hexify-string "this is a test")' would return
This function takes a string and replaces any occurences of HTML[+]
reserved characters with the corresponding entity definitions. For
example, `(w3-insert-entities-in-string "<testing>")' would return
This functions takes a string specifying a MIME content-type, and
returns a string or symbol. If it returns a string, it specifies a
shell command to execute to view that type of file. This string
can be passed to 'format with a file name to get the complete
command to use. If it is a symbol, it represents an Emacs lisp
function to call with no arguments.
This function takes the same parameters as `open-network-stream',
and functions similarly. It takes a process name, a buffer name,
a host name, and a port number or server name. It attempts to
open a network connection to the remote host on the specified
port/service name, with output going to the buffer. It returns
the process object that is the network connection. This function
is different from `open-network-stream' in that it allows you to
use programs in a subprocess to emulate a network connection.
This is necessary if you are behind a firewall, or something
similar. If the variable `w3-use-telnet' is `t', then the program
specified by `w3-telnet-prog' will be run in an asynchronous
subprocess. This program should expect a command line of the form
`w3-telnet-prog hostname portnumber', and feed anything on its
standard input to the remote machine.
This function takes 3 arguments, a URL, a method type, and a data
block. It then attempts to retrieve the URL using the specified
method, using data (if any) as the body of the MIME request. For
example: `(w3-fetch "http://cs.indiana.edu/" "GET" nil)' would
retrieve the Indiana University CS home page. This function will
do no parsing of the retrieved page, and leaves you in the buffer
containing the document you requested. Any HTTP/1.0
redirection/authorization is done before this function exits.
This is the opposite of `w3-hexify-string'. It removes any %XXX
encoded characters in a string. For example `(w3-unhex-string
"this%20is%20a%20test")' would return `"this is a test"'.
This function takes a start and end position in the current buffer
as its arguments, and converts all the text to uppercase, except
for text between < and >, and it also ignores HTML[+] entity
references (ie: `<'). This is useful for converting regions to
uppercase without corrupting any URLs within it.
This function returns the URL of the zone under point (if no zone
is under point, then it returns nil). If the optional argument is
`nil', then the URL is also displayed in the minibuffer.
This function returns the URL of current document. If the optional
argument is `nil', then the URL is also displayed in the
automatically generated by info2www