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: Mon, 3 Nov 2008 14:43:28 -0800 (PST) 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 1225755656 32534 80.91.229.12 (3 Nov 2008 23:40:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 3 Nov 2008 23:40:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Nov 04 00:41:55 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 1Kx93Q-0001oH-9Y for geh-help-gnu-emacs@m.gmane.org; Tue, 04 Nov 2008 00:41:52 +0100 Original-Received: from localhost ([127.0.0.1]:59570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kx92J-0002J8-Cb for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Nov 2008 18:40:43 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!u29g2000pro.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 88 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1225752208 10710 127.0.0.1 (3 Nov 2008 22:43:28 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 3 Nov 2008 22:43:28 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u29g2000pro.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:164076 comp.emacs:97314 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:59416 Archived-At: i took some time to solve problem about =E2=80=9Cdictionary.el=E2=80=9D. Now, with the following customized command, one can now effectively select a set of dictionaries as the default dicts to lookup, with their results in one pane. The cursor stays in the original pane. And if the word under cursor is plural, e.g. chairs, or a phrase (e.g. =E2=80=9CUnion Jack=E2=80=9D), you can select parts of the word or phrase, = and the lookup will use that text selection. Here's the code: (defun lookup-word-def () "Look up current word's definition in WordNet, Webster 1913, Moby Thesaurus. If there is a text selection (a phrase), lookup that phrase. This command needs =E2=80=9Cdictionary.el=E2=80=9D installed." (interactive) (let (myword myurl meat navigText pos) (setq myword (if (and transient-mark-mode mark-active) (buffer-substring-no-properties (region-beginning) (region-end)) (thing-at-point 'symbol))) (require 'dictionary) ;; (dictionary-do-search "fancy" "web1913" 'dictionary-display- search-result) (dictionary-new-search (cons myword "wn")) (setq meat (buffer-substring (point-min) (point-max))) (dictionary-new-search (cons myword "web1913")) (setq meat (concat meat (buffer-substring (point-min) (point- max)))) (dictionary-new-search (cons myword "moby-thes")) (setq meat (concat meat (buffer-substring (point-min) (point- max)))) (switch-to-buffer "*my dict results*") (erase-buffer) (dictionary-mode) (insert meat) (goto-char 1) (next-line 2) (setq pos (point)) (setq navigText (buffer-substring 1 pos)) (goto-char 1) ;; remove navigation text (while (search-forward "[Back] [Search Definition] [Matching words] [Quit] [Select Dictionary] [Select Match Strategy] " nil t ) (replace-match "-----------------------------------------------------------------" t t)) ;; remove message about how many def found. e.g. =E2=80=9C1 definition found=E2=80=9D. (goto-char 1) (while (search-forward-regexp "[0-9]+ definitions* found\n\n" nil t) (replace-match "" t t)) (goto-char (point-max)) (insert navigText) (goto-char 1) (other-window 1) )) The major content of this thread is now cleaned up and summarized as a tutorial and a essay at: =E2=80=A2 Dictionary and Reference Lookup with Emacs http://xahlee.org/emacs/emacs_lookup_ref.html =E2=80=A2 Problems of Open Source Dictionaries http://xahlee.org/Periodic_dosage_dir/bangu/dict_open_source_probs.html Xah =E2=88=91 http://xahlee.org/ =E2=98=84