1 ;;; webster-www.el --- Look up a word in WWW Merriam-Webster dictionaries
3 ;; Copyright (c) 1997, 1998 Tomasz Cholewo <t.cholewo@ieee.org>
5 ;; Authors: Tomasz Cholewo <t.cholewo@ieee.org>
6 ;; Soren Dayton <csdayton@cs.uchicago.edu>
7 ;; Modified: 1998/04/05
9 ;; Keywords: comm, hypermedia
11 ;; This file is part of XEmacs.
13 ;; XEmacs is free software; you can redistribute it and/or modify it
14 ;; under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; XEmacs is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with XEmacs; see the file COPYING. If not, write to the Free
25 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 ;;; Synched up with: not in FSF.
32 (autoload 'w3-form-encode-xwfu "w3-forms"))
34 (defcustom webster-www-url-format "http://www.m-w.com/cgi-bin/mweb?book=%s&va=%s"
35 "URL format to reference for Webster's dictionaries.
36 It is used in a call to `format' with a book name
37 (\"Dictionary\" or \"Thesaurus\") as its first argument
38 and a word to look up as its second argument."
41 (defun webster-www-dictionary (arg)
42 "Look up a word in Webster Dictionary at http://www.m-w.com."
43 (interactive (list (webster-www-prompt "Dictionary")))
44 (webster-www-fetch "Dictionary" arg))
46 (fset 'webster-www (symbol-function 'webster-www-dictionary))
48 (defun webster-www-thesaurus (arg)
49 "Look up a word in Webster Thesaurus at http://www.m-w.com."
50 (interactive (list (webster-www-prompt "Thesaurus")))
51 (webster-www-fetch "Thesaurus" arg))
53 (defun webster-www-prompt (book)
54 (let* ((prompt (concat
55 (concat "Look up word in Webster " book " (")
56 (current-word) "): "))
57 (arg (read-string prompt)))
58 (if (equal "" arg) (current-word) arg)))
60 (defun webster-www-fetch (book word)
65 (format webster-www-url-format
67 (w3-form-encode-xwfu word))))
69 (provide 'webster-www)
71 ;;; webster-www.el ends here