Initial Commit
[packages] / xemacs-packages / hyperbole / hsys-w3.el
1 ;;; hsys-w3.el --- Hyperbole support for Emacs W3 World-Wide Web (WWW) browsing.
2
3 ;; Copyright (C) 1994, 1995  Free Software Foundation, Inc.
4 ;; Developed with support from Motorola Inc.
5
6 ;; Author: Bob Weiner, Brown U.
7 ;; Maintainer: Mats Lidell <matsl@contactor.se>
8 ;; Keywords: comm, help, hypermedia
9
10 ;; This file is part of GNU Hyperbole.
11
12 ;; GNU Hyperbole is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 3, or (at
15 ;; your option) any later version.
16
17 ;; GNU Hyperbole is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
26
27 ;;; Commentary:
28 ;;
29 ;;   This module defines an implicit button type and associated action and
30 ;;   help types.  A press of the Action Key on a unified resource locator
31 ;;   (URL) displays the referent for the URL.  A press of the Help Key on a
32 ;;   URL displays a history list of previously browsed WWW documents.  Press
33 ;;   the Action Key on any item from the history list to display it.
34 ;;
35 ;;   This requires the Emacs W3 World-Wide-Web browser available from:
36 ;;     ftp://cs.indiana.edu/pub/elisp/w3/.
37 ;;
38 ;;   It assumes that you have set up to have w3 auto-loaded according to the
39 ;;   setup instructions included with W3.  Specifically, `w3-fetch' should be
40 ;;   autoloaded.
41 ;;
42
43 ;;; Code:
44
45 ;;;
46 ;;; Other required Elisp libraries
47 ;;;
48
49 ;;; Requires that 'w3' or other web browser code that is called be available.
50
51 ;;;
52 ;;; Public functions and types
53 ;;;
54
55 (defib www-url ()
56   "When not in a w3 buffer, follow any non-ftp url (link) at point.
57 Customize `browse-url' for what browser that is used."
58   (if (not (eq major-mode 'w3-mode))
59       (let ((link-and-pos (hpath:www-at-p t)))
60         (if link-and-pos
61             (progn (ibut:label-set link-and-pos)
62                    (hact 'www-url (car link-and-pos)))))))
63
64 (defact www-url (url)
65   "Follows a link given by URL using `browse-url'."
66   (interactive "sURL to follow: ")
67   (or (stringp url)
68       (error "(www-url): Link label must be given as a string."))
69   (funcall 'browse-url url))
70
71 (defun www-url:help (&optional but)
72   "Displays history list of www nodes previously visited with the W3 browser."
73   (interactive)
74   (if (fboundp 'w3-show-history-list)
75       (hact 'w3-show-history-list)
76     (hact 'error "(www-url:help): W3 must be loaded to display WWW history")))
77
78 (provide 'hsys-w3)
79
80 ;;; hsys-w3.el ends here