From 4e8c85a7fa218fc538aaf3a4e08ffa9fd6017a3d Mon Sep 17 00:00:00 2001 From: Fumitoshi UKAI Date: Wed, 24 Apr 2002 18:29:35 +0000 Subject: [w3m-dev-en 00730] Re: Patch for a more flexible dictionary lookup * NEWS: rc: use_dictcommand, dictcommand * main.c (execdict): use url_quote_conv() instead of cURLcode() * proto.h (cURLcode): deleted * doc-jp/README.dict: updated From: Fumitoshi UKAI [w3m-dev-en 00729] Re: Patch for a more flexible dictionary lookup * config.h.dist (DICT): define * configure (use_dict): default y * fm.h (DICTCMD): deleted (UseDictCommand): added (DictCommand): added * main.c (execdict): rewrite to use DictCommand, loadGeneralFile() * rc.c (CMT_USE_DICTCOMMAND): added (CMT_DICTCOMMAND): added (params1): use_dictcommand, dictcommand added * doc/README.dict: updated From: Tushar Samant --- doc/README.dict | 57 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 14 deletions(-) (limited to 'doc/README.dict') diff --git a/doc/README.dict b/doc/README.dict index ecb32be..ec4f44d 100644 --- a/doc/README.dict +++ b/doc/README.dict @@ -4,36 +4,65 @@ Dictionary look-up hack for w3m If you have dictionary look-up command (like 'webster'), you can look a word in a document using w3m. This dictionary-lookup code -was contributed by `Rubikitch' (rubikitch@ruby-lang.org). +was contributed by `Rubikitch' (rubikitch@ruby-lang.org), and +further modifed by Tushar Samant (scribble at pobox.com). -2. INSTALL +2. INSTALLATION -To make use of dictionary look-up, you have to change compile -option by hand. After running configure, edit config.h and -change +To make use of dictionary look-up, you currently must change a +compile option by hand. After running configure, edit config.h +and change #undef USE_DICT -into +to #define USE_DICT -and recompile w3m. (You have to recompile dict.c and keybind.c.) +and recompile w3me (i.e. type "make install"). +Note that w3m/0.3+cvs-1.358 or later, USE_DICT is defined by default. -Then prepare a command named 'w3mdict.' For example, if you want -to use 'webster' command, do the following: +Then find or install a CGI program which takes a word as a query +string and prints a response. -% cd /usr/local/bin -% ln -s `which webster` w3mdict +Some ways to do this would be: -In general, w3mdict can be any command that takes a word as an -argument and outputs something onto stdout. + * If you have the 'webster' command, put something like this + in a script called 'w3mdict': + + #!/bin/sh + + echo Content-type: text/plain + echo + webster $QUERY_STRING + + Then install w3mdict as a local CGI (see the local CGI section + of the w3m manual), and set your dictionary options from the + options page of w3m (usually invoked with "o"). + + * If you want this function to look a word up on Google instead, + write a local CGI script like this: + + #!/bin/sh + + google_q='http://google.com/search?btnG=Google&q' + + cat <<_END_ + Content-type: text/plain + W3m-control: GOTO $google_q=$QUERY_STRING + W3m-control: DELETE_PREVBUF + + _END_ + + and set its path as your dictionary-lookup URL option. 3. USAGE -You can use the following two commands. +You can use the following two commands: ESC w Input a word and look it up using w3mdict command. ESC W look up the current word in the buffer. +To change these keys, edit ~/.w3m/keymap and edit lines for the +functions DICT_WORD and DICT_WORD_AT respectively. -- cgit v1.2.3