unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: Can I build a dictionary in my Emacs?
Date: Thu, 26 Nov 2009 12:00:30 +0100	[thread overview]
Message-ID: <87skc17dpt.fsf@galatea.local> (raw)
In-Reply-To: 87vdgyx9lb.fsf@ymail.invalid

Water Lin <WaterLin@ymail.invalid> writes:

> I want to build a dictionary in my Emacs. So I can put my specific
> words, expressions and their meanings into it.
>
> By doing this, when I need them, I don't need to google them out again.
>
> I don't know if it is suitable to call it dictionary, but it likes
> dictionary.
>
> Any good suggestions?

Perhaps you could use EBD, the Emacs Data Base?


But if you have a persistent internet connection, why don't you just
use M-x dictionary RET?


Also, using google shouldn't be a big deal from emacs:


(require 'cl)
(require 'w3m)

(setf browse-url-browser-function
    (lambda (url &rest args)
      (other-frame 1) ; or (make-frame)
      (w3m-goto-url url)))


(defun google-search (search-string)
  "Search a string with Google."
  (interactive "sGoogle Search: ")
  (setf search-string
        (shell-command-to-string
         (format "echo %s|iconv -f ISO8859-1 -t UTF-8"
           (shell-quote-argument search-string))))
  (browse-url
   (format "http://www.google.com/search?as_q=%s&num=50&hl=en&ie=ISO8869-1&btnG=Google+Search&as_epq=&as_oq=&as_eq=&lr=&as_ft=i&as_filetype=&as_qdr=all&as_nlo=&as_nhi=&as_occt=any&as_dt=i&as_sitesearch=&safe=images"
     (apply (function concatenate) 'string
            (mapcar (lambda (ch)
                      (if (or (and (<= ?0 ch) (<= ch ?9))
                              (and (<= ?A ch) (<= ch ?Z))
                              (and (<= ?a ch) (<= ch ?z)))
                          (format "%c" ch)
                          (format "%%%02x" ch)))
                    (string-to-sequence search-string 'list)))))) 


(defun google-search-region (start end)
  "Search the text in the region with Google."
  (interactive "r")
  (google-search (buffer-substring-no-properties start end)))




-- 
__Pascal Bourguignon__


  reply	other threads:[~2009-11-26 11:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26  3:12 Can I build a dictionary in my Emacs? Water Lin
2009-11-26 11:00 ` Pascal J. Bourguignon [this message]
2009-11-26 11:54   ` Lennart Borgman
2009-11-26 22:14 ` Tim X
2009-11-27  8:32   ` Water Lin
2009-11-27 11:37   ` Colin S. Miller
2009-11-27 22:50     ` Tim X
2009-11-28  3:07 ` Stefan Monnier
2009-12-03 18:22   ` Drew Adams
2009-11-29  9:43 ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87skc17dpt.fsf@galatea.local \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).