Commits

steveb  committed af81fab

Update to webster-www.el

  • Participants
  • Parent commits a5ee79b

Comments (0)

Files changed (3)

+1998-04-05  Tomasz Cholewo  <tjchol01@mecca.spd.louisville.edu>
+
+	* webster-www.el (webster-www-thesaurus): New function.
+
 1998-03-30  SL Baur  <steve@altair.xemacs.org>
 
 	* feedmail.el: Updated.
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.04
+VERSION = 1.05
 AUTHOR_VERSION =
 MAINTAINER = XEmacs Development Team <xemacs-beta@xemacs.org>
 PACKAGE = net-utils

File webster-www.el

-;;; webster-www.el --- Look up a word in WWW Merriam-Webster dictionary
+;;; webster-www.el --- Look up a word in WWW Merriam-Webster dictionaries
 
-;; Copyright (c) 1997 by Tomasz J. Cholewo <t.cholewo@ieee.org>
+;; Copyright (c) 1997, 1998 Tomasz Cholewo <t.cholewo@ieee.org>
 
-;; Created: 1997/03/10 
-;; Version: 1.0
+;; Authors: Tomasz Cholewo <t.cholewo@ieee.org>
+;;          Soren Dayton <csdayton@cs.uchicago.edu>
+;; Modified: 1998/04/05
+;; Version: 1.2
 ;; Keywords: comm, hypermedia
 
 ;; This file is part of XEmacs.
 
 ;;; Code:
 
-(defvar webster-url "http://www.m-w.com/cgi-bin/mweb?book=Dictionary&va="
-  "URL to reference for Webster's dictionary.")
+(defcustom webster-www-url-format "http://www.m-w.com/cgi-bin/mweb?book=%s&va=%s"
+  "URL format to reference for Webster's dictionaries.
+It is used in a call to `format' with a book name
+(\"Dictionary\" or \"Thesaurus\") as its first argument
+and a word to look up as its second argument."
+  :type 'string)
 
-;;;###autoload
-(defun webster-www (arg)
-"Look up a word in the Webster's dictionary at http://www.m-w.com using WWW."
-  (interactive (list
-		(let ((prompt (concat "Look up word in webster ("
-				      (current-word) "): ")))
-		     (read-string prompt))))
+(defun webster-www-dictionary (arg)
+  "Look up a word in Webster Dictionary at http://www.m-w.com."
+  (interactive (list (webster-www-prompt "Dictionary")))
+  (webster-www-fetch "Dictionary" arg))
+
+(fset 'webster-www (symbol-function 'webster-www-dictionary))
+
+(defun webster-www-thesaurus (arg)
+  "Look up a word in Webster Thesaurus at http://www.m-w.com."
+  (interactive (list (webster-www-prompt "Thesaurus")))
+  (webster-www-fetch "Thesaurus" arg))
+
+(defun webster-www-prompt (book)
+  (let* ((prompt (concat
+	          (concat "Look up word in Webster " book " (")
+ 			  (current-word) "): "))
+         (arg (read-string prompt)))
+    (if (equal "" arg) (current-word) arg)))
+
+(defun webster-www-fetch (book word)
   (require 'url)
   (require 'w3-forms)
-  (if (equal "" arg) (setq arg (current-word)))
-  (funcall browse-url-browser-function
-	   (concat
-	     webster-url
-	    (w3-form-encode-xwfu arg))))
+  (require 'browse-url)
+  (browse-url
+   (format webster-www-url-format
+ 	   book
+ 	   (w3-form-encode-xwfu word))))
 
 (provide 'webster-www)