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