From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: Additional dict server for dictionary.el Date: Sat, 1 Nov 2008 03:36:51 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <3f9de495-269b-4533-aecc-c9efe4578687@i24g2000prf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1225536108 30832 80.91.229.12 (1 Nov 2008 10:41:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Nov 2008 10:41:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 01 11:42:49 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KwDwH-0008LP-Rz for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Nov 2008 11:42:42 +0100 Original-Received: from localhost ([127.0.0.1]:56848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KwDvB-0001vq-5R for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Nov 2008 06:41:33 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!o4g2000pra.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 114 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1225535812 12253 127.0.0.1 (1 Nov 2008 10:36:52 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 1 Nov 2008 10:36:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o4g2000pra.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:163981 comp.emacs:97306 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59323 Archived-At: Some more info ... i took a look at the alternative emacs dict client http://sourceforge.net/projects/dictem it turns out that this is merely a wrapper to a real command line client, and is actually orginially based on =E2=80=9Cdictionary.el=E2=80=9D= . this is kinda disappointing. I guess it tries to improve =E2=80=9Cdictionary.el=E2=80=9D but throws real meat, the actual real dict = client, out. -------------- i wrote to the author of dictionary.el Torsten Hilbrich. Here's what he says: =C2=AB There is currently no way to use more than one dictionary server. You could however locally modify dictionary-server in a self-written lisp function like: (defun search-in-1913 (word) (interactive (list (read-string "Search word: " (current-word)))) (let ((dictionary-server "dict.org")) (dictionary-search word "web1913"))) Replace dict.org with the server you use for this dictionary. =C2=BB =C2=ABRegarding the window change you mentioned in the thread. Here is a function you could use in replacement of dictionary-search to get the behaviour you prefer: (defun dictionary-search-other-window (word &optional dictionary) (interactive (list (read-string "Search word: " (current-word)) (if current-prefix-arg (read-string "Dictionary: " dictionary-default-dictionary) dictionary-default-dictionary))) (let ((dictionary-use-single-buffer t)) (dictionary-search word dictionary) (other-window 1))) It switches back to the original window and also let dictionary use a single window to avoid recreating a new dictionary buffer for each request. =C2=BB ---------------------------- i did some digging of the source code. So, effectively you can just do this: (dictionary-new-search (cons "fancy" "wn")) ; look up word in WordNet (dictionary-new-search (cons "fancy" "web1913")) ; look up word in webster 1913 or (dictionary-do-search "fancy" "web1913" 'dictionary-display-search- result) the dictionary-display-search-result function will take the result and format it and display in buffer. But i haven't spent enough time to figure out what's the format passed to dictionary-display-search- result. in anycase, here's a code that does lookup on current word. It different than dictionary-lookup-definition in that if you have a text selection, it'll use that phrase to lookup. This is convenient because quite often emacs's (current-word) does not really pickup the word you want. Including phrases or idioms that has a dict entry but has a space in them. The other change is that the cursor remains where it is. (defun lookup-word-def () "Look up the word's definition in Webster 1913 If a region is active (a phrase), lookup that phrase." (interactive) (let (myword myurl) (setq myword (if (and transient-mark-mode mark-active) (buffer-substring-no-properties (region-beginning) (region-end)) (thing-at-point 'symbol))) (require 'dictionary) (dictionary-new-search (cons myword "web1913")) ; (dictionary-new-search (cons "fancy" "moby-thes")) ; (dictionary-new-search (cons "fancy" "wn")) ; (dictionary-do-search "fancy" "web1913" 'dictionary-display-search- result) (other-window 1) )) you could define several of these and assign them each to a shortcut. e.g. the 0 on keypad, shift-0, ctrl+0, for looking up diff dicts... ideally, i would like one press of a key and have the 3 dicts i want (webster 1913, wordnet, moby thes) all combined in one output. This means i'll have to figure out the format used in dictionary-display- search-result... but currently not priority. PS it odd that the dict protocol does not seem to allow client to specify a _list_ of dicts to use, but it has a =E2=80=9C*=E2=80=9D to mean = what i presume ALL dict that's available on the server. Xah =E2=88=91 http://xahlee.org/ =E2=98=84