Mercurial > emacs
annotate lisp/net/webjump.el @ 78261:11b29cb54da6
Switch license to GPLv3 or later.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 25 Jul 2007 05:19:07 +0000 |
parents | 84cf1e2214c5 |
children | 6888fd3398e8 b98604865ea0 |
rev | line source |
---|---|
28210 | 1 ;;; webjump.el --- programmable Web hotlist |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41948
diff
changeset
|
2 |
74509 | 3 ;; Copyright (C) 1996, 1997, 2001, 2002, 2003, 2004, |
75347 | 4 ;; 2005, 2006, 2007 Free Software Foundation, Inc. |
28210 | 5 |
6 ;; Author: Neil W. Van Dyke <nwv@acm.org> | |
7 ;; Created: 09-Aug-1996 | |
8 ;; Keywords: comm www | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
78230
84cf1e2214c5
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77892
diff
changeset
|
14 ;; the Free Software Foundation; either version 3, or (at your option) |
28210 | 15 ;; any later version. |
16 | |
17 ;; GNU Emacs 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 | |
20 ;; GNU 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 | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
28210 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;; WebJump provides a sort of ``programmable hotlist'' of Web sites that can | |
30 ;; quickly be invoked in your Web browser. Each Web site in the hotlist has a | |
31 ;; name, and you select the desired site name via a completing string prompt in | |
32 ;; the minibuffer. The URL for each Web site is defined as a static string or | |
33 ;; a built-in or custom function, allowing interactive prompting for | |
34 ;; site-specific queries and options. | |
35 | |
36 ;; Note that WebJump was originally intended to complement your conventional | |
37 ;; browser-based hotlist, not replace it. (Though there's no reason you | |
38 ;; couldn't use WebJump for your entire hotlist if you were so inclined.) | |
39 | |
40 ;; The `webjump-sites' variable, which defines the hotlist, defaults to some | |
41 ;; example sites. You'll probably want to override it with your own favorite | |
42 ;; sites. The documentation for the variable describes the syntax. | |
43 | |
44 ;; You may wish to add something like the following to your `.emacs' file: | |
45 ;; | |
46 ;; (require 'webjump) | |
47 ;; (global-set-key "\C-cj" 'webjump) | |
48 ;; (setq webjump-sites | |
49 ;; (append '( | |
50 ;; ("My Home Page" . "www.someisp.net/users/joebobjr/") | |
51 ;; ("Pop's Site" . "www.joebob-and-son.com/") | |
52 ;; ) | |
53 ;; webjump-sample-sites)) | |
54 ;; | |
55 ;; The above loads this package, binds `C-c j' to invoke WebJump, and adds your | |
56 ;; personal favorite sites to the hotlist. | |
57 | |
58 ;; The `webjump-sample-sites' variable mostly contains some site entries that | |
59 ;; are expected to be generally relevant to many users, but excluding | |
60 ;; those that the GNU project would not want to recommend. | |
61 | |
62 ;; The `browse-url' package is used to submit URLs to the browser, so any | |
63 ;; browser-specific configuration should be done there. | |
64 | |
65 ;;; Code: | |
66 | |
67 ;;-------------------------------------------------------- Package Dependencies | |
68 | |
69 (require 'browse-url) | |
70 | |
71 ;;------------------------------------------------------------------- Constants | |
72 | |
73 (defvar webjump-sample-sites | |
74 '( | |
75 ;; FSF, not including Emacs-specific. | |
76 ("GNU Project FTP Archive" . | |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
77 ;; GNU FTP Mirror List from http://www.gnu.org/order/ftp.html |
28210 | 78 [mirrors "ftp://ftp.gnu.org/pub/gnu/" |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
79 ;; United States |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
80 "ftp://mirrors.kernel.org/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
81 "ftp://gatekeeper.dec.com/pub/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
82 "ftp://ftp.keystealth.org/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
83 "ftp://mirrors.usc.edu/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
84 "ftp://cudlug.cudenver.edu/pub/mirrors/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
85 "ftp://ftp.cise.ufl.edu/pub/mirrors/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
86 "ftp://uiarchive.cso.uiuc.edu/pub/ftp/ftp.gnu.org/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
87 "ftp://gnu.cs.lewisu.edu/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
88 "ftp://ftp.in-span.net/pub/mirrors/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
89 "ftp://gnu.ms.uky.edu/pub/mirrors/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
90 "ftp://ftp.algx.net/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
91 "ftp://aeneas.mit.edu/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
92 "ftp://ftp.egr.msu.edu/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
93 "ftp://ftp.wayne.edu/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
94 "ftp://wuarchive.wustl.edu/mirrors/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
95 "ftp://gnu.teleglobe.net/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
96 "ftp://ftp.cs.columbia.edu/archives/gnu/prep/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
97 "ftp://ftp.ece.cornell.edu/pub/mirrors/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
98 "ftp://ftp.ibiblio.org/pub/mirrors/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
99 "ftp://ftp.cis.ohio-state.edu/mirror/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
100 "ftp://ftp.club.cc.cmu.edu/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
101 "ftp://ftp.sunsite.utk.edu/pub/gnu/ftp/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
102 "ftp://thales.memphis.edu/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
103 "ftp://gnu.wwc.edu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
104 "ftp://ftp.twtelecom.net/pub/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
105 ;; Africa |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
106 "ftp://ftp.sun.ac.za/mirrorsites/ftp.gnu.org" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
107 ;; The Americas |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
108 "ftp://ftp.unicamp.br/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
109 "ftp://master.softaplic.com.br/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
110 "ftp://ftp.matrix.com.br/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
111 "ftp://ftp.pucpr.br/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
112 "ftp://ftp.linorg.usp.br/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
113 "ftp://ftp.cs.ubc.ca/mirror2/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
114 "ftp://cs.ubishops.ca/pub/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
115 "ftp://ftp.inf.utfsm.cl/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
116 "ftp://sunsite.ulatina.ac.cr/Mirrors/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
117 "ftp://www.gnu.unam.mx/pub/gnu/software/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
118 "ftp://gnu.cem.itesm.mx/pub/mirrors/gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
119 "ftp://ftp.azc.uam.mx/mirrors/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
120 ;; Australia |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
121 "ftp://mirror.aarnet.edu.au/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
122 "ftp://gnu.mirror.pacific.net.au/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
123 ;; Asia |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
124 "ftp://ftp.cs.cuhk.edu.hk/pub/gnu/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
125 "ftp://sunsite.ust.hk/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
126 "ftp://ftp.gnupilgrims.org/pub/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
127 "ftp://www.imtech.res.in/mirror/gnuftp/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
128 "ftp://kambing.vlsm.org/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
129 "ftp://ftp.cs.huji.ac.il/mirror/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
130 "ftp://tron.um.u-tokyo.ac.jp/pub/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
131 "ftp://core.ring.gr.jp/pub/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
132 "ftp://ftp.ring.gr.jp/pub/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
133 "ftp://mirrors.hbi.co.jp/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
134 "ftp://ftp.cs.titech.ac.jp/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
135 "ftp://ftpmirror.hanyang.ac.kr/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
136 "ftp://ftp.linux.sarang.net/mirror/gnu/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
137 "ftp://ftp.xgate.co.kr/pub/mirror/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
138 "ftp://ftp://gnu.xinicks.com/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
139 "ftp://ftp.isu.net.sa/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
140 "ftp://ftp.nctu.edu.tw/UNIX/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
141 "ftp://coda.nctu.edu.tw/UNIX/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
142 "ftp://ftp1.sinica.edu.tw/pub3/GNU/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
143 "ftp://gnu.cdpa.nsysu.edu.tw/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
144 "ftp://ftp.nectec.or.th/pub/mirrors/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
145 ;; Europe |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
146 "ftp://ftp.gnu.vbs.at/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
147 "ftp://ftp.univie.ac.at/packages/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
148 "ftp://gd.tuwien.ac.at/gnu/gnusrc/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
149 "ftp://ftp.belnet.be/mirror/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
150 "ftp://gnu.blic.net/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
151 "ftp://ftp.fi.muni.cz/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
152 "ftp://ftp.dkuug.dk/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
153 "ftp://sunsite.dk/mirrors/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
154 "ftp://ftp.funet.fi/pub/gnu/prep/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
155 "ftp://ftp.irisa.fr/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
156 "ftp://ftp.cs.univ-paris8.fr/mirrors/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
157 "ftp://ftp.cs.tu-berlin.de/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
158 "ftp://ftp.leo.org/pub/comp/os/unix/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
159 "ftp://ftp.informatik.rwth-aachen.de/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
160 "ftp://ftp.de.uu.net/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
161 "ftp://ftp.freenet.de/pub/ftp.gnu.org/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
162 "ftp://ftp.cs.uni-bonn.de/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
163 "ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
164 "ftp://ftp.stw-bonn.de/pub/mirror/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
165 "ftp://ftp.math.uni-bremen.de/pub/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
166 "ftp://ftp.forthnet.gr/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
167 "ftp://ftp.ntua.gr/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
168 "ftp://ftp.duth.gr/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
169 "ftp://ftp.physics.auth.gr/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
170 "ftp://ftp.esat.net/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
171 "ftp://ftp.heanet.ie/mirrors/ftp.gnu.org" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
172 "ftp://ftp.lugroma2.org/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
173 "ftp://ftp.gnu.inetcosmos.org/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
174 "ftp://ftp.digitaltrust.it/pub/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
175 "ftp://ftp://rm.mirror.garr.it/mirrors/gnuftp" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
176 "ftp://ftp.nluug.nl/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
177 "ftp://ftp.mirror.nl/pub/mirror/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
178 "ftp://ftp.nl.uu.net/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
179 "ftp://mirror.widexs.nl/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
180 "ftp://ftp.easynet.nl/mirror/GNU/" |
28210 | 181 "ftp://ftp.win.tue.nl/pub/gnu" |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
182 "ftp://gnu.mirror.vuurwerk.net/pub/GNU/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
183 "ftp://gnu.kookel.org/pub/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
184 "ftp://ftp.uninett.no/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
185 "ftp://ftp.task.gda.pl/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
186 "ftp://sunsite.icm.edu.pl/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
187 "ftp://ftp.man.poznan.pl/pub/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
188 "ftp://ftp.ist.utl.pt/pub/GNU/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
189 "ftp://ftp.telepac.pt/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
190 "ftp://ftp.timisoara.roedu.net/mirrors/ftp.gnu.org/pub/gnu" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
191 "ftp://ftp.chg.ru/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
192 "ftp://gnuftp.axitel.ru/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
193 "ftp://ftp.arnes.si/software/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
194 "ftp://ftp.etsimo.uniovi.es/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
195 "ftp://ftp.rediris.es/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
196 "ftp://ftp.chl.chalmers.se/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
197 "ftp://ftp.isy.liu.se/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
198 "ftp://ftp.luth.se/pub/unix/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
199 "ftp://ftp.stacken.kth.se/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
200 "ftp://ftp.sunet.se/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
201 "ftp://sunsite.cnlab-switch.ch/mirror/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
202 "ftp://ftp.ulak.net.tr/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
203 "ftp://ftp.gnu.org.ua" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
204 "ftp://ftp.mcc.ac.uk/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
205 "ftp://ftp.mirror.ac.uk/sites/ftp.gnu.org/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
206 "ftp://ftp.warwick.ac.uk/pub/gnu/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
207 "ftp://ftp.hands.com/ftp.gnu.org/" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
208 "ftp://gnu.teleglobe.net/ftp.gnu.org/"]) |
28210 | 209 ("GNU Project Home Page" . "www.gnu.org") |
210 | |
211 ;; Emacs. | |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
212 ("Emacs Home Page" . |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
213 "www.gnu.org/software/emacs/emacs.html") |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
214 ("Savannah Emacs page" . |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
215 "savannah.gnu.org/projects/emacs") |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
216 ("Emacs Lisp List" . |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
217 "www.damtp.cam.ac.uk/user/eglen/emacs/ell.html") |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
218 ("Emacs Wiki" . |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
219 [simple-query "www.emacswiki.org" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
220 "www.emacswiki.org/cgi-bin/wiki/" ""]) |
28210 | 221 |
222 ;; Internet search engines. | |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
223 ("Google" . |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
224 [simple-query "www.google.com" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
225 "www.google.com/search?q=" ""]) |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
226 ("Google Groups" . |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
227 [simple-query "groups.google.com" |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
228 "groups.google.com/groups?q=" ""]) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41948
diff
changeset
|
229 ("Yahoo" . |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
230 [simple-query "www.yahoo.com" "search.yahoo.com/search?p=" ""]) |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
231 ("Yahoo: Reference" . "www.yahoo.com/Reference/") |
28210 | 232 |
77892
5e72d285d2fe
(webjump-sample-sites): Add Wikipedia query.
Chong Yidong <cyd@stupidchicken.com>
parents:
75347
diff
changeset
|
233 ("Wikipedia" . |
5e72d285d2fe
(webjump-sample-sites): Add Wikipedia query.
Chong Yidong <cyd@stupidchicken.com>
parents:
75347
diff
changeset
|
234 [simple-query "wikipedia.org" "wikipedia.org/wiki/" ""]) |
5e72d285d2fe
(webjump-sample-sites): Add Wikipedia query.
Chong Yidong <cyd@stupidchicken.com>
parents:
75347
diff
changeset
|
235 |
28210 | 236 ;; Misc. general interest. |
237 ("Interactive Weather Information Network" . webjump-to-iwin) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41948
diff
changeset
|
238 ("Usenet FAQs" . |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
239 "www.faqs.org/faqs/") |
28210 | 240 ("RTFM Usenet FAQs by Group" . |
241 "ftp://rtfm.mit.edu/pub/usenet-by-group/") | |
242 ("RTFM Usenet FAQs by Hierachy" . | |
243 "ftp://rtfm.mit.edu/pub/usenet-by-hierarchy/") | |
244 ("X Consortium Archive" . "ftp.x.org") | |
245 | |
246 ;; Computer social issues, privacy, professionalism. | |
247 ("Association for Computing Machinery" . "www.acm.org") | |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
248 ("Computer Professionals for Social Responsibility" . "www.cpsr.org") |
28210 | 249 ("Electronic Frontier Foundation" . "www.eff.org") |
250 ("IEEE Computer Society" . "www.computer.org") | |
251 ("Risks Digest" . webjump-to-risks) | |
252 | |
67915
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
253 ;; More. |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
254 ("Supplemental Web site list for webjump" . |
13c47acdfe5c
(webjump-sample-sites): Update URLs.
Juri Linkov <juri@jurta.org>
parents:
64701
diff
changeset
|
255 "www.neilvandyke.org/webjump/") |
28210 | 256 |
257 ) | |
258 "Sample hotlist for WebJump. See the documentation for the `webjump' | |
259 function and the `webjump-sites' variable.") | |
260 | |
261 (defvar webjump-state-to-postal-alist | |
262 '(("Alabama" . "al") ("Alaska" . "ak") ("Arizona" . "az") ("Arkansas" . "ar") | |
263 ("California" . "ca") ("Colorado" . "co") ("Connecticut" . "ct") | |
264 ("Delaware" . "de") ("Florida" . "fl") ("Georgia" . "ga") ("Hawaii" . "hi") | |
265 ("Idaho" . "id") ("Illinois" . "il") ("Indiana" . "in") ("Iowa" . "ia") | |
266 ("Kansas" . "ks") ("Kentucky" . "ky") ("Louisiana" . "la") ("Maine" . "me") | |
267 ("Maryland" . "md") ("Massachusetts" . "ma") ("Michigan" . "mi") | |
268 ("Minnesota" . "mn") ("Mississippi" . "ms") ("Missouri" . "mo") | |
269 ("Montana" . "mt") ("Nebraska" . "ne") ("Nevada" . "nv") | |
270 ("New Hampshire" . "nh") ("New Jersey" . "nj") ("New Mexico" . "nm") | |
271 ("New York" . "ny") ("North Carolina" . "nc") ("North Dakota" . "nd") | |
272 ("Ohio" . "oh") ("Oklahoma" . "ok") ("Oregon" . "or") | |
273 ("Pennsylvania" . "pa") ("Rhode Island" . "ri") ("South Carolina" . "sc") | |
274 ("South Dakota" . "sd") ("Tennessee" . "tn") ("Texas" . "tx") | |
275 ("Utah" . "ut") ("Vermont" . "vt") ("Virginia" . "va") | |
276 ("Washington" . "wa") ("West Virginia" . "wv") ("Wisconsin" . "wi") | |
277 ("Wyoming" . "wy"))) | |
278 | |
279 ;;------------------------------------------------------------ Option Variables | |
280 | |
281 (defvar webjump-sites | |
282 webjump-sample-sites | |
283 "*Hotlist for WebJump. | |
284 | |
285 The hotlist is represented as an association list, with the CAR of each cell | |
286 being the name of the Web site, and the CDR being the definition for the URL of | |
287 that site. The URL definition can be a string (the URL), a vector (specifying | |
288 a special \"builtin\" which returns a URL), a symbol (name of a function which | |
289 returns a URL), or a list (which when `eval'ed yields a URL). | |
290 | |
291 If the URL definition is a vector, then a \"builtin\" is used. A builtin has a | |
292 Lisp-like syntax, with the name as the first element of the vector, and any | |
293 arguments as the following elements. The three current builtins are `name', | |
294 which returns the name of the site as the URL, `simple-query', which | |
295 returns a URL that is a function of a query entered by the user, and `mirrors', | |
296 which allows the user to select from among multiple mirror sites for the same | |
297 content. | |
298 | |
299 The first argument to the `simple-query' builtin is a static URL to use if the | |
300 user enters a blank query. The second and third arguments are the prefix and | |
301 suffix, respectively, to add to the encoded query the user enters. This | |
302 builtin covers Web sites that have single-string searches with the query | |
303 embedded in the URL. | |
304 | |
305 The arguments to the `mirrors' builtin are URLs of mirror sites. | |
306 | |
307 If the symbol of a function is given, then the function will be called with the | |
308 Web site name (the one you specified in the CAR of the alist cell) as a | |
309 parameter. This might come in handy for various kludges. | |
310 | |
311 For convenience, if the `http://', `ftp://', or `file://' prefix is missing | |
312 from a URL, WebJump will make a guess at what you wanted and prepend it before | |
313 submitting the URL.") | |
314 | |
315 ;;------------------------------------------------------- Sample Site Functions | |
316 | |
317 (defun webjump-to-iwin (name) | |
318 (let ((prefix "http://iwin.nws.noaa.gov/") | |
319 (state (webjump-read-choice name "state" | |
320 (append '(("Puerto Rico" . "pr")) | |
321 webjump-state-to-postal-alist)))) | |
322 (if state | |
323 (concat prefix "iwin/" state "/" | |
324 (webjump-read-choice name "option" | |
325 '(("Hourly Report" . "hourly") | |
326 ("State Forecast" . "state") | |
327 ("Local Forecast" . "local") | |
328 ("Zone Forecast" . "zone") | |
329 ("Short-Term Forecast" . "shortterm") | |
330 ("Weather Summary" . "summary") | |
331 ("Public Information" . "public") | |
332 ("Climatic Data" . "climate") | |
333 ("Aviation Products" . "aviation") | |
334 ("Hydro Products" . "hydro") | |
335 ("Special Weather" . "special") | |
336 ("Watches and Warnings" . "warnings")) | |
337 "zone") | |
338 ".html") | |
339 prefix))) | |
340 | |
341 (defun webjump-to-risks (name) | |
342 (let (issue volume) | |
343 (if (and (setq volume (webjump-read-number (concat name " volume"))) | |
344 (setq issue (webjump-read-number (concat name " issue")))) | |
345 (format "catless.ncl.ac.uk/Risks/%d.%02d.html" volume issue) | |
346 "catless.ncl.ac.uk/Risks/"))) | |
347 | |
348 ;;-------------------------------------------------------------- Core Functions | |
349 | |
350 ;;;###autoload | |
351 (defun webjump () | |
352 "Jumps to a Web site from a programmable hotlist. | |
353 | |
354 See the documentation for the `webjump-sites' variable for how to customize the | |
355 hotlist. | |
356 | |
357 Please submit bug reports and other feedback to the author, Neil W. Van Dyke | |
358 <nwv@acm.org>." | |
359 (interactive) | |
360 (let* ((completion-ignore-case t) | |
62122
96701ef6c56d
(webjump): Replace `assoc-ignore-case' by `assoc-string'.
Juanma Barranquero <lekktu@gmail.com>
parents:
53857
diff
changeset
|
361 (item (assoc-string |
28210 | 362 (completing-read "WebJump to site: " webjump-sites nil t) |
62122
96701ef6c56d
(webjump): Replace `assoc-ignore-case' by `assoc-string'.
Juanma Barranquero <lekktu@gmail.com>
parents:
53857
diff
changeset
|
363 webjump-sites t)) |
28210 | 364 (name (car item)) |
365 (expr (cdr item))) | |
366 (browse-url (webjump-url-fix | |
367 (cond ((not expr) "") | |
368 ((stringp expr) expr) | |
369 ((vectorp expr) (webjump-builtin expr name)) | |
370 ((listp expr) (eval expr)) | |
371 ((symbolp expr) | |
372 (if (fboundp expr) | |
373 (funcall expr name) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41948
diff
changeset
|
374 (error "WebJump URL function \"%s\" undefined" |
28210 | 375 expr))) |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28210
diff
changeset
|
376 (t (error "WebJump URL expression for \"%s\" invalid" |
28210 | 377 name))))))) |
378 | |
379 (defun webjump-builtin (expr name) | |
380 (if (< (length expr) 1) | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28210
diff
changeset
|
381 (error "WebJump URL builtin for \"%s\" empty" name)) |
28210 | 382 (let ((builtin (aref expr 0))) |
383 (cond | |
384 ((eq builtin 'mirrors) | |
385 (if (= (length expr) 1) | |
386 (error | |
53857
4fdf85312c1c
(webjump-builtin): Add missing format string
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
387 "WebJump URL builtin \"mirrors\" for \"%s\" needs at least 1 arg" |
4fdf85312c1c
(webjump-builtin): Add missing format string
Andreas Schwab <schwab@suse.de>
parents:
52401
diff
changeset
|
388 name)) |
28210 | 389 (webjump-choose-mirror name (cdr (append expr nil)))) |
390 ((eq builtin 'name) | |
391 name) | |
392 ((eq builtin 'simple-query) | |
393 (webjump-builtin-check-args expr name 3) | |
394 (webjump-do-simple-query name (aref expr 1) (aref expr 2) (aref expr 3))) | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28210
diff
changeset
|
395 (t (error "WebJump URL builtin \"%s\" for \"%s\" invalid" |
28210 | 396 builtin name))))) |
397 | |
398 (defun webjump-builtin-check-args (expr name count) | |
399 (or (= (length expr) (1+ count)) | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28210
diff
changeset
|
400 (error "WebJump URL builtin \"%s\" for \"%s\" needs %d args" |
28210 | 401 (aref expr 0) name count))) |
402 | |
403 (defun webjump-choose-mirror (name urls) | |
404 (webjump-read-url-choice (concat name " mirror") | |
405 urls | |
406 (webjump-mirror-default urls))) | |
407 | |
408 (defun webjump-do-simple-query (name noquery-url query-prefix query-suffix) | |
409 (let ((query (webjump-read-string (concat name " query")))) | |
410 (if query | |
411 (concat query-prefix (webjump-url-encode query) query-suffix) | |
412 noquery-url))) | |
413 | |
414 (defun webjump-mirror-default (urls) | |
415 ;; Note: This should be modified to apply some simple kludges/heuristics to | |
416 ;; pick a site which is likely "close". As a tie-breaker among candidates | |
417 ;; judged equally desirable, randomness might be used. | |
418 (car urls)) | |
419 | |
420 (defun webjump-read-choice (name what choices &optional default) | |
421 (let* ((completion-ignore-case t) | |
422 (choice (completing-read (concat name " " what ": ") choices nil t))) | |
423 (if (webjump-null-or-blank-string-p choice) | |
424 default | |
425 (cdr (assoc choice choices))))) | |
426 | |
427 (defun webjump-read-number (prompt) | |
428 ;; Note: I should make this more robust someday. | |
429 (let ((input (webjump-read-string prompt))) | |
430 (if input (string-to-number input)))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41948
diff
changeset
|
431 |
28210 | 432 (defun webjump-read-string (prompt) |
433 (let ((input (read-string (concat prompt ": ")))) | |
434 (if (webjump-null-or-blank-string-p input) nil input))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
41948
diff
changeset
|
435 |
28210 | 436 (defun webjump-read-url-choice (what urls &optional default) |
437 ;; Note: Convert this to use `webjump-read-choice' someday. | |
438 (let* ((completions (mapcar (function (lambda (n) (cons n n))) | |
439 urls)) | |
440 (input (completing-read (concat what | |
441 ;;(if default " (RET for default)" "") | |
442 ": ") | |
443 completions | |
444 nil | |
445 t))) | |
446 (if (webjump-null-or-blank-string-p input) | |
447 default | |
448 (car (assoc input completions))))) | |
449 | |
450 (defun webjump-null-or-blank-string-p (str) | |
451 (or (null str) (string-match "^[ \t]*$" str))) | |
452 | |
453 (defun webjump-url-encode (str) | |
454 (mapconcat '(lambda (c) | |
455 (cond ((= c 32) "+") | |
456 ((or (and (>= c ?a) (<= c ?z)) | |
457 (and (>= c ?A) (<= c ?Z)) | |
458 (and (>= c ?0) (<= c ?9))) | |
459 (char-to-string c)) | |
460 (t (upcase (format "%%%02x" c))))) | |
461 str | |
462 "")) | |
463 | |
464 (defun webjump-url-fix (url) | |
465 (if (webjump-null-or-blank-string-p url) | |
466 "" | |
467 (webjump-url-fix-trailing-slash | |
468 (cond | |
469 ((string-match "^[a-zA-Z]+:" url) url) | |
470 ((string-match "^/" url) (concat "file://" url)) | |
471 ((string-match "^\\([^\\./]+\\)" url) | |
472 (concat (if (string= (downcase (match-string 1 url)) "ftp") | |
473 "ftp" | |
474 "http") | |
475 "://" | |
476 url)) | |
477 (t url))))) | |
478 | |
479 (defun webjump-url-fix-trailing-slash (url) | |
480 (if (string-match "^[a-zA-Z]+://[^/]+$" url) | |
481 (concat url "/") | |
482 url)) | |
483 | |
484 ;;----------------------------------------------------------------------------- | |
485 | |
486 (provide 'webjump) | |
487 | |
52401 | 488 ;;; arch-tag: f1d20156-0a6f-488b-bd91-f69ee8b6d5cc |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28210
diff
changeset
|
489 ;;; webjump.el ends here |