annotate lisp/packages/webjump.el @ 155:43dd3413c7c7 r20-3b4

Import from CVS: tag r20-3b4
author cvs
date Mon, 13 Aug 2007 09:39:39 +0200
parents 0d2f883870bc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
1 ;;; webjump.el --- programmable Web hotlist
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
2
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
3 ;; Copyright (C) 1996-1997 Free Software Foundation
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
4
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
5 ;; Author: Neil W. Van Dyke <nwv@acm.org>
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
6 ;; Created: 09-Aug-1996
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
7 ;; Keywords: comm www
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
8 ;; X-URL: http://www.cs.brown.edu/people/nwv/
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
9
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
10 ;; This file is part of GNU Emacs.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
11
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
15 ;; any later version.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
16
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
20 ;; GNU General Public License for more details.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
21
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
22 ;; You should have received a copy of the GNU General Public License
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
25 ;; Boston, MA 02111-1307, USA.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
26
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
27 ;;; Change Log:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
28
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
29 ;; [Version 1.5, 02-Jun-1997, nwv@acm.org] Prepared for first inclusion in GNU
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
30 ;; Emacs distribution by merging in RMS' minor changes and moving some sample
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
31 ;; Web site entries out. Also updated Lycos and Yahoo sample entries.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
32
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
33 ;; [Version 1.4, 17-Sep-1996, nwv@acm.org] Removed the evil "defconst-TEST"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
34 ;; that slipped into 1.3. Organized webjump-sample-sites and modified the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
35 ;; content a bit.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
36
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
37 ;; [Version 1.3, 30-Aug-1996, nwv@acm.org] Fixed broken `if' function in
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
38 ;; `webjump-to-javaapi' (bugfix already posted). Added `webjump-to-iwin'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
39 ;; Added comment on purpose of `webjump-sample-sites'. Added
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
40 ;; `webjump-read-choice'.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
41
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
42 ;; [Version 1.2, 16-Aug-1996, nwv@acm.org] Oops, got Gamelan mixed up with
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
43 ;; Digital Espresso somehow. Added `mirrors' builtin and used it for the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
44 ;; sample GNU Archive site. Added some other sample sites. Split sample sites
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
45 ;; out into separate constant. Misc. small changes. Copyright has been
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
46 ;; transferred to the FSF.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
47
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
48 ;; [Version 1.1, 10-Aug-1996, nwv@acm.org] Added missing call to
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
49 ;; `webjump-url-fix' (thanks to Istvan Marko <mi@bgytf.hu> for pointing this
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
50 ;; out). Added ``builtins'' concept in order to support `simple-query' builtin
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
51 ;; for covering the majority of cases. Added a couple more sample sites.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
52
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
53 ;; [Version 1.0, 09-Aug-1996, nwv@acm.org] Wrote initial version and posted to
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
54 ;; gnu.emacs.sources.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
55
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
56 ;;; Commentary:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
57
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
58 ;; WebJump provides a sort of ``programmable hotlist'' of Web sites that can
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
59 ;; quickly be invoked in your Web browser. Each Web site in the hotlist has a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
60 ;; name, and you select the desired site name via a completing string prompt in
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
61 ;; the minibuffer. The URL for each Web site is defined as a static string or
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
62 ;; a built-in or custom function, allowing interactive prompting for
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
63 ;; site-specific queries and options.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
64
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
65 ;; Note that WebJump was originally intended to complement your conventional
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
66 ;; browser-based hotlist, not replace it. (Though there's no reason you
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
67 ;; couldn't use WebJump for your entire hotlist if you were so inclined.)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
68
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
69 ;; The `webjump-sites' variable, which defines the hotlist, defaults to some
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
70 ;; example sites. You'll probably want to override it with your own favorite
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
71 ;; sites. The documentation for the variable describes the syntax.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
72
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
73 ;; You may wish to add something like the following to your `.emacs' file:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
74 ;;
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
75 ;; (require 'webjump)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
76 ;; (global-set-key "\C-cj" 'webjump)
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
77 ;; (setq webjump-sites
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
78 ;; (append '(
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
79 ;; ("My Home Page" . "www.someisp.net/users/joebobjr/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
80 ;; ("Pop's Site" . "www.joebob-and-son.com/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
81 ;; )
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
82 ;; webjump-sample-sites))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
83 ;;
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
84 ;; The above loads this package, binds `C-c j' to invoke WebJump, and adds your
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
85 ;; personal favorite sites to the hotlist.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
86
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
87 ;; The `webjump-sample-sites' variable mostly contains some site entries that
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
88 ;; are expected to be generally relevant to most Emacs users. Some additional
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
89 ;; site entries are defined in the separate and more frequently updated
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
90 ;; `webjump-plus' package, which is available from the author's Web site.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
91
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
92 ;; The `browse-url' package is used to submit URLs to the browser, so any
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
93 ;; browser-specific configuration should be done there.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
94
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
95 ;; WebJump inherits a small amount code from my `altavista.el' package, and is
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
96 ;; intended to obsolete that package.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
97
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
98 ;;; Code:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
99
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
100 ;;-------------------------------------------------------- Package Dependencies
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
101
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
102 (require 'browse-url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
103
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
104 ;;------------------------------------------------------------------- Constants
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
105
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
106 (defvar webjump-version "1.5")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
107
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
108 (defvar webjump-sample-sites
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
109 '(
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
110
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
111 ;; FSF, not including Emacs-specific.
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
112 ("GNU Project FTP Archive" .
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
113 [mirrors "ftp://prep.ai.mit.edu/pub/gnu/"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
114 ;; ASIA:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
115 "ftp://ftp.cs.titech.ac.jp"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
116 "ftp://tron.um.u-tokyo.ac.jp/pub/GNU/prep"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
117 "ftp://cair-archive.kaist.ac.kr/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
118 "ftp://ftp.nectec.or.th/pub/mirrors/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
119 ;; AUSTRALIA:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
120 "ftp://archie.au/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
121 "ftp://archie.oz/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
122 "ftp://archie.oz.au/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
123 ;; AFRICA:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
124 "ftp://ftp.sun.ac.za/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
125 ;; MIDDLE-EAST:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
126 "ftp://ftp.technion.ac.il/pub/unsupported/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
127 ;; EUROPE:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
128 "ftp://irisa.irisa.fr/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
129 "ftp://ftp.univ-lyon1.fr/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
130 "ftp://ftp.mcc.ac.uk"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
131 "ftp://unix.hensa.ac.uk/mirrors/uunet/systems/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
132 "ftp://src.doc.ic.ac.uk/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
133 "ftp://ftp.ieunet.ie/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
134 "ftp://ftp.eunet.ch"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
135 "ftp://nic.switch.ch/mirror/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
136 "ftp://ftp.informatik.rwth-aachen.de/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
137 "ftp://ftp.informatik.tu-muenchen.de"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
138 "ftp://ftp.win.tue.nl/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
139 "ftp://ftp.nl.net"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
140 "ftp://ftp.etsimo.uniovi.es/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
141 "ftp://ftp.funet.fi/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
142 "ftp://ftp.denet.dk"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
143 "ftp://ftp.stacken.kth.se"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
144 "ftp://isy.liu.se"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
145 "ftp://ftp.luth.se/pub/unix/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
146 "ftp://ftp.sunet.se/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
147 "ftp://archive.eu.net"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
148 ;; SOUTH AMERICA:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
149 "ftp://ftp.inf.utfsm.cl/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
150 "ftp://ftp.unicamp.br/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
151 ;; WESTERN CANADA:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
152 "ftp://ftp.cs.ubc.ca/mirror2/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
153 ;; USA:
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
154 "ftp://wuarchive.wustl.edu/systems/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
155 "ftp://labrea.stanford.edu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
156 "ftp://ftp.digex.net/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
157 "ftp://ftp.kpc.com/pub/mirror/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
158 "ftp://f.ms.uky.edu/pub3/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
159 "ftp://jaguar.utah.edu/gnustuff"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
160 "ftp://ftp.hawaii.edu/mirrors/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
161 "ftp://uiarchive.cso.uiuc.edu/pub/gnu"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
162 "ftp://ftp.cs.columbia.edu/archives/gnu/prep"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
163 "ftp://gatekeeper.dec.com/pub/GNU"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
164 "ftp://ftp.uu.net/systems/gnu"])
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
165 ("GNU Project Home Page" . "www.fsf.org")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
166
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
167 ;; Emacs.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
168 ("Eieio" . "ftp.ultranet.com/pub/zappo/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
169 ("Emacs Lisp Archive" .
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
170 "ftp://archive.cis.ohio-state.edu/pub/gnu/emacs/elisp-archive/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
171 ("Insidious Big Brother Database" . "home.netscape.com/people/jwz/bbdb/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
172 ("Mailcrypt" . "cag-www.lcs.mit.edu/mailcrypt/")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
173 ("WebJump" . "http://www.cs.brown.edu/people/nwv/projects/webjump/")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
174 ("XEmacs Home" . "www.xemacs.org")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
175 ("Yahoo: Emacs" .
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
176 "www.yahoo.com/Computers_and_Internet/Software/Text_Editors/Emacs/")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
177
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
178 ;; Internet search engines.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
179 ("AltaVista" .
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
180 [simple-query
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
181 "www.altavista.digital.com"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
182 "www.altavista.digital.com/cgi-bin/query?pg=aq&what=web&fmt=.&q="
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
183 "&r=&d0=&d1="])
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
184 ("Archie" .
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
185 [simple-query "hoohoo.ncsa.uiuc.edu/cgi-bin/AA.pl"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
186 "hoohoo.ncsa.uiuc.edu/cgi-bin/AA.pl?query=" ""])
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
187 ("Lycos" .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
188 [simple-query "www.lycos.com"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
189 "www.lycos.com/cgi-bin/pursuit?cat=lycos&query=" ""])
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
190 ("Yahoo" .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
191 [simple-query "www.yahoo.com" "search.yahoo.com/bin/search?p=" ""])
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
192
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
193 ;; Misc. general interest.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
194 ("Interactive Weather Information Network" . webjump-to-iwin)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
195 ("Usenet FAQs" .
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
196 [simple-query "www.cis.ohio-state.edu/hypertext/faq/usenet/FAQ-List.html"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
197 "www.cis.ohio-state.edu/htbin/search-usenet-faqs/form?find="
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
198 ""])
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
199 ("RTFM Usenet FAQs by Group" .
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
200 "ftp://rtfm.mit.edu/pub/usenet-by-group/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
201 ("RTFM Usenet FAQs by Hierachy" .
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
202 "ftp://rtfm.mit.edu/pub/usenet-by-hierarchy/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
203 ("Webster" .
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
204 [simple-query "c.gp.cs.cmu.edu:5103/prog/webster"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
205 "gs213.sp.cs.cmu.edu/prog/webster?" ""])
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
206 ("X Consortium Archive". "ftp.x.org")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
207 ("Yahoo: Reference" . "www.yahoo.com/Reference/")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
208
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
209 ;; Computer social issues, privacy, professionalism.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
210 ("Association for Computing Machinery" . "www.acm.org")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
211 ("Computer Professionals for Social Responsibility" . "www.cpsr.org/dox/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
212 ("Electronic Frontier Foundation" . "www.eff.org")
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
213 ("IEEE Computer Society" . "www.computer.org")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
214 ("Pretty Good Privacy" . "web.mit.edu/network/pgp.html")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
215 ("Risks Digest" . webjump-to-risks)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
216
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
217 ;; Fun.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
218 ("Bastard Operator from Hell" . "www.replay.com/bofh/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
219
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
220 )
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
221 "Sample hotlist for WebJump. See the documentation for the `webjump'
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
222 function and the `webjump-sites' variable.")
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
223
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
224 (defvar webjump-state-to-postal-alist
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
225 '(("Alabama" . "al") ("Alaska" . "ak") ("Arizona" . "az") ("Arkansas" . "ar")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
226 ("California" . "ca") ("Colorado" . "co") ("Connecticut" . "ct")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
227 ("Delaware" . "de") ("Florida" . "fl") ("Georgia" . "ga") ("Hawaii" . "hi")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
228 ("Idaho" . "id") ("Illinois" . "il") ("Indiana" . "in") ("Iowa" . "ia")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
229 ("Kansas" . "ks") ("Kentucky" . "ky") ("Louisiana" . "la") ("Maine" . "me")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
230 ("Maryland" . "md") ("Massachusetts" . "ma") ("Michigan" . "mi")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
231 ("Minnesota" . "mn") ("Mississippi" . "ms") ("Missouri" . "mo")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
232 ("Montana" . "mt") ("Nebraska" . "ne") ("Nevada" . "nv")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
233 ("New Hampshire" . "nh") ("New Jersey" . "nj") ("New Mexico" . "nm")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
234 ("New York" . "ny") ("North Carolina" . "nc") ("North Dakota" . "nd")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
235 ("Ohio" . "oh") ("Oklahoma" . "ok") ("Oregon" . "or")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
236 ("Pennsylvania" . "pa") ("Rhode Island" . "ri") ("South Carolina" . "sc")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
237 ("South Dakota" . "sd") ("Tennessee" . "tn") ("Texas" . "tx")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
238 ("Utah" . "ut") ("Vermont" . "vt") ("Virginia" . "va")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
239 ("Washington" . "wa") ("West Virginia" . "wv") ("Wisconsin" . "wi")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
240 ("Wyoming" . "wy")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
241
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
242 ;;------------------------------------------------------------ Option Variables
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
243
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
244 (defvar webjump-sites
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
245 webjump-sample-sites
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
246 "*Hotlist for WebJump.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
247
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
248 The hotlist is represented as an association list, with the CAR of each cell
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
249 being the name of the Web site, and the CDR being the definition for the URL of
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
250 that site. The URL definition can be a string (the URL), a vector (specifying
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
251 a special \"builtin\" which returns a URL), a symbol (name of a function which
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
252 returns a URL), or a list (which when `eval'ed yields a URL).
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
253
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
254 If the URL definition is a vector, then a \"builtin\" is used. A builtin has a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
255 Lisp-like syntax, with the name as the first element of the vector, and any
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
256 arguments as the following elements. The three current builtins are `name',
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
257 which returns the name of the site as the URL, `simple-query', which
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
258 returns a URL that is a function of a query entered by the user, and `mirrors',
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
259 which allows the user to select from among multiple mirror sites for the same
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
260 content.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
261
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
262 The first argument to the `simple-query' builtin is a static URL to use if the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
263 user enters a blank query. The second and third arguments are the prefix and
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
264 suffix, respectively, to add to the encoded query the user enters. This
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
265 builtin covers Web sites that have single-string searches with the query
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
266 embedded in the URL.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
267
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
268 The arguments to the `mirrors' builtin are URLs of mirror sites.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
269
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
270 If the symbol of a function is given, then the function will be called with the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
271 Web site name (the one you specified in the CAR of the alist cell) as a
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
272 parameter. This might come in handy for various kludges.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
273
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
274 For convenience, if the `http://', `ftp://', or `file://' prefix is missing
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
275 from a URL, WebJump will make a guess at what you wanted and prepend it before
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
276 submitting the URL.")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
277
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
278 ;;------------------------------------------------------- Sample Site Functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
279
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
280 (defun webjump-to-iwin (name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
281 (let ((prefix "http://iwin.nws.noaa.gov/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
282 (state (webjump-read-choice name "state"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
283 (append '(("Puerto Rico" . "pr"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
284 webjump-state-to-postal-alist))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
285 (if state
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
286 (concat prefix "iwin/" state "/"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
287 (webjump-read-choice name "option"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
288 '(("Hourly Report" . "hourly")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
289 ("State Forecast" . "state")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
290 ("Local Forecast" . "local")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
291 ("Zone Forecast" . "zone")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
292 ("Short-Term Forecast" . "shortterm")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
293 ("Weather Summary" . "summary")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
294 ("Public Information" . "public")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
295 ("Climatic Data" . "climate")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
296 ("Aviation Products" . "aviation")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
297 ("Hydro Products" . "hydro")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
298 ("Special Weather" . "special")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
299 ("Watches and Warnings" . "warnings"))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
300 "zone")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
301 ".html")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
302 prefix)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
303
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
304 (defun webjump-to-risks (name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
305 (let (issue volume)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
306 (if (and (setq volume (webjump-read-number (concat name " volume")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
307 (setq issue (webjump-read-number (concat name " issue"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
308 (format "catless.ncl.ac.uk/Risks/%d.%02d.html" volume issue)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
309 "catless.ncl.ac.uk/Risks/")))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
310
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
311 ;;-------------------------------------------------------------- Core Functions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
312
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
313 ;;;###autoload
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
314 (defun webjump ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
315 "Jumps to a Web site from a programmable hotlist.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
316
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
317 See the documentation for the `webjump-sites' variable for how to customize the
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
318 hotlist.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
319
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
320 Please submit bug reports and other feedback to the author, Neil W. Van Dyke
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
321 <nwv@acm.org>.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
322
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
323 The latest version can be gotten from `http://www.cs.brown.edu/people/nwv/'.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
324 That Web site also contains `webjump-plus.el', a larger and more frequently
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
325 updated sample WebJump hotlist."
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
326 (interactive)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
327 (let* ((completion-ignore-case t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
328 (item (assoc (completing-read "WebJump to site: " webjump-sites nil t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
329 webjump-sites))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
330 (name (car item))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
331 (expr (cdr item)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
332 (funcall browse-url-browser-function
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
333 (webjump-url-fix
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
334 (cond ((not expr) "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
335 ((stringp expr) expr)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
336 ((vectorp expr) (webjump-builtin expr name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
337 ((listp expr) (eval expr))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
338 ((symbolp expr)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
339 (if (fboundp expr)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
340 (funcall expr name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
341 (error "WebJump URL function \"%s\" undefined." expr)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
342 (t (error "WebJump URL expression for \"%s\" invalid."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
343 name)))))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
344
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
345 (defun webjump-builtin (expr name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
346 (if (< (length expr) 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
347 (error "WebJump URL builtin for \"%s\" empty." name))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
348 (let ((builtin (aref expr 0)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
349 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
350 ((eq builtin 'mirrors)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
351 (if (= (length expr) 1)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
352 (error
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
353 "WebJump URL builtin \"mirrors\" for \"%s\" needs at least 1 arg."))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
354 (webjump-choose-mirror name (cdr (append expr nil))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
355 ((eq builtin 'name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
356 name)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
357 ((eq builtin 'simple-query)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
358 (webjump-builtin-check-args expr name 3)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
359 (webjump-do-simple-query name (aref expr 1) (aref expr 2) (aref expr 3)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
360 (t (error "WebJump URL builtin \"%s\" for \"%s\" invalid."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
361 builtin name)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
362
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
363 (defun webjump-builtin-check-args (expr name count)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
364 (or (= (length expr) (1+ count))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
365 (error "WebJump URL builtin \"%s\" for \"%s\" needs %d args."
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
366 (aref expr 0) name count)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
367
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
368 (defun webjump-choose-mirror (name urls)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
369 (webjump-read-url-choice (concat name " mirror")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
370 urls
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
371 (webjump-mirror-default urls)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
372
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
373 (defun webjump-do-simple-query (name noquery-url query-prefix query-suffix)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
374 (let ((query (webjump-read-string (concat name " query"))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
375 (if query
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
376 (concat query-prefix (webjump-url-encode query) query-suffix)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
377 noquery-url)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
378
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
379 (defun webjump-mirror-default (urls)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
380 ;; Note: This should be modified to apply some simple kludges/heuristics to
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
381 ;; pick a site which is likely "close". As a tie-breaker among candidates
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents: 98
diff changeset
382 ;; judged equally desirable, randomness might be used.
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
383 (car urls))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
384
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
385 (defun webjump-read-choice (name what choices &optional default)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
386 (let* ((completion-ignore-case t)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
387 (choice (completing-read (concat name " " what ": ") choices nil t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
388 (if (webjump-null-or-blank-string-p choice)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
389 default
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
390 (cdr (assoc choice choices)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
391
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
392 (defun webjump-read-number (prompt)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
393 ;; Note: I should make this more robust someday.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
394 (let ((input (webjump-read-string prompt)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
395 (if input (string-to-number input))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
396
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
397 (defun webjump-read-string (prompt)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
398 (let ((input (read-string (concat prompt ": "))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
399 (if (webjump-null-or-blank-string-p input) nil input)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
400
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
401 (defun webjump-read-url-choice (what urls &optional default)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
402 ;; Note: Convert this to use `webjump-read-choice' someday.
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
403 (let* ((completions (mapcar (function (lambda (n) (cons n n)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
404 urls))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
405 (input (completing-read (concat what
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
406 ;;(if default " (RET for default)" "")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
407 ": ")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
408 completions
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
409 nil
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
410 t)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
411 (if (webjump-null-or-blank-string-p input)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
412 default
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
413 (car (assoc input completions)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
414
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
415 (defun webjump-null-or-blank-string-p (str)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
416 (or (null str) (string-match "^[ \t]*$" str)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
417
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
418 (defun webjump-url-encode (str)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
419 (mapconcat '(lambda (c)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
420 (cond ((= c 32) "+")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
421 ((or (and (>= c ?a) (<= c ?z))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
422 (and (>= c ?A) (<= c ?Z))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
423 (and (>= c ?0) (<= c ?9)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
424 (char-to-string c))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
425 (t (upcase (format "%%%02x" c)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
426 str
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
427 ""))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
428
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
429 (defun webjump-url-fix (url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
430 (if (webjump-null-or-blank-string-p url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
431 ""
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
432 (webjump-url-fix-trailing-slash
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
433 (cond
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
434 ((string-match "^[a-zA-Z]+:" url) url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
435 ((string-match "^/" url) (concat "file://" url))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
436 ((string-match "^\\([^\\./]+\\)" url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
437 (concat (if (string= (downcase (match-string 1 url)) "ftp")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
438 "ftp"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
439 "http")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
440 "://"
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
441 url))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
442 (t url)))))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
443
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
444 (defun webjump-url-fix-trailing-slash (url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
445 (if (string-match "^[a-zA-Z]+://[^/]+$" url)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
446 (concat url "/")
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
447 url))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
448
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
449 ;;-----------------------------------------------------------------------------
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
450
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
451 (provide 'webjump)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
452
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents:
diff changeset
453 ;; webjump.el ends here