;;; www-command.el --- Send a command to a WWW site ;; Copyright (c) 2002 by Miguel A. Carreira-Perpinan ;; Time-stamp: <03/03/29 21:39:59 miguel> ;; This file is a modified version of Tomasz J. Cholewo's webster-www.el file. ;------------------------------------------------------------------------ ;; URLs ; ----------------------------------8<---------------------------------- ; Eric Weisstein's World of Mathematics (defvar mathworld-url1 "http://mathworld.wolfram.com/search/?words=" "*URL to reference for Eric Weisstein's World of Mathematics (prefix).") (defvar mathworld-url2 "&config=scienceworld_wolfram_com" "*URL to reference for Eric Weisstein's World of Mathematics (suffix).") ; Britannica.com (defvar britannica-url "http://search.britannica.com/search?query==" "*URL to reference for the Britannica Encyclopaedia.") ; Diccionarios Anaya ; Diccionario VOX Advanced Inglés/Español (defvar anaya-e_s-url "http://www.diccionarios.com/index.phtml?diccionario=engesp&query=" "*URL to reference for Anaya's English-Spanish dictionary (Diccionario VOX Advanced Inglés/Español).") ; Diccionario VOX Advanced Español/Inglés (defvar anaya-s_e-url "http://www.diccionarios.com/index.phtml?diccionario=espeng&query=" "*URL to reference for Anaya's Spanish-English dictionary (Diccionario VOX Advanced Español/Inglés).") ; Diccionario General de la Lengua VOX (defvar anaya-s_vox-url "http://www.diccionarios.com/index.phtml?diccionario=dgle&query=" "*URL to reference for Anaya's VOX Spanish dictionary (Diccionario General de la Lengua Española VOX).") ; Google searcher (defvar google-url "http://www.google.com/search?q=" "*URL to reference for Google search network.") ; Altavista searcher (defvar altavista-url "http://www.altavista.com/cgi-bin/query?mss=gb%2Fsearch&pg=q&country=gb&what=web&kl=&q=%22" "*URL to reference for Altavista search network.") ; W3 validator (defvar w3validator-url "http://validator.w3.org/check?uri=" "*URL to reference for the W3 validator service.") ; ----------------------------------8<---------------------------------- ;;;###autoload (defun mathworld-www (arg) "*Look up a word in Eric Weisstein's World of Mathematics at http://mathworld.wolfram.com/ using WWW." (interactive (list (let ((prompt (concat "Look up word in Eric Weisstein's World of Mathematics (" (current-word) "): "))) (read-string prompt)))) (require 'url) (require 'w3-forms) (if (equal "" arg) (setq arg (current-word))) (funcall browse-url-browser-function (concat mathworld-url1 (w3-form-encode-xwfu arg) mathworld-url2))) (defun britannica-www (arg) "*Look up a word in the Britannica Encyclopaedia." (interactive (list (let ((prompt (concat "Look up word in Britannica.com (" (current-word) "): "))) (read-string prompt)))) (require 'url) (require 'w3-forms) (if (equal "" arg) (setq arg (current-word))) (funcall browse-url-browser-function (concat britannica-url (w3-form-encode-xwfu arg)))) (defun anaya-e_s-www (arg) "*Look up a word in the Anaya's English-Spanish dictionary (Diccionario VOX Advanced Inglés/Español) at http://www3.anaya.es using WWW." (interactive (list (let ((prompt (concat "Look up word in Anaya's English-Spanish dictionary (" (current-word) "): "))) (read-string prompt)))) (require 'url) (require 'w3-forms) (if (equal "" arg) (setq arg (current-word))) (funcall browse-url-browser-function (concat anaya-e_s-url (w3-form-encode-xwfu arg)))) (defun anaya-s_e-www (arg) "*Look up a word in the Anaya's Spanish-English dictionary (Diccionario VOX Advanced Español/Inglés) at http://www3.anaya.es using WWW." (interactive (list (let ((prompt (concat "Look up word in Anaya's Spanish-English dictionary (" (current-word) "): "))) (read-string prompt)))) (require 'url) (require 'w3-forms) (if (equal "" arg) (setq arg (current-word))) (funcall browse-url-browser-function (concat anaya-s_e-url (w3-form-encode-xwfu arg)))) (defun anaya-s_vox-www (arg) "*Look up a word in the Anaya's VOX Spanish dictionary (Diccionario General de la Lengua VOX) at http://www3.anaya.es using WWW." (interactive (list (let ((prompt (concat "Look up word in Anaya's VOX Spanish dictionary (" (current-word) "): "))) (read-string prompt)))) (require 'url) (require 'w3-forms) (if (equal "" arg) (setq arg (current-word))) (funcall browse-url-browser-function (concat anaya-s_vox-url (w3-form-encode-xwfu arg)))) (defun google-www (arg) "*Send a search command to the Google search network." (interactive (list (let ((prompt (concat "Search in Google (" (current-word) "): "))) (read-string prompt)))) (require 'url) (require 'w3-forms) (if (equal "" arg) (setq arg (current-word))) (funcall browse-url-browser-function (concat google-url (w3-form-encode-xwfu arg)))) (defun altavista-www (arg) "*Send a search command to the Altavista search network." (interactive (list (let ((prompt (concat "Search in Altavista (" (current-word) "): "))) (read-string prompt)))) (require 'url) (require 'w3-forms) (if (equal "" arg) (setq arg (current-word))) (funcall browse-url-browser-function (concat altavista-url (w3-form-encode-xwfu arg)))) (defun validate-www-buffer (arg) "*Validate the file being edited in the current buffer in a WWW validator service. Only the saved version of the file is validated, so save it first." (interactive (list (let ((prompt (concat "Validate URI (" (first (last (split-string (buffer-file-name) "/"))) "): "))) (read-string prompt)))) (require 'url) (require 'w3-forms) (if (equal "" arg) (setq arg (first (last (split-string (buffer-file-name) "/"))))) (funcall browse-url-browser-function (concat w3validator-url (getenv "WWW_HOME") (w3-form-encode-xwfu arg)))) (provide 'www-command)